org.eclipse.draw2d.RectangleFigure Java Examples

The following examples show how to use org.eclipse.draw2d.RectangleFigure. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TreeLayout.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
protected TreeNode createRootTreeNode(IFigure parent) {

		final List<IFigure> rootFigures = getGraphRootFigures(parent);

		if (rootFigures.size() > 1) {
			// initializes a "virtual" root
			// tree level (needed for correct size calculations)
			RectangleFigure rootFigure = new RectangleFigure();
			rootFigure.setPreferredSize(1, 1);
			rootFigure.setSize(1, 1);
			setConstraint(rootFigure, new Rectangle(0, 0, 0, 0));
			TreeNode rootTreeNode = new TreeNode(null, rootFigure);

			for (IFigure figure : rootFigures) {
				rootTreeNode.children.add(new TreeNode(null, figure));
			}
			return rootTreeNode;

		} else if (rootFigures.size() == 1) {

			return new TreeNode(null, rootFigures.get(0));

		}
		return null;

	}
 
Example #2
Source File: CursorFigure.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public CursorFigure(ITimelineStyleProvider styleProvider) {
	setLayoutManager(new CursorFigureLayout());

	updateStyle(styleProvider);

	final Triangle topTriangle = new Triangle();
	topTriangle.setSize(TRIANGLE_SIZE, TRIANGLE_SIZE);
	topTriangle.setOpaque(true);
	topTriangle.setDirection(PositionConstants.RIGHT);
	add(topTriangle, BorderLayout.TOP);

	final Triangle bottomTriangle = new Triangle();
	bottomTriangle.setSize(TRIANGLE_SIZE, TRIANGLE_SIZE);
	topTriangle.setOpaque(true);
	bottomTriangle.setDirection(PositionConstants.LEFT);
	add(bottomTriangle, BorderLayout.BOTTOM);

	fLineFigure = new RectangleFigure();
	fLineFigure.setLineWidth(1);
	add(fLineFigure, BorderLayout.CENTER);

	new CursorMover(this);
}
 
Example #3
Source File: DropDownMenuEventFigure.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void paintElements() {
	
	if (figureList != null) {
		for(List<IFigure> eventLists : figureList){
			Point parentTopLeft = parent.getBounds().getTopLeft();
			for(IFigure f : eventLists){
				f.setSize(new Dimension(20,20));
				f.setLocation(new Point(parentTopLeft.x +f.getSize().width*eventLists.indexOf(f),parentTopLeft.y+20*(figureList.indexOf(eventLists)+2)));
				f.setVisible(false);
				subMenuFigure.add(f);
				if(!(f instanceof RectangleFigure)){
					addElementsToShow(f);
				}
			
			}
			if(figureList.indexOf(eventLists) != figureList.size()-1){
				Polyline lineSeparator = new Polyline();
				lineSeparator.addPoint(new Point(parentTopLeft.x ,parentTopLeft.y+20+20*(figureList.indexOf(eventLists)+2)));
				lineSeparator.addPoint(new Point(parentTopLeft.x + 80,parentTopLeft.y+20+20*(figureList.indexOf(eventLists)+2)));
				lineSeparator.setAlpha(80);
				lineSeparator.setVisible(false);
				subMenuFigure.add(lineSeparator);
				addElementsToShow(lineSeparator);
			}
		}
	}
	isPaint = true ;
}
 
Example #4
Source File: MenuEventFigure.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public void paintElements() {
    final RoundedRectangle background = new RoundedRectangle();
    background.setAlpha(50);
    background.setBackgroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GRAY));
    background.setSize(new Dimension(4*20,figureList.size()*20));
    background.setLocation(new Point(parent.getBounds().getTopLeft().x,parent.getBounds().getTopLeft().y+40));
    background.setVisible(false);
    parent.add(background);
    addElementsToShow(background);
    if (figureList != null) {
        for(final List<IFigure> eventLists : figureList){
            for(final IFigure f : eventLists){
                f.setSize(new Dimension(20,20));
                f.setLocation(new Point(parent.getBounds().getTopLeft().x +f.getSize().width*eventLists.indexOf(f),parent.getBounds().getTopLeft().y+20*(figureList.indexOf(eventLists)+2)));
                f.setVisible(false);
                background.add(f);
                if(!(f instanceof RectangleFigure)){
                    addElementsToShow(f);
                }

            }
            if(figureList.indexOf(eventLists) != figureList.size()-1){
                final Polyline lineSeparator = new Polyline();
                lineSeparator.addPoint(new Point(parent.getBounds().getTopLeft().x ,parent.getBounds().getTopLeft().y+20+20*(figureList.indexOf(eventLists)+2)));
                lineSeparator.addPoint(new Point(parent.getBounds().getTopLeft().x + 80,parent.getBounds().getTopLeft().y+20+20*(figureList.indexOf(eventLists)+2)));
                lineSeparator.setAlpha(80);
                lineSeparator.setVisible(false);
                background.add(lineSeparator);
                addElementsToShow(lineSeparator);
            }
        }
    }
}
 
Example #5
Source File: RegionFigure.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
private void createContents() {
	nameLabel = new SyntaxColoringLabel();
	GridData data = GridDataFactory.fillDefaults().grab(true, false).getData();
	data.horizontalIndent = 5;
	nameLabel.setTextPlacement(PositionConstants.WEST);
	this.add(nameLabel, data);

	/** Compartment container **/
	compartmentPane = new RectangleFigure();
	compartmentPane.setOutline(false);
	compartmentPane.setLayoutManager(new StackLayout());
	compartmentPane.setFill(false);
	this.add(compartmentPane, GridDataFactory.fillDefaults().grab(true, true).getData());
}
 
Example #6
Source File: CustomLaneEditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
private void createContents() {
    final RectangleFigure laneNameContainerFigure0 = new RectangleFigure();

    laneNameContainerFigure0.setOutline(false);
    laneNameContainerFigure0.setFill(false);

    GridData constraintLaneNameContainerFigure0 = new GridData();
    constraintLaneNameContainerFigure0.verticalAlignment = GridData.FILL;
    constraintLaneNameContainerFigure0.horizontalAlignment = GridData.FILL;
    constraintLaneNameContainerFigure0.grabExcessHorizontalSpace = false;
    constraintLaneNameContainerFigure0.grabExcessVerticalSpace = true;

    this.add(laneNameContainerFigure0, constraintLaneNameContainerFigure0);

    final GridLayout layoutPoolNameContainerFigure0 = new GridLayout();
    layoutPoolNameContainerFigure0.numColumns = 1;
    layoutPoolNameContainerFigure0.marginWidth = 0;
    layoutPoolNameContainerFigure0.marginHeight = 0;
    laneNameContainerFigure0.setLayoutManager(layoutPoolNameContainerFigure0);
    fFigureLaneNameFigure = new VerticalLabel();
    fFigureLaneNameFigure.setText(""); //$NON-NLS-1$

    constraintNameContainerFigure0 = new GridData();
    constraintNameContainerFigure0.verticalAlignment = GridData.FILL;
    constraintNameContainerFigure0.horizontalAlignment = GridData.FILL;
    constraintNameContainerFigure0.grabExcessHorizontalSpace = true;
    constraintNameContainerFigure0.grabExcessVerticalSpace = true;
    laneNameContainerFigure0.add(fFigureLaneNameFigure, constraintNameContainerFigure0);

    fFigureLaneContainerFigure = new RectangleFigure();
    fFigureLaneContainerFigure.setBorder(null);
    fFigureLaneContainerFigure.setOutline(false);
    fFigureLaneContainerFigure.setLineWidth(0);
    fFigureLaneContainerFigure.setFill(false);
    fFigureLaneContainerFigure.setXOR(false);// BUG : XOR=true cause error on export as image

    final GridData constraintFFigureLaneContainerFigure = new GridData();
    constraintFFigureLaneContainerFigure.verticalAlignment = GridData.FILL;
    constraintFFigureLaneContainerFigure.horizontalAlignment = GridData.FILL;
    constraintFFigureLaneContainerFigure.grabExcessHorizontalSpace = true;
    constraintFFigureLaneContainerFigure.grabExcessVerticalSpace = true;
    this.add(fFigureLaneContainerFigure,
            constraintFFigureLaneContainerFigure);

}
 
Example #7
Source File: PoolEditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @generated
 */
public RectangleFigure getFigurePoolContainerFigure() {
	return fFigurePoolContainerFigure;
}
 
Example #8
Source File: PoolEditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @generated
 */
private void createContents() {

	RectangleFigure poolNameContainerFigure0 = new RectangleFigure();

	GridData constraintPoolNameContainerFigure0 = new GridData();
	constraintPoolNameContainerFigure0.verticalAlignment = GridData.FILL;
	constraintPoolNameContainerFigure0.horizontalAlignment = GridData.BEGINNING;
	constraintPoolNameContainerFigure0.horizontalIndent = 0;
	constraintPoolNameContainerFigure0.horizontalSpan = 1;
	constraintPoolNameContainerFigure0.verticalSpan = 1;
	constraintPoolNameContainerFigure0.grabExcessHorizontalSpace = false;
	constraintPoolNameContainerFigure0.grabExcessVerticalSpace = true;
	constraintPoolNameContainerFigure0.widthHint = 20;
	constraintPoolNameContainerFigure0.heightHint = 0;
	this.add(poolNameContainerFigure0, constraintPoolNameContainerFigure0);

	GridLayout layoutPoolNameContainerFigure0 = new GridLayout();
	layoutPoolNameContainerFigure0.numColumns = 1;
	layoutPoolNameContainerFigure0.makeColumnsEqualWidth = true;
	layoutPoolNameContainerFigure0.horizontalSpacing = 0;
	layoutPoolNameContainerFigure0.verticalSpacing = 0;
	layoutPoolNameContainerFigure0.marginWidth = 0;
	layoutPoolNameContainerFigure0.marginHeight = 0;
	poolNameContainerFigure0.setLayoutManager(layoutPoolNameContainerFigure0);

	fFigurePoolNameFigure = new WrappingLabel();

	fFigurePoolNameFigure.setText("");

	GridData constraintFFigurePoolNameFigure = new GridData();
	constraintFFigurePoolNameFigure.verticalAlignment = GridData.FILL;
	constraintFFigurePoolNameFigure.horizontalAlignment = GridData.FILL;
	constraintFFigurePoolNameFigure.horizontalIndent = 2;
	constraintFFigurePoolNameFigure.horizontalSpan = 1;
	constraintFFigurePoolNameFigure.verticalSpan = 1;
	constraintFFigurePoolNameFigure.grabExcessHorizontalSpace = true;
	constraintFFigurePoolNameFigure.grabExcessVerticalSpace = true;
	poolNameContainerFigure0.add(fFigurePoolNameFigure, constraintFFigurePoolNameFigure);

	fFigurePoolContainerFigure = new RectangleFigure();

	GridData constraintFFigurePoolContainerFigure = new GridData();
	constraintFFigurePoolContainerFigure.verticalAlignment = GridData.FILL;
	constraintFFigurePoolContainerFigure.horizontalAlignment = GridData.FILL;
	constraintFFigurePoolContainerFigure.horizontalIndent = 0;
	constraintFFigurePoolContainerFigure.horizontalSpan = 1;
	constraintFFigurePoolContainerFigure.verticalSpan = 1;
	constraintFFigurePoolContainerFigure.grabExcessHorizontalSpace = true;
	constraintFFigurePoolContainerFigure.grabExcessVerticalSpace = true;
	this.add(fFigurePoolContainerFigure, constraintFFigurePoolContainerFigure);

}
 
Example #9
Source File: LaneEditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @generated
 */
public RectangleFigure getFigureLaneContainerFigure() {
	return fFigureLaneContainerFigure;
}
 
Example #10
Source File: LaneEditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @generated
 */
private void createContents() {

	RectangleFigure nameContainerFigure0 = new RectangleFigure();

	GridData constraintNameContainerFigure0 = new GridData();
	constraintNameContainerFigure0.verticalAlignment = GridData.FILL;
	constraintNameContainerFigure0.horizontalAlignment = GridData.BEGINNING;
	constraintNameContainerFigure0.horizontalIndent = 0;
	constraintNameContainerFigure0.horizontalSpan = 1;
	constraintNameContainerFigure0.verticalSpan = 1;
	constraintNameContainerFigure0.grabExcessHorizontalSpace = false;
	constraintNameContainerFigure0.grabExcessVerticalSpace = true;
	constraintNameContainerFigure0.widthHint = 20;
	constraintNameContainerFigure0.heightHint = 0;
	this.add(nameContainerFigure0, constraintNameContainerFigure0);

	GridLayout layoutNameContainerFigure0 = new GridLayout();
	layoutNameContainerFigure0.numColumns = 1;
	layoutNameContainerFigure0.makeColumnsEqualWidth = true;
	layoutNameContainerFigure0.horizontalSpacing = 0;
	layoutNameContainerFigure0.verticalSpacing = 0;
	layoutNameContainerFigure0.marginWidth = 0;
	layoutNameContainerFigure0.marginHeight = 0;
	nameContainerFigure0.setLayoutManager(layoutNameContainerFigure0);

	fFigureLaneNameFigure = new WrappingLabel();

	fFigureLaneNameFigure.setText("");

	GridData constraintFFigureLaneNameFigure = new GridData();
	constraintFFigureLaneNameFigure.verticalAlignment = GridData.FILL;
	constraintFFigureLaneNameFigure.horizontalAlignment = GridData.FILL;
	constraintFFigureLaneNameFigure.horizontalIndent = 2;
	constraintFFigureLaneNameFigure.horizontalSpan = 1;
	constraintFFigureLaneNameFigure.verticalSpan = 1;
	constraintFFigureLaneNameFigure.grabExcessHorizontalSpace = true;
	constraintFFigureLaneNameFigure.grabExcessVerticalSpace = true;
	nameContainerFigure0.add(fFigureLaneNameFigure, constraintFFigureLaneNameFigure);

	fFigureLaneContainerFigure = new RectangleFigure();

	GridData constraintFFigureLaneContainerFigure = new GridData();
	constraintFFigureLaneContainerFigure.verticalAlignment = GridData.FILL;
	constraintFFigureLaneContainerFigure.horizontalAlignment = GridData.FILL;
	constraintFFigureLaneContainerFigure.horizontalIndent = 0;
	constraintFFigureLaneContainerFigure.horizontalSpan = 1;
	constraintFFigureLaneContainerFigure.verticalSpan = 1;
	constraintFFigureLaneContainerFigure.grabExcessHorizontalSpace = true;
	constraintFFigureLaneContainerFigure.grabExcessVerticalSpace = true;
	this.add(fFigureLaneContainerFigure, constraintFFigureLaneContainerFigure);

}
 
Example #11
Source File: CustomPoolEditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @generated
 */
@Override
public RectangleFigure getFigurePoolContainerFigure() {
    return fFigurePoolContainerFigure;
}
 
Example #12
Source File: CustomPoolEditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @generated
 */
private void createContents() {

    final RectangleFigure poolNameContainerFigure0 = new RectangleFigure();

    poolNameContainerFigure0.setOutline(true);
    poolNameContainerFigure0.setFill(false);

    constraintPoolNameContainerFigure0 = new GridData();
    constraintPoolNameContainerFigure0.verticalAlignment = GridData.FILL;
    constraintPoolNameContainerFigure0.horizontalAlignment = GridData.FILL;
    constraintPoolNameContainerFigure0.grabExcessHorizontalSpace = false;
    constraintPoolNameContainerFigure0.grabExcessVerticalSpace = true;

    this.add(poolNameContainerFigure0, constraintPoolNameContainerFigure0);

    final GridLayout layoutPoolNameContainerFigure0 = new GridLayout();
    layoutPoolNameContainerFigure0.numColumns = 1;
    layoutPoolNameContainerFigure0.marginWidth = 0;
    layoutPoolNameContainerFigure0.marginHeight = 0;
    poolNameContainerFigure0.setLayoutManager(layoutPoolNameContainerFigure0);

    fFigurePoolNameFigure = new VerticalLabel();
    fFigurePoolNameFigure.setText(""); //$NON-NLS-1$

    final GridData constraintFFigurePoolNameFigure = new GridData();
    constraintFFigurePoolNameFigure.verticalAlignment = GridData.FILL;
    constraintFFigurePoolNameFigure.horizontalAlignment = GridData.FILL;
    constraintFFigurePoolNameFigure.grabExcessHorizontalSpace = true;
    constraintFFigurePoolNameFigure.grabExcessVerticalSpace = true;
    poolNameContainerFigure0.add(fFigurePoolNameFigure, constraintFFigurePoolNameFigure);

    fFigurePoolContainerFigure = new RectangleFigure();
    fFigurePoolContainerFigure.setOutline(true);

    final GridData constraintFFigurePoolContainerFigure = new GridData();
    constraintFFigurePoolContainerFigure.verticalAlignment = GridData.FILL;
    constraintFFigurePoolContainerFigure.horizontalAlignment = GridData.FILL;
    constraintFFigurePoolContainerFigure.grabExcessHorizontalSpace = true;
    constraintFFigurePoolContainerFigure.grabExcessVerticalSpace = true;
    this.add(fFigurePoolContainerFigure, constraintFFigurePoolContainerFigure);
}
 
Example #13
Source File: CustomLaneEditPart.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public RectangleFigure getFigureLaneContainerFigure() {
    return fFigureLaneContainerFigure;
}
 
Example #14
Source File: RegionFigure.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
public RectangleFigure getCompartmentPane() {
	return compartmentPane;
}
 
Example #15
Source File: LanguageEditPart.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @generated
 */
public RectangleFigure getLanguageParametersCompartmentFigure() {
	return fLanguageParametersCompartmentFigure;
}
 
Example #16
Source File: LanguageEditPart.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @generated
 */
private void createContents() {

	fFigureLanguageLabelFigure = new WrappingLabel();

	fFigureLanguageLabelFigure.setText("Language");
	fFigureLanguageLabelFigure
			.setMaximumSize(new Dimension(getMapMode().DPtoLP(10000), getMapMode().DPtoLP(50)));

	this.add(fFigureLanguageLabelFigure);

	fLanguageParametersCompartmentFigure = new RectangleFigure();

	fLanguageParametersCompartmentFigure.setOutline(false);

	this.add(fLanguageParametersCompartmentFigure);
	fLanguageParametersCompartmentFigure.setLayoutManager(new StackLayout());

}
 
Example #17
Source File: TypeEditPart.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @generated
 */
public RectangleFigure getTypeFieldsCompartmentFigure() {
	return fTypeFieldsCompartmentFigure;
}
 
Example #18
Source File: TypeEditPart.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @generated
 */
private void createContents() {

	fFigureTypeLabelFigure = new WrappingLabel();

	fFigureTypeLabelFigure.setText("Type");
	fFigureTypeLabelFigure.setMaximumSize(new Dimension(getMapMode().DPtoLP(10000), getMapMode().DPtoLP(50)));

	this.add(fFigureTypeLabelFigure);

	fTypeFieldsCompartmentFigure = new RectangleFigure();

	fTypeFieldsCompartmentFigure.setOutline(false);

	this.add(fTypeFieldsCompartmentFigure);
	fTypeFieldsCompartmentFigure.setLayoutManager(new StackLayout());

}
 
Example #19
Source File: ScriptedTaskEditPart.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
/**
* @generated
*/
public RectangleFigure getScriptedTaskOutputVariablesCompartmentFigure() {
	return fScriptedTaskOutputVariablesCompartmentFigure;
}
 
Example #20
Source File: ScriptedTaskEditPart.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @generated
 */
private void createContents() {

	fFigureScriptedTaskLabelFigure = new WrappingLabel();

	fFigureScriptedTaskLabelFigure.setText("ScriptedTask");
	fFigureScriptedTaskLabelFigure
			.setMaximumSize(new Dimension(getMapMode().DPtoLP(10000), getMapMode().DPtoLP(50)));

	this.add(fFigureScriptedTaskLabelFigure);

	fScriptedTaskOutputVariablesCompartmentFigure = new RectangleFigure();

	fScriptedTaskOutputVariablesCompartmentFigure.setOutline(false);

	this.add(fScriptedTaskOutputVariablesCompartmentFigure);

}