Java Code Examples for org.eclipse.draw2d.IFigure#setVisible()

The following examples show how to use org.eclipse.draw2d.IFigure#setVisible() . 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: IntermediateErrorCatchEvent5EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 2
Source File: BoundarySignalEvent2EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 3
Source File: NonInterruptingBoundaryTimerEvent2EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 4
Source File: BoundaryMessageEvent2EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 5
Source File: BoundaryMessageEventEditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 6
Source File: NonInterruptingBoundaryTimerEventEditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 7
Source File: BoundaryTimerEventEditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 8
Source File: BoundaryTimerEvent2EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 9
Source File: IntermediateErrorCatchEvent3EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 10
Source File: IntermediateErrorCatchEventEditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 11
Source File: CellFigure.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Updates the CellFigure based on the provided Cell state.
 * 
 * @param state
 *            The State of the model Cell (unselected, selected, disabled,
 *            or invalid).
 */
public void setState(State state) {
	IFigure figure = getFigure();

	// Modify the Figure's color or visibility based on the Cell's state.
	if (state == State.SELECTED) {
		figure.setBackgroundColor(selectedColor);
	} else if (state == State.DISABLED) {
		figure.setBackgroundColor(disabledColor);
	} else if (state == State.INVALID) {
		figure.setVisible(false);
	} else {
		figure.setBackgroundColor(unselectedColor);
	}

	return;
}
 
Example 12
Source File: BoundarySignalEventEditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 13
Source File: IntermediateErrorCatchEvent6EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public EditPolicy getPrimaryDragEditPolicy() {
	return new BorderItemSelectionEditPolicy() {
		@Override
		protected void showPrimarySelection() {
			super.showPrimarySelection();
			hideSelection();
			IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
			layer.setBackgroundColor(ColorConstants.black);
			layer.setVisible(true);
			for (Object f : layer.getChildren()) {
				((IFigure) f).setBackgroundColor(ColorConstants.black);
				((IFigure) f).setVisible(true);
			}
		}

		@Override
		protected IFigure createDragSourceFeedbackFigure() {
			IFigure r = FiguresHelper.getSelectedFigure(resolveSemanticElement().eClass(), -1, -1, null, null);
			addFeedback(r);
			return r;
		}
	};
}
 
Example 14
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 15
Source File: DropDownMenuFigure.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public void paintElements(){
	if (elements != null) {
		for(Pair<IFigure, MouseListener> pair : elements){
			IFigure elem = pair.getFirst();
			if (elem != null && !(elem instanceof Polyline)) {
				elem.setSize(new Dimension(20,20));
				elem.setLocation(new Point(location.x +elem.getSize().width*elements.indexOf(pair),location.y+20/*+elem.getSize().height*elements.indexOf(elem)*/));
				elem.setVisible(false);
				layer.add(elem);
				addElementsToShow(elem);
			}
		}
	}
}
 
Example 16
Source File: DropDownMenuFigure.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void setVisible(boolean visible) {
	super.setVisible(visible);
	if(!visible){
		for(IFigure f : getAllFigures()){
			f.setVisible(visible);
		}
	}
}
 
Example 17
Source File: DropDownMenuFigure.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void addElements() {
	if(!isPaint){
		paintElements();
	}
	for(IFigure elem : getAllFigures()){
		elem.setVisible(true);
	}
	for (Pair<IFigure, MouseListener> pair : elements) {
		if(allElements.contains(pair.getFirst())){
			if(pair.getSecond() != null){
				pair.getFirst().addMouseListener(pair.getSecond());
			}
		}
	}
}
 
Example 18
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 19
Source File: MenuEventFigure.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public void hide(){
    parent.setVisible(false);
    for(final IFigure elem : allElements){
        elem.setVisible(false);
    }
}
 
Example 20
Source File: MenuEventFigure.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public void show(){
    parent.setVisible(true);
    for(final IFigure elem : allElements){
        elem.setVisible(true);
    }
}