本文整理汇总了Java中org.insightech.er.editor.model.settings.PageSetting类的典型用法代码示例。如果您正苦于以下问题:Java PageSetting类的具体用法?Java PageSetting怎么用?Java PageSetting使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PageSetting类属于org.insightech.er.editor.model.settings包,在下文中一共展示了PageSetting类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPrintRegion
import org.insightech.er.editor.model.settings.PageSetting; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Rectangle getPrintRegion() {
final ERDiagram diagram = getDiagram();
final PageSetting pageSetting = diagram.getPageSetting();
final org.eclipse.swt.graphics.Rectangle trim = getPrinter().computeTrim(0, 0, 0, 0);
final org.eclipse.swt.graphics.Point printerDPI = getPrinter().getDPI();
final Insets notAvailable = new Insets(-trim.y, -trim.x, trim.height + trim.y, trim.width + trim.x);
final Insets userPreferred = new Insets((pageSetting.getTopMargin() * printerDPI.x) / 72, (pageSetting.getLeftMargin() * printerDPI.x) / 72, (pageSetting.getBottomMargin() * printerDPI.x) / 72, (pageSetting.getRightMargin() * printerDPI.x) / 72);
final Rectangle paperBounds = new Rectangle(getPrinter().getBounds());
final Rectangle printRegion = shrink(paperBounds, notAvailable);
printRegion.intersect(shrink(paperBounds, userPreferred));
printRegion.translate(trim.x, trim.y);
return printRegion;
}
示例2: loadPageSetting
import org.insightech.er.editor.model.settings.PageSetting; //导入依赖的package包/类
private void loadPageSetting(final ERDiagram diagram, final Element element) {
final Element dbSettingElement = getElement(element, "page_setting");
if (dbSettingElement != null) {
final boolean directionHorizontal = this.getBooleanValue(element, "direction_horizontal");
final int scale = this.getIntValue(element, "scale");
final String paperSize = getStringValue(element, "paper_size");
final int topMargin = this.getIntValue(element, "top_margin");
final int leftMargin = this.getIntValue(element, "left_margin");
final int bottomMargin = this.getIntValue(element, "bottom_margin");
final int rightMargin = this.getIntValue(element, "right_margin");
final PageSetting pageSetting = new PageSetting(directionHorizontal, scale, paperSize, topMargin, rightMargin, bottomMargin, leftMargin);
diagram.setPageSetting(pageSetting);
}
}
示例3: getPrintRegion
import org.insightech.er.editor.model.settings.PageSetting; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Rectangle getPrintRegion() {
ERDiagram diagram = this.getDiagram();
PageSetting pageSetting = diagram.getPageSetting();
org.eclipse.swt.graphics.Rectangle trim = this.getPrinter()
.computeTrim(0, 0, 0, 0);
org.eclipse.swt.graphics.Point printerDPI = this.getPrinter().getDPI();
Insets notAvailable = new Insets(-trim.y, -trim.x,
trim.height + trim.y, trim.width + trim.x);
Insets userPreferred = new Insets(
(pageSetting.getTopMargin() * printerDPI.x) / 72,
(pageSetting.getLeftMargin() * printerDPI.x) / 72,
(pageSetting.getBottomMargin() * printerDPI.x) / 72,
(pageSetting.getRightMargin() * printerDPI.x) / 72);
Rectangle paperBounds = new Rectangle(this.getPrinter().getBounds());
Rectangle printRegion = shrink(paperBounds, notAvailable);
printRegion.intersect(shrink(paperBounds, userPreferred));
printRegion.translate(trim.x, trim.y);
return printRegion;
}
示例4: createXML
import org.insightech.er.editor.model.settings.PageSetting; //导入依赖的package包/类
private String createXML(PageSetting pageSetting) {
StringBuilder xml = new StringBuilder();
xml.append("<direction_horizontal>")
.append(pageSetting.isDirectionHorizontal())
.append("</direction_horizontal>\n");
xml.append("<scale>").append(pageSetting.getScale())
.append("</scale>\n");
xml.append("<paper_size>").append(escape(pageSetting.getPaperSize()))
.append("</paper_size>\n");
xml.append("<top_margin>").append(pageSetting.getTopMargin())
.append("</top_margin>\n");
xml.append("<left_margin>").append(pageSetting.getLeftMargin())
.append("</left_margin>\n");
xml.append("<bottom_margin>").append(pageSetting.getBottomMargin())
.append("</bottom_margin>\n");
xml.append("<right_margin>").append(pageSetting.getRightMargin())
.append("</right_margin>\n");
return xml.toString();
}
示例5: loadPageSetting
import org.insightech.er.editor.model.settings.PageSetting; //导入依赖的package包/类
private void loadPageSetting(ERDiagram diagram, Element element) {
Element dbSettingElement = this.getElement(element, "page_setting");
if (dbSettingElement != null) {
boolean directionHorizontal = this.getBooleanValue(element,
"direction_horizontal");
int scale = this.getIntValue(element, "scale");
String paperSize = this.getStringValue(element, "paper_size");
int topMargin = this.getIntValue(element, "top_margin");
int leftMargin = this.getIntValue(element, "left_margin");
int bottomMargin = this.getIntValue(element, "bottom_margin");
int rightMargin = this.getIntValue(element, "right_margin");
PageSetting pageSetting = new PageSetting(directionHorizontal,
scale, paperSize, topMargin, rightMargin, bottomMargin,
leftMargin);
diagram.setPageSetting(pageSetting);
}
}
示例6: setPaperSize
import org.insightech.er.editor.model.settings.PageSetting; //导入依赖的package包/类
private void setPaperSize(final Combo combo) {
for (final String paperSize : PageSetting.getAllPaperSize()) {
combo.add(paperSize);
}
combo.select(0);
}
示例7: setupPrinterGraphicsFor
import org.insightech.er.editor.model.settings.PageSetting; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void setupPrinterGraphicsFor(final Graphics graphics, final IFigure figure) {
final ERDiagram diagram = getDiagram();
final PageSetting pageSetting = diagram.getPageSetting();
final double dpiScale = (double) getPrinter().getDPI().x / Display.getCurrent().getDPI().x * pageSetting.getScale() / 100;
final Rectangle printRegion = getPrintRegion();
// put the print region in display coordinates
printRegion.width /= dpiScale;
printRegion.height /= dpiScale;
final Rectangle bounds = figure.getBounds();
final double xScale = (double) printRegion.width / bounds.width;
final double yScale = (double) printRegion.height / bounds.height;
switch (getPrintMode()) {
case FIT_PAGE:
graphics.scale(Math.min(xScale, yScale) * dpiScale);
break;
case FIT_WIDTH:
graphics.scale(xScale * dpiScale);
break;
case FIT_HEIGHT:
graphics.scale(yScale * dpiScale);
break;
default:
graphics.scale(dpiScale);
}
graphics.setForegroundColor(figure.getForegroundColor());
graphics.setBackgroundColor(figure.getBackgroundColor());
graphics.setFont(figure.getFont());
}
示例8: ERDiagram
import org.insightech.er.editor.model.settings.PageSetting; //导入依赖的package包/类
public ERDiagram(final String database) {
diagramContents = new DiagramContents();
diagramContents.getSettings().setDatabase(database);
pageSetting = new PageSetting();
setDefaultColor(128, 128, 192);
setColor(255, 255, 255);
if (Display.getCurrent() != null) {
final FontData fontData = Display.getCurrent().getSystemFont().getFontData()[0];
setFontName(fontData.getName());
}
}
示例9: createXML
import org.insightech.er.editor.model.settings.PageSetting; //导入依赖的package包/类
private String createXML(final PageSetting pageSetting) {
final StringBuilder xml = new StringBuilder();
xml.append("<direction_horizontal>").append(pageSetting.isDirectionHorizontal()).append("</direction_horizontal>\n");
xml.append("<scale>").append(pageSetting.getScale()).append("</scale>\n");
xml.append("<paper_size>").append(escape(pageSetting.getPaperSize())).append("</paper_size>\n");
xml.append("<top_margin>").append(pageSetting.getTopMargin()).append("</top_margin>\n");
xml.append("<left_margin>").append(pageSetting.getLeftMargin()).append("</left_margin>\n");
xml.append("<bottom_margin>").append(pageSetting.getBottomMargin()).append("</bottom_margin>\n");
xml.append("<right_margin>").append(pageSetting.getRightMargin()).append("</right_margin>\n");
return xml.toString();
}
示例10: setPaperSize
import org.insightech.er.editor.model.settings.PageSetting; //导入依赖的package包/类
private void setPaperSize(Combo combo) {
for (String paperSize : PageSetting.getAllPaperSize()) {
combo.add(paperSize);
}
combo.select(0);
}
示例11: perfomeOK
import org.insightech.er.editor.model.settings.PageSetting; //导入依赖的package包/类
@Override
protected void perfomeOK() throws InputException {
this.pageSetting = new PageSetting(this.hButton.getSelection(),
this.scaleSpinner.getSelection(), this.sizeCombo.getText(),
this.topMarginSpinner.getSelection(),
this.rightMarginSpinner.getSelection(),
this.bottomMarginSpinner.getSelection(),
this.leftMarginSpinner.getSelection());
this.diagram.setPageSetting(this.pageSetting);
}
示例12: setupPrinterGraphicsFor
import org.insightech.er.editor.model.settings.PageSetting; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void setupPrinterGraphicsFor(Graphics graphics, IFigure figure) {
ERDiagram diagram = this.getDiagram();
PageSetting pageSetting = diagram.getPageSetting();
double dpiScale = (double) getPrinter().getDPI().x
/ Display.getCurrent().getDPI().x * pageSetting.getScale()
/ 100;
Rectangle printRegion = getPrintRegion();
// put the print region in display coordinates
printRegion.width /= dpiScale;
printRegion.height /= dpiScale;
Rectangle bounds = figure.getBounds();
double xScale = (double) printRegion.width / bounds.width;
double yScale = (double) printRegion.height / bounds.height;
switch (getPrintMode()) {
case FIT_PAGE:
graphics.scale(Math.min(xScale, yScale) * dpiScale);
break;
case FIT_WIDTH:
graphics.scale(xScale * dpiScale);
break;
case FIT_HEIGHT:
graphics.scale(yScale * dpiScale);
break;
default:
graphics.scale(dpiScale);
}
graphics.setForegroundColor(figure.getForegroundColor());
graphics.setBackgroundColor(figure.getBackgroundColor());
graphics.setFont(figure.getFont());
}
示例13: ERDiagram
import org.insightech.er.editor.model.settings.PageSetting; //导入依赖的package包/类
public ERDiagram(String database) {
this.diagramContents = new DiagramContents();
this.diagramContents.getSettings().setDatabase(database);
this.pageSetting = new PageSetting();
this.setDefaultColor(128, 128, 192);
this.setColor(255, 255, 255);
if (Display.getCurrent() != null) {
FontData fontData = Display.getCurrent().getSystemFont()
.getFontData()[0];
this.setFontName(fontData.getName());
}
}
示例14: perfomeOK
import org.insightech.er.editor.model.settings.PageSetting; //导入依赖的package包/类
@Override
protected void perfomeOK() throws InputException {
pageSetting = new PageSetting(hButton.getSelection(), scaleSpinner.getSelection(), sizeCombo.getText(), topMarginSpinner.getSelection(), rightMarginSpinner.getSelection(), bottomMarginSpinner.getSelection(), leftMarginSpinner.getSelection());
diagram.setPageSetting(pageSetting);
}
示例15: paintGrid
import org.insightech.er.editor.model.settings.PageSetting; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void paintGrid(final Graphics g) {
super.paintGrid(g);
final Rectangle clip = g.getClip(Rectangle.SINGLETON);
final PageSetting pageSetting = diagram.getPageSetting();
final int width = pageSetting.getWidth();
final int height = pageSetting.getHeight();
final Rectangle rect = clip;
final Color color = g.getForegroundColor();
g.setForegroundColor(ColorConstants.lightGray);
int startX = rect.x;
if (startX > 0) {
startX = 0;
}
int startY = rect.y;
if (startY > 0) {
startY = 0;
}
for (int i = startX; i < rect.x + rect.width; i += width) {
g.drawLine(i, rect.y, i, rect.y + rect.height);
}
for (int i = startY; i < rect.y + rect.height; i += height) {
g.drawLine(rect.x, i, rect.x + rect.width, i);
}
g.setForegroundColor(color);
i++;
if (i > 0) {
i = -1;
repaint();
}
}