本文整理汇总了Java中org.eclipse.draw2d.ColorConstants类的典型用法代码示例。如果您正苦于以下问题:Java ColorConstants类的具体用法?Java ColorConstants怎么用?Java ColorConstants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ColorConstants类属于org.eclipse.draw2d包,在下文中一共展示了ColorConstants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintCancel
import org.eclipse.draw2d.ColorConstants; //导入依赖的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: paintFigure
import org.eclipse.draw2d.ColorConstants; //导入依赖的package包/类
/**
* @see nexcore.tool.uml.ui.core.diagram.figure.AbstractNotationNodeFigure#paintFigure(org.eclipse.draw2d.Graphics)
*/
@Override
protected void paintFigure(Graphics graphics) {
super.paintFigure(graphics);
graphics.drawRectangle(getLocation().x, getLocation().y, getSize().width - 1, getSize().height - 1);
graphics.setAntialias(SWT.ON);
Rectangle bounds = getBounds();
if(isDangling()){
graphics.setForegroundColor(ColorConstants.red);
graphics.drawOval(bounds.x, bounds.y, 12, 12);
graphics.drawLine(bounds.x + 2, bounds.y + 2, bounds.x + 10, bounds.y + 10);
graphics.drawLine(bounds.x + 10, bounds.y + 2, bounds.x + 2, bounds.y + 10);
}
}
示例3: paintFigure
import org.eclipse.draw2d.ColorConstants; //导入依赖的package包/类
/**
* @see Figure#paintFigure(Graphics)
*/
protected void paintFigure(Graphics graphics) {
if (isOpaque())
super.paintFigure(graphics);
Rectangle bounds = getBounds();
graphics.translate(bounds.x, bounds.y);
if (icon != null)
graphics.drawImage(icon, getIconLocation());
if (!isEnabled()) {
graphics.translate(1, 1);
graphics.setForegroundColor(ColorConstants.buttonLightest);
graphics.drawText(getSubStringText(), getTextLocation());
graphics.translate(-1, -1);
graphics.setForegroundColor(ColorConstants.buttonDarker);
}
graphics.drawText(getSubStringText(), getTextLocation());
graphics.translate(-bounds.x, -bounds.y);
}
示例4: configureGraphicalViewer
import org.eclipse.draw2d.ColorConstants; //导入依赖的package包/类
@Override
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
getGraphicalViewer().getControl().setBackground(ColorConstants.button);
GraphicalViewer graphicalViewer = getGraphicalViewer();
MainDesignerRootEditPart rootEditPart = new MainDesignerRootEditPart();
graphicalViewer.setRootEditPart(rootEditPart);
// set EditPartFactory
graphicalViewer.setEditPartFactory(new JasperDesignEditPartFactory());
// set rulers providers
RulerProvider provider = new ReportRulerProvider(new ReportRuler(true, RulerProvider.UNIT_PIXELS));
graphicalViewer.setProperty(RulerProvider.PROPERTY_HORIZONTAL_RULER, provider);
provider = new ReportRulerProvider(new ReportRuler(false, RulerProvider.UNIT_PIXELS));
graphicalViewer.setProperty(RulerProvider.PROPERTY_VERTICAL_RULER, provider);
Boolean isRulerVisible = jrContext.getPropertyBoolean(RulersGridPreferencePage.P_PAGE_RULERGRID_SHOWRULER);
graphicalViewer.setProperty(RulerProvider.PROPERTY_RULER_VISIBILITY, isRulerVisible);
createAdditionalActions();
graphicalViewer.setKeyHandler(new JSSGraphicalViewerKeyHandler(graphicalViewer));
}
示例5: createMain
import org.eclipse.draw2d.ColorConstants; //导入依赖的package包/类
@Override
protected IFigure createMain ()
{
final Figure baseFigure = new LayeredPane ();
final Layer rootFigure = new Layer ();
this.connLayer = new ConnectionLayer ();
this.connLayer.setAntialias ( 1 );
this.connLayer.setConnectionRouter ( ConnectionRouter.NULL );
baseFigure.add ( this.connLayer );
baseFigure.add ( rootFigure );
rootFigure.setLayoutManager ( new BorderLayout () );
rootFigure.setBackgroundColor ( ColorConstants.white );
rootFigure.add ( createArrowFigure (), BorderLayout.RIGHT );
rootFigure.add ( createEntryGrid ( this.connLayer ), BorderLayout.CENTER );
return baseFigure;
}
示例6: rebuildFigure
import org.eclipse.draw2d.ColorConstants; //导入依赖的package包/类
@Override
public void rebuildFigure() {
getDisplay().setForegroundColor(ColorConstants.black);
add(getDisplay());
setConstraint(getDisplay(), new Rectangle(10, 10, -1, -1));
setOpaque(true);
setVisible(true);
setForegroundColor(ServiceNode.FONT_COLOR);
if (node.getType().equalsIgnoreCase(Enums.ServiceTypes.PROVIDED.name()))
setBackgroundColor(ColorConstants.green);
else if (node.getType().equalsIgnoreCase(Enums.ServiceTypes.REQUIRED.name()))
setBackgroundColor(ColorConstants.orange);
else
setBackgroundColor(ServiceNode.DEF_COLOR);
TooltipFigure tooltip = new TooltipFigure();
tooltip.setMessage("Service");
setToolTip(tooltip);
}
示例7: EdgeFigure
import org.eclipse.draw2d.ColorConstants; //导入依赖的package包/类
public EdgeFigure() {
tooltipFigure = new TooltipFigure();
setToolTip(tooltipFigure);
this.setLineWidth(this.getLineWidth() * 2);
this.setTargetDecoration(new PolylineDecoration());
label = new Label("e_"+ID.getId());
label.setOpaque(true);
label.setBackgroundColor(ColorConstants.buttonLightest);
label.setBorder(new LineBorder());
add(label, new MidpointLocator(this, 0));
guardedFigure = new GuardFigure();
blockedFigure = new BlockedFigure();
actionFigure = new ActionFigure ();
add (actionFigure, new RelativeLocator(label,0.5,1.5));
}
示例8: createFigure
import org.eclipse.draw2d.ColorConstants; //导入依赖的package包/类
@Override
protected IFigure createFigure() {
final LineLayout layout = new LineLayout();
layout.setHorizontal(true);
layout.setMajorAlignment(FlowLayout.ALIGN_TOPLEFT);
layout.setMinorAlignment(FlowLayout.ALIGN_BOTTOMRIGHT);
layout.setMinorSpacing(SPACING);
layout.setMargin(MARGIN);
FreeformLayer res = new FreeformLayer();
final Label toolTip = new Label();
toolTip.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
toolTip.setBackgroundColor(ColorConstants.tooltipBackground);
toolTip.setForegroundColor(ColorConstants.tooltipForeground);
toolTip.setText(getModel().getTimelineWindow().getProvider().getTextAt(getModel().getBranch()));
res.setToolTip(toolTip);
res.setLayoutManager(layout);
return res;
}
示例9: ComponentLabelFigure
import org.eclipse.draw2d.ColorConstants; //导入依赖的package包/类
/**
* Creates a new LabelFigure with a MarginBorder that is the given size and
* a FlowPage containing a TextFlow with the style WORD_WRAP_SOFT.
*
* @param borderSize
* the size of the MarginBorder
*/
public ComponentLabelFigure(int borderSize) {
setBorder(new MarginBorder(borderSize));
flowPage = new FlowPage();
textFlow.setLayoutManager(new ParagraphTextLayout(textFlow,
ParagraphTextLayout.WORD_WRAP_SOFT));
flowPage.add(textFlow);
flowPage.setHorizontalAligment(PositionConstants.CENTER);
setLayoutManager(new StackLayout());
add(flowPage);
font = new Font( Display.getDefault(), "Arial", 9,
SWT.NORMAL );
setFont(font);
setForegroundColor(ColorConstants.black);
}
示例10: CommentBoxFigure
import org.eclipse.draw2d.ColorConstants; //导入依赖的package包/类
/**
* Creates a new CommentBoxFigure with a MarginBorder that is the given size and a FlowPage containing a TextFlow
* with the style WORD_WRAP_SOFT.
*
* @param borderSize
* the size of the MarginBorder
*/
public CommentBoxFigure(int borderSize) {
setBorder(new MarginBorder(5));
FlowPage flowPage = new FlowPage();
textFlow = new TextFlow();
textFlow.setLayoutManager(new ParagraphTextLayout(textFlow, ParagraphTextLayout.WORD_WRAP_SOFT));
flowPage.add(textFlow);
setLayoutManager(new StackLayout());
add(flowPage);
font = new Font(Display.getDefault(), "Arial", 9, SWT.NORMAL);
setFont(font);
setForegroundColor(ColorConstants.black);
setOpaque(false);
}
示例11: AbstractNodeFigure
import org.eclipse.draw2d.ColorConstants; //导入依赖的package包/类
public AbstractNodeFigure(AbstractNodeElement node,Image icon){
this.node=node;
BorderLayout layout=new BorderLayout();
this.setLayoutManager(layout);
ImageFigure iconFigure=new ImageFigure(icon);
this.add(iconFigure,BorderLayout.LEFT);
this.label=new Label(this.node.getLabel());
this.label.setForegroundColor(ColorConstants.black);
this.add(this.label,BorderLayout.CENTER);
this.setAntialias(SWT.ON);
RGB rgb=Activator.getPreference().getBorderColor();
this.setForegroundColor(new Color(null,rgb.red,rgb.green,rgb.blue));
rgb=Activator.getPreference().getBackgroundColor();
this.setBackgroundColor(new Color(null,rgb.red,rgb.green,rgb.blue));
this.setLineWidth(2);
}
示例12: TableFigure
import org.eclipse.draw2d.ColorConstants; //导入依赖的package包/类
public TableFigure() {
ToolbarLayout layout = new ToolbarLayout();
setLayoutManager(layout);
LineBorder lineBorder = new LineBorder(ColorConstants.lightGray, 2);
setBorder(lineBorder);
setOpaque(true);
setBackgroundColor(ColorConstants.white);
Font font = new Font(null, "宋体", 11, SWT.NORMAL);
label.setFont(font);
label.setBorder(new LineBorder(ColorConstants.lightGray));
label.setIcon(Activator.getImage(Activator.IMAGE_TABLE_16));
label.setOpaque(true);
label.setBackgroundColor(ColorConstants.lightBlue);
label.setForegroundColor(ColorConstants.black);
add(label);
add(columnFigure);
}
示例13: refreshFigure
import org.eclipse.draw2d.ColorConstants; //导入依赖的package包/类
public void refreshFigure(BaseModel model) {
Image imageBlank = Activator.getImage(Activator.IMAGE_BLANK);
Column column = (Column) model;
setForegroundColor(column.isPk() ? ColorConstants.red : ColorConstants.black);
pkFigure.setImage(column.isPk() ? Activator.getImage(Activator.IMAGE_PK) : imageBlank);
fkFigure.setImage(column.isFk() ? Activator.getImage(Activator.IMAGE_FK) : imageBlank);
firstLabel.setText(" " + column.getLabel() + "/" + column.getName() + " ");
String type = column.getType();
DbDialect dbDialect = DbDialectManager.getDbDialect(column.getTable().getSchema().getCurrentDbType());
ColumnType columnType = DbDialectManager.getColumnType(dbDialect, type);
String length = column.getLength();
String decimal = column.getDecimalLength();
if (columnType.isLength() && columnType.isDecimal() && length.length() > 0 && decimal.length() > 0) {
type += "(" + length + "," + decimal + ")";
} else if (columnType.isLength() && length.length() > 0 && decimal.length() == 0) {
type += "(" + length + ")";
}
lastLabel.setText(type);
notNullFigure.setImage(column.isNotNull() ? Activator.getImage(Activator.IMAGE_NOTNULL) : imageBlank);
uniqueFigure.setImage(column.isUnique() ? Activator.getImage(Activator.IMAGE_UNIQUE) : imageBlank);
}
示例14: update
import org.eclipse.draw2d.ColorConstants; //导入依赖的package包/类
private void update() {
removeAll();
valid = model.isMatrix();
if(valid) {
Object[] array = (Object[]) model.getValues();
for(Object line : array) {
int len = Array.getLength(line);
for(int i = 0; i < len; i++) {
Object e = Array.get(line, i);
Label label = new Label(e.toString()); // TODO array deepToString
label.setForegroundColor(ColorConstants.black);
add(label);
}
}
}
getLayoutManager().layout(this);
repaint();
}
示例15: paintFigure
import org.eclipse.draw2d.ColorConstants; //导入依赖的package包/类
@Override
protected void paintFigure(Graphics g) {
super.paintFigure(g);
final int LEG = 5;
Rectangle r = getBounds();
g.setLineWidth(1);
g.setForegroundColor(valid ? ColorConstants.black : PandionJConstants.Colors.ERROR);
g.drawLine(r.x, r.y, r.x, r.y+r.height-1);
g.drawLine(r.x, r.y, r.x+LEG, r.y);
g.drawLine(r.x, r.y+r.height-1, r.x+LEG, r.y+r.height-1);
g.drawLine(r.x+r.width-1, r.y, r.x+r.width-1, r.y+r.height);
g.drawLine(r.x+r.width-1, r.y, r.x+r.width-1-LEG, r.y);
g.drawLine(r.x+r.width-1, r.y+r.height-1, r.x+r.width-1-LEG, r.y+r.height-1);
if(!valid) {
g.setForegroundColor(PandionJConstants.Colors.ERROR);
String text = "Invalid matrix";
int textWidth = FigureUtilities.getTextWidth(text, g.getFont());
Point p = r.getLocation().translate(r.width/2 - textWidth/2, 5);
g.drawText(text, p);
}
}