Java Code Examples for org.eclipse.gef.editparts.LayerManager#getLayer()
The following examples show how to use
org.eclipse.gef.editparts.LayerManager#getLayer() .
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: TableViewGraphicalNodeEditPolicy.java From ermasterr with Apache License 2.0 | 6 votes |
@Override public void eraseTargetFeedback(final Request request) { final LayerManager manager = (LayerManager) getHost().getRoot(); final IFigure layer = manager.getLayer(LayerConstants.PRIMARY_LAYER); getFeedbackLayer().setBounds(layer.getBounds()); final List list = getFeedbackLayer().getChildren(); for (final Iterator iter = list.iterator(); iter.hasNext();) { final Object obj = iter.next(); if (obj instanceof Label) { iter.remove(); } } getFeedbackLayer().repaint(); super.eraseTargetFeedback(request); }
Example 2
Source File: TableViewGraphicalNodeEditPolicy.java From erflute with Apache License 2.0 | 6 votes |
@Override public void eraseTargetFeedback(Request request) { final LayerManager manager = (LayerManager) getHost().getRoot(); final IFigure layer = manager.getLayer(LayerConstants.PRIMARY_LAYER); getFeedbackLayer().setBounds(layer.getBounds()); final List<?> list = getFeedbackLayer().getChildren(); for (final Iterator<?> iter = list.iterator(); iter.hasNext();) { final Object obj = iter.next(); if (obj instanceof Label) { iter.remove(); } } getFeedbackLayer().repaint(); super.eraseTargetFeedback(request); }
Example 3
Source File: TableViewGraphicalNodeEditPolicy.java From ermaster-b with Apache License 2.0 | 6 votes |
@Override public void eraseTargetFeedback(Request request) { LayerManager manager = (LayerManager) this.getHost().getRoot(); IFigure layer = manager.getLayer(LayerConstants.PRIMARY_LAYER); this.getFeedbackLayer().setBounds(layer.getBounds()); List list = this.getFeedbackLayer().getChildren(); for (Iterator iter = list.iterator(); iter.hasNext();) { Object obj = iter.next(); if (obj instanceof Label) { iter.remove(); } } this.getFeedbackLayer().repaint(); super.eraseTargetFeedback(request); }
Example 4
Source File: ReportPrintGraphicalViewerOperation.java From birt with Eclipse Public License 1.0 | 5 votes |
public ReportPrintGraphicalViewerOperation( GraphicalViewer g, Drawable drawable, Device device, Rectangle region ) { this.device = device; this.region = region; this.drawable = drawable; this.viewer = g; LayerManager lm = (LayerManager) viewer.getEditPartRegistry( ) .get( LayerManager.ID ); IFigure f = lm.getLayer( LayerConstants.PRINTABLE_LAYERS ); this.printSource = f; }
Example 5
Source File: EditorRulerEditPart.java From birt with Eclipse Public License 1.0 | 5 votes |
public IFigure getGuideLayer( ) { LayerManager lm = (LayerManager) diagramViewer.getEditPartRegistry( ) .get( LayerManager.ID ); if ( lm != null ) return lm.getLayer( LayerConstants.GUIDE_LAYER ); return null; }
Example 6
Source File: ReportElementEditPart.java From birt with Eclipse Public License 1.0 | 5 votes |
private IFigure getHandleLayer( ) { super.getLayer( LayerConstants.HANDLE_LAYER ); LayerManager manager = (LayerManager) getViewer( ).getEditPartRegistry( ) .get( LayerManager.ID ); return manager.getLayer( LayerConstants.HANDLE_LAYER ); }
Example 7
Source File: RelationBendpointEditPolicy.java From ermasterr with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override protected void showMoveBendpointFeedback(final BendpointRequest bendpointrequest) { final Relation relation = (Relation) getHost().getModel(); final RelationEditPart editPart = (RelationEditPart) getHost(); if (relation.getSource() == relation.getTarget()) { if (bendpointrequest.getIndex() != 1) { return; } final Point point = bendpointrequest.getLocation(); getConnection().translateToRelative(point); final Bendpoint rate = getRate(point); rate.setRelative(true); final float rateX = (100f - (rate.getX() / 2)) / 100; final float rateY = (100f - (rate.getY() / 2)) / 100; final ERTableEditPart tableEditPart = (ERTableEditPart) editPart.getSource(); final Rectangle bounds = tableEditPart.getFigure().getBounds(); final Rectangle rect = new Rectangle(); rect.x = (int) (bounds.x + (bounds.width * rateX)); rect.y = (int) (bounds.y + (bounds.height * rateY)); rect.width = bounds.width * rate.getX() / 100; rect.height = bounds.height * rate.getY() / 100; relation.setSourceLocationp(100, (int) (100 * rateY)); relation.setTargetLocationp((int) (100 * rateX), 100); final LayerManager manager = (LayerManager) tableEditPart.getRoot(); final IFigure layer = manager.getLayer(LayerConstants.PRIMARY_LAYER); getFeedbackLayer().setBounds(layer.getBounds()); final List children = getFeedbackLayer().getChildren(); children.clear(); getFeedbackLayer().repaint(); final ZoomManager zoomManager = ((ScalableFreeformRootEditPart) getHost().getRoot()).getZoomManager(); final double zoom = zoomManager.getZoom(); final Polyline feedbackFigure = new Polyline(); feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) (rect.y * zoom))); feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) ((rect.y + rect.height) * zoom))); feedbackFigure.addPoint(new Point((int) ((rect.x + rect.width) * zoom), (int) ((rect.y + rect.height) * zoom))); feedbackFigure.addPoint(new Point((int) ((rect.x + rect.width) * zoom), (int) (rect.y * zoom))); feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) (rect.y * zoom))); feedbackFigure.setLineStyle(SWT.LINE_DASH); feedbackFigure.translateToRelative(feedbackFigure.getLocation()); addFeedback(feedbackFigure); } else { super.showMoveBendpointFeedback(bendpointrequest); } }
Example 8
Source File: RelationBendpointEditPolicy.java From erflute with Apache License 2.0 | 4 votes |
@Override protected void showMoveBendpointFeedback(BendpointRequest bendpointrequest) { final Relationship relation = (Relationship) getHost().getModel(); final RelationEditPart editPart = (RelationEditPart) getHost(); if (relation.getSourceWalker() == relation.getTargetWalker()) { if (bendpointrequest.getIndex() != 1) { return; } final Point point = bendpointrequest.getLocation(); getConnection().translateToRelative(point); final Bendpoint rate = getRate(point); rate.setRelative(true); final float rateX = (100f - (rate.getX() / 2)) / 100; final float rateY = (100f - (rate.getY() / 2)) / 100; final ERTableEditPart tableEditPart = (ERTableEditPart) editPart.getSource(); final Rectangle bounds = tableEditPart.getFigure().getBounds(); final Rectangle rect = new Rectangle(); rect.x = (int) (bounds.x + (bounds.width * rateX)); rect.y = (int) (bounds.y + (bounds.height * rateY)); rect.width = (int) (bounds.width * rate.getX() / 100); rect.height = (int) (bounds.height * rate.getY() / 100); relation.setSourceLocationp(100, (int) (100 * rateY)); relation.setTargetLocationp((int) (100 * rateX), 100); final LayerManager manager = (LayerManager) tableEditPart.getRoot(); final IFigure layer = manager.getLayer(LayerConstants.PRIMARY_LAYER); getFeedbackLayer().setBounds(layer.getBounds()); final List<?> children = getFeedbackLayer().getChildren(); children.clear(); getFeedbackLayer().repaint(); final ZoomManager zoomManager = ((ScalableFreeformRootEditPart) getHost().getRoot()).getZoomManager(); final double zoom = zoomManager.getZoom(); final Polyline feedbackFigure = new Polyline(); feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) (rect.y * zoom))); feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) ((rect.y + rect.height) * zoom))); feedbackFigure.addPoint(new Point((int) ((rect.x + rect.width) * zoom), (int) ((rect.y + rect.height) * zoom))); feedbackFigure.addPoint(new Point((int) ((rect.x + rect.width) * zoom), (int) (rect.y * zoom))); feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) (rect.y * zoom))); feedbackFigure.setLineStyle(SWT.LINE_DASH); feedbackFigure.translateToRelative(feedbackFigure.getLocation()); addFeedback(feedbackFigure); } else { super.showMoveBendpointFeedback(bendpointrequest); } }
Example 9
Source File: RelationBendpointEditPolicy.java From ermaster-b with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override protected void showMoveBendpointFeedback(BendpointRequest bendpointrequest) { Relation relation = (Relation) getHost().getModel(); RelationEditPart editPart = (RelationEditPart) this.getHost(); if (relation.getSource() == relation.getTarget()) { if (bendpointrequest.getIndex() != 1) { return; } Point point = bendpointrequest.getLocation(); this.getConnection().translateToRelative(point); Bendpoint rate = this.getRate(point); rate.setRelative(true); float rateX = (100f - (rate.getX() / 2)) / 100; float rateY = (100f - (rate.getY() / 2)) / 100; ERTableEditPart tableEditPart = (ERTableEditPart) editPart .getSource(); Rectangle bounds = tableEditPart.getFigure().getBounds(); Rectangle rect = new Rectangle(); rect.x = (int) (bounds.x + (bounds.width * rateX)); rect.y = (int) (bounds.y + (bounds.height * rateY)); rect.width = (int) (bounds.width * rate.getX() / 100); rect.height = (int) (bounds.height * rate.getY() / 100); relation.setSourceLocationp(100, (int) (100 * rateY)); relation.setTargetLocationp((int) (100 * rateX), 100); LayerManager manager = (LayerManager) tableEditPart.getRoot(); IFigure layer = manager.getLayer(LayerConstants.PRIMARY_LAYER); this.getFeedbackLayer().setBounds(layer.getBounds()); List children = this.getFeedbackLayer().getChildren(); children.clear(); this.getFeedbackLayer().repaint(); ZoomManager zoomManager = ((ScalableFreeformRootEditPart) this .getHost().getRoot()).getZoomManager(); double zoom = zoomManager.getZoom(); Polyline feedbackFigure = new Polyline(); feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) (rect.y * zoom))); feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) ((rect.y + rect.height) * zoom))); feedbackFigure.addPoint(new Point( (int) ((rect.x + rect.width) * zoom), (int) ((rect.y + rect.height) * zoom))); feedbackFigure .addPoint(new Point((int) ((rect.x + rect.width) * zoom), (int) (rect.y * zoom))); feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) (rect.y * zoom))); feedbackFigure.setLineStyle(SWT.LINE_DASH); feedbackFigure.translateToRelative(feedbackFigure.getLocation()); this.addFeedback(feedbackFigure); } else { super.showMoveBendpointFeedback(bendpointrequest); } }