本文整理汇总了Java中org.eclipse.draw2d.geometry.Insets类的典型用法代码示例。如果您正苦于以下问题:Java Insets类的具体用法?Java Insets怎么用?Java Insets使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Insets类属于org.eclipse.draw2d.geometry包,在下文中一共展示了Insets类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintCancel
import org.eclipse.draw2d.geometry.Insets; //导入依赖的package包/类
protected void paintCancel(Graphics graphics){
Rectangle barBounds = getBounds().getCopy();
barBounds.crop(new Insets(getMargin()));
if (barBounds.height > getMaxHeight()){
int dy = (barBounds.height - getMaxHeight())/2;
barBounds.crop(new Insets(dy,0,dy,0));
}
Rectangle cancelBounds = barBounds.getCopy();
cancelBounds.x = cancelBounds.right() - getCancelButtonWidth();
cancelBounds.width = getCancelButtonWidth();
Color cancelColor = new Color(null,
ColorUtils.darker(
ColorUtils.darker(
graphics.getBackgroundColor().getRGB())));
graphics.setBackgroundColor(cancelColor);
int radius = Math.min(15, cancelBounds.height);
graphics.fillRoundRectangle(cancelBounds, radius, radius);
graphics.drawRoundRectangle(cancelBounds, radius, radius);
graphics.setForegroundColor(ColorConstants.white);
paintString(graphics, "Cancel", cancelBounds);
cancelColor.dispose();
}
示例2: paint
import org.eclipse.draw2d.geometry.Insets; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void paint(final IFigure figure, final Graphics graphics, final Insets insets) {
if (getColor() != null) {
graphics.setForegroundColor(getColor());
}
tempRect.setBounds(getPaintRectangle(figure, insets));
if (getWidth() % 2 == 1) {
tempRect.width--;
tempRect.height--;
}
tempRect.shrink(getWidth() / 2, getWidth() / 2);
graphics.setLineWidth(1);
int g = 9 * DELTA;
int b = 9 * DELTA;
for (int i = 0; i <= 5; i++) {
final Color color = Resources.getColor(new int[] {b, g, 255});
paint1(i, color, tempRect, graphics);
g -= DELTA;
b -= DELTA;
}
}
示例3: createColumnArea
import org.eclipse.draw2d.geometry.Insets; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void createColumnArea(final IFigure columns) {
initColumnArea(columns);
columns.setBorder(new MarginBorder(0, 0, 0, 0));
columns.setBackgroundColor(ColorConstants.white);
columns.setOpaque(true);
final Figure centerFigure = new Figure();
centerFigure.setLayoutManager(new BorderLayout());
centerFigure.setBorder(new MarginBorder(new Insets(0, 2, 0, 2)));
centerFigure.add(columns, BorderLayout.CENTER);
getTableFigure().add(centerFigure, BorderLayout.CENTER);
}
示例4: createFooter
import org.eclipse.draw2d.geometry.Insets; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void createFooter() {
final IFigure footer = new Figure();
final BorderLayout footerLayout = new BorderLayout();
footer.setLayoutManager(footerLayout);
footer.setBorder(new MarginBorder(new Insets(0, 2, 0, 2)));
final IFigure footer1 = new Figure();
footer1.setSize(-1, 10);
footer1.setBackgroundColor(Resources.VERY_LIGHT_GRAY);
footer1.setOpaque(true);
footer.add(footer1, BorderLayout.TOP);
final IFigure footer2 = new Figure();
footer2.setSize(-1, 7);
footer.add(footer2, BorderLayout.BOTTOM);
getTableFigure().add(footer, BorderLayout.BOTTOM);
}
示例5: initTitleBar
import org.eclipse.draw2d.geometry.Insets; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void initTitleBar(final Figure top) {
final ToolbarLayout topLayout = new ToolbarLayout();
topLayout.setMinorAlignment(OrderedLayout.ALIGN_TOPLEFT);
topLayout.setStretchMinorAxis(true);
top.setLayoutManager(topLayout);
nameLabel = new Label();
nameLabel.setBorder(new MarginBorder(new Insets(5, 20, 5, 20)));
top.add(nameLabel);
final Figure separater = new Figure();
separater.setSize(-1, 1);
separater.setBackgroundColor(getTextColor());
separater.setOpaque(true);
top.add(separater);
}
示例6: getPrintRegion
import org.eclipse.draw2d.geometry.Insets; //导入依赖的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;
}
示例7: paint
import org.eclipse.draw2d.geometry.Insets; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void paint(IFigure figure, Graphics graphics, Insets insets) {
if (getColor() != null) {
graphics.setForegroundColor(getColor());
}
tempRect.setBounds(getPaintRectangle(figure, insets));
if (getWidth() % 2 == 1) {
tempRect.width--;
tempRect.height--;
}
tempRect.shrink(getWidth() / 2, getWidth() / 2);
graphics.setLineWidth(1);
int g = 9 * DELTA;
int b = 9 * DELTA;
for (int i = 0; i <= 5; i++) {
Color color = Resources.getColor(new int[] { b, g, 255 });
this.paint1(i, color, tempRect, graphics);
g -= DELTA;
b -= DELTA;
}
}
示例8: createColumnArea
import org.eclipse.draw2d.geometry.Insets; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void createColumnArea(IFigure columns) {
this.initColumnArea(columns);
columns.setBorder(new MarginBorder(0, 0, 0, 0));
columns.setBackgroundColor(ColorConstants.white);
columns.setOpaque(true);
this.centerFigure = new Figure();
this.centerFigure.setLayoutManager(new BorderLayout());
this.centerFigure.setBorder(new MarginBorder(new Insets(0, 2, 0, 2)));
centerFigure.add(columns, BorderLayout.CENTER);
this.getTableFigure().add(this.centerFigure, BorderLayout.CENTER);
}
示例9: createFooter
import org.eclipse.draw2d.geometry.Insets; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void createFooter() {
IFigure footer = new Figure();
BorderLayout footerLayout = new BorderLayout();
footer.setLayoutManager(footerLayout);
footer.setBorder(new MarginBorder(new Insets(0, 2, 0, 2)));
IFigure footer1 = new Figure();
footer1.setSize(-1, 10);
footer1.setBackgroundColor(Resources.VERY_LIGHT_GRAY);
footer1.setOpaque(true);
footer.add(footer1, BorderLayout.TOP);
IFigure footer2 = new Figure();
footer2.setSize(-1, 7);
footer.add(footer2, BorderLayout.BOTTOM);
this.getTableFigure().add(footer, BorderLayout.BOTTOM);
}
示例10: initTitleBar
import org.eclipse.draw2d.geometry.Insets; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void initTitleBar(Figure top) {
ToolbarLayout topLayout = new ToolbarLayout();
topLayout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
topLayout.setStretchMinorAxis(true);
top.setLayoutManager(topLayout);
this.nameLabel = new Label();
this.nameLabel.setBorder(new MarginBorder(new Insets(5, 20, 5, 20)));
top.add(nameLabel);
Figure separater = new Figure();
separater.setSize(-1, 1);
separater.setBackgroundColor(this.getTextColor());
separater.setOpaque(true);
top.add(separater);
}
示例11: getPrintRegion
import org.eclipse.draw2d.geometry.Insets; //导入依赖的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;
}
示例12: redo
import org.eclipse.draw2d.geometry.Insets; //导入依赖的package包/类
public void redo() {
if (rect != null) {
Insets expansion = getInsets();
if (!rect.isEmpty())
rect.expand(expansion);
else {
rect.x -= expansion.left;
rect.y -= expansion.top;
}
child.setLocation(rect.getLocation());
// if (!rect.isEmpty())
// child.setSize(rect.getSize());
}
((Container)parent).addChild(child, index);
child.initDefaults();
}
示例13: initTitleBar
import org.eclipse.draw2d.geometry.Insets; //导入依赖的package包/类
@Override
public void initTitleBar(Figure top) {
final ToolbarLayout topLayout = new ToolbarLayout();
topLayout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
topLayout.setStretchMinorAxis(true);
top.setLayoutManager(topLayout);
this.nameLabel = new Label();
nameLabel.setBorder(new MarginBorder(new Insets(5, 20, 5, 20)));
top.add(nameLabel);
final Figure separater = new Figure();
separater.setSize(-1, 1);
separater.setBackgroundColor(getTextColor());
separater.setOpaque(true);
top.add(separater);
}
示例14: paint
import org.eclipse.draw2d.geometry.Insets; //导入依赖的package包/类
public void paint(IFigure figure, Graphics graphics, Insets insets) {
if (!is3D()) {
return;
}
graphics.setBackgroundColor(SHADOW_COLOR);
Rectangle rec = getProportionalBounds().getTranslated(SHADOW_SIZE, SHADOW_SIZE);
graphics.pushState();
graphics.clipRect(rec);
// graphics.setClip(new Rectangle(rec.x, rec.y + rec.height -
// getShift(), rec.width, getShift()));
fillShape(graphics, rec);
graphics.popState();
// graphics.setClip(new Rectangle(rec.x + rec.width - getShift(),
// rec.y, getShift(), rec.height));
// fillShape(graphics, rec);
}
示例15: drawHorizontalTitleBar
import org.eclipse.draw2d.geometry.Insets; //导入依赖的package包/类
/**
* rect는 타이틀 바를 그릴 사각형이다. 여기서는 이 사각형에 타이틀 바를 그린다.
* 타이틀 바를 가로로 생성한 파티션의 왼쪽에 세로로 그린다.
*
* @param figure
* @param g
* @param rect
* void
*/
private void drawHorizontalTitleBar(IFigure figure, Graphics g, Rectangle rect) {
g.setBackgroundColor(getBackgroundColor());
g.fillRectangle(rect);
Insets padding = getPadding();
int x = rect.x + padding.left;
int y = rect.y + padding.top + (rect.height - getTextExtents(figure).height) / 2;
int textWidth = getTextExtents(figure).width;
int freeSpace = rect.width - padding.getWidth() - textWidth;
if (getTextAlignment() == PositionConstants.CENTER)
freeSpace /= 2;
if (getTextAlignment() != PositionConstants.LEFT)
x += freeSpace;
Font f = getFont(figure);
FontData fData = f.getFontData()[0];
fData.setName(this.getFontName());
fData.setStyle(this.getTextStyle());
fData.setHeight(this.getFontSize());
g.setFont(f);
g.setForegroundColor(this.getTextColor());
g.drawString(getLabel(), x, y);
}