本文整理匯總了Java中org.eclipse.draw2d.Figure類的典型用法代碼示例。如果您正苦於以下問題:Java Figure類的具體用法?Java Figure怎麽用?Java Figure使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Figure類屬於org.eclipse.draw2d包,在下文中一共展示了Figure類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createContents
import org.eclipse.draw2d.Figure; //導入依賴的package包/類
private static Figure createContents() {
Figure contents = new Figure();
XYLayout layout = new XYLayout();
contents.setLayoutManager(layout);
Button button = new Button("Hello World");
layout.setConstraint(button, new Rectangle(0, 0, -1, -1));
contents.add(button);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionevent) {
setBrightness();
}
});
String path = "C:\\Users\\Public\\Pictures\\Sample Pictures\\Oryx Antelope.jpg";
image = new Image(Display.getDefault(), path);
imageFigure = new ImageFigure(image);
layout.setConstraint(imageFigure, new Rectangle(0, 30, -1, -1));
contents.add(imageFigure);
return contents;
}
示例2: createContents
import org.eclipse.draw2d.Figure; //導入依賴的package包/類
protected void createContents() {
// Name Label
nameFigure = new SyntaxColoringLabel();
nameFigure.setAlignment(PositionConstants.CENTER);
this.add(nameFigure, GridDataFactory.fillDefaults().grab(true, false)
.getData());
// Text compartment
textCompartmentPane = new Figure();
textCompartmentPane.setLayoutManager(new StackLayout());
this.add(textCompartmentPane,
GridDataFactory.fillDefaults().grab(true, true).getData());
figureCompartmentPane = new Figure();
figureCompartmentPane.setLayoutManager(new StackLayout());
this.add(figureCompartmentPane,
GridDataFactory.fillDefaults().grab(true, true).getData());
}
示例3: createMain
import org.eclipse.draw2d.Figure; //導入依賴的package包/類
@Override
protected IFigure createMain ()
{
final Figure rootFigure = new Figure ();
rootFigure.setLayoutManager ( new GridLayout ( 3, true ) );
rootFigure.add ( makeHeader (), new GridData ( GridData.BEGINNING, GridData.CENTER, true, false, 3, 1 ) );
rootFigure.add ( createSourceValue (), new GridData ( GridData.CENTER, GridData.CENTER, true, true ) );
rootFigure.add ( new Figure () );
rootFigure.add ( createTargetValue (), new GridData ( GridData.CENTER, GridData.CENTER, true, true ) );
rootFigure.add ( new Figure () );
rootFigure.add ( createCommandPanel (), new GridData ( GridData.CENTER, GridData.CENTER, true, true ) );
createRoundArrow ( rootFigure );
return rootFigure;
}
示例4: createRoundArrow
import org.eclipse.draw2d.Figure; //導入依賴的package包/類
private void createRoundArrow ( final Figure figure )
{
final PolylineConnection c = new PolylineConnection ();
c.setSourceAnchor ( new ChopboxAnchor ( this.sourceRect ) );
c.setTargetAnchor ( new ChopboxAnchor ( this.targetRect ) );
final PolygonDecoration dec = new PolygonDecoration ();
dec.setTemplate ( PolygonDecoration.TRIANGLE_TIP );
c.setTargetDecoration ( dec );
final MidpointLocator typeLocator = new MidpointLocator ( c, 0 );
typeLocator.setRelativePosition ( PositionConstants.NORTH );
this.typeLabel = new Label ( "" ); //$NON-NLS-1$
c.add ( this.typeLabel, typeLocator );
figure.add ( c );
this.roundConnection = c;
}
示例5: createMain
import org.eclipse.draw2d.Figure; //導入依賴的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: GridContainerController
import org.eclipse.draw2d.Figure; //導入依賴的package包/類
public GridContainerController ( final SymbolController controller, final GridContainer element, final BasicViewElementFactory factory ) throws Exception
{
this.figure = new Figure ();
final GridLayout gridLayout = new GridLayout ( element.getColumns (), element.isEqualWidth () );
gridLayout.horizontalSpacing = element.getHorizontalSpacing ();
gridLayout.verticalSpacing = element.getVerticalSpacing ();
gridLayout.marginHeight = element.getMarginHeight ();
gridLayout.marginWidth = element.getMarginWidth ();
this.figure.setLayoutManager ( gridLayout );
for ( final GridChild child : element.getChildren () )
{
final Controller elementController = factory.create ( controller, child.getElement () );
final IFigure childFigure = elementController.getFigure ();
this.figure.add ( childFigure, convert ( child ) );
}
controller.addElement ( element, this );
}
示例7: createColumnArea
import org.eclipse.draw2d.Figure; //導入依賴的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);
}
示例8: createFooter
import org.eclipse.draw2d.Figure; //導入依賴的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);
}
示例9: initTitleBar
import org.eclipse.draw2d.Figure; //導入依賴的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);
}
示例10: createColumnArea
import org.eclipse.draw2d.Figure; //導入依賴的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);
}
示例11: createFooter
import org.eclipse.draw2d.Figure; //導入依賴的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);
}
示例12: initTitleBar
import org.eclipse.draw2d.Figure; //導入依賴的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);
}
示例13: refreshVisuals
import org.eclipse.draw2d.Figure; //導入依賴的package包/類
/**
* @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals()
*/
@Override
protected void refreshVisuals() {
try {
super.refreshVisuals();
int totalHeight = 0;
for (int i = 0; i < getFigure().getChildren().size(); i++) {
totalHeight += ((Figure) getFigure().getChildren().get(i)).getSize().height;
}
NotationNode notationNode = (NotationNode) getModel();
Rectangle bounds = new Rectangle(notationNode.getX(),
notationNode.getY(),
notationNode.getWidth(),
notationNode.getHeight());
getFigure().setSize(notationNode.getWidth(), totalHeight);// notationNode.getHeight());
getFigure().setLocation(new Point(notationNode.getX(), notationNode.getY()));
setLayoutConstraint(this, getFigure(), bounds);
getFigure().setBackgroundColor(new Color(null, getFillColor()));
} catch (Exception e) {
Log.error(UMLMessage.MESSAGE_DATA_STORE_NODE_EDIT_PART_REFRESH_VISUALS_ERROR + e);
}
}
示例14: refreshVisuals
import org.eclipse.draw2d.Figure; //導入依賴的package包/類
/**
* @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals()
*/
@Override
protected void refreshVisuals() {
try {
super.refreshVisuals();
int totalHeight = 0;
for (int i = 0; i < getFigure().getChildren().size(); i++) {
totalHeight += ((Figure) getFigure().getChildren().get(i)).getSize().height;
}
NotationNode notationNode = (NotationNode) getModel();
Rectangle bounds = new Rectangle(notationNode.getX(),
notationNode.getY(),
notationNode.getWidth(),
notationNode.getHeight());
getFigure().setSize(notationNode.getWidth(), totalHeight);// notationNode.getHeight());
getFigure().setLocation(new Point(notationNode.getX(), notationNode.getY()));
setLayoutConstraint(this, getFigure(), bounds);
getFigure().setBackgroundColor(new Color(null, getFillColor()));
} catch (Exception e) {
Log.error(UMLMessage.MESSAGE_CLASS_EDIT_PART_REFRESH_VISUAL_ERROR + e);
}
}
示例15: createFooter
import org.eclipse.draw2d.Figure; //導入依賴的package包/類
@Override
public void createFooter() {
final IFigure footer = new Figure();
final BorderLayout footerLayout = new BorderLayout();
footer.setLayoutManager(footerLayout);
footer.setBorder(new MarginBorder(new Insets(0, 0, 0, 0)));
final IFigure footer1 = new Figure();
footer1.setSize(-1, 1);
footer1.setBackgroundColor(ColorConstants.black);
footer1.setOpaque(true);
footer.add(footer1, BorderLayout.TOP);
final IFigure footer2 = new Figure();
footer2.setSize(-1, 6);
footer.add(footer2, BorderLayout.BOTTOM);
getTableFigure().add(footer, BorderLayout.BOTTOM);
}