org.eclipse.draw2d.Polyline Java Examples
The following examples show how to use
org.eclipse.draw2d.Polyline.
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: LinkFigure.java From nebula with Eclipse Public License 2.0 | 5 votes |
public LinkFigure(IFigure parent) { leftLine = new Polyline(); leftLine.setAntialias(SWT.ON); rightLine = new Polyline(); rightLine.setAntialias(SWT.ON); parent.add(leftLine); parent.add(rightLine); this.parent = parent; }
Example #2
Source File: TableLayout.java From ermasterr with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private void addVerticalSeparator(final IFigure figure, final Rectangle rect) { final Polyline separator = new Polyline(); separator.setLineWidth(separatorWidth); separator.addPoint(new Point(rect.x, rect.y)); separator.addPoint(new Point(rect.x, rect.y + rect.height)); figure.getChildren().add(separator); separator.setParent(figure); separators.add(separator); }
Example #3
Source File: TableLayout.java From ermasterr with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private void addHorizontalSeparator(final IFigure figure, final Rectangle rect) { final Polyline separator = new Polyline(); separator.setLineWidth(separatorWidth); separator.addPoint(new Point(rect.x, rect.y)); separator.addPoint(new Point(rect.x + rect.width, rect.y)); figure.getChildren().add(separator); separator.setParent(figure); separators.add(separator); }
Example #4
Source File: TableLayout.java From erflute with Apache License 2.0 | 5 votes |
private List<IFigure> getChildren(IFigure parent) { final List<IFigure> children = new ArrayList<>(); for (@SuppressWarnings("unchecked") final Iterator<Polyline> iter = parent.getChildren().iterator(); iter.hasNext();) { final IFigure child = iter.next(); if (!separators.contains(child)) { children.add(child); } } return children; }
Example #5
Source File: TableLayout.java From erflute with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private List<IFigure> clearSeparator(IFigure parent) { for (final Iterator<Polyline> iter = parent.getChildren().iterator(); iter.hasNext();) { final IFigure child = iter.next(); if (separators.contains(child)) { iter.remove(); } } separators.clear(); return parent.getChildren(); }
Example #6
Source File: TableLayout.java From erflute with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private void addVerticalSeparator(IFigure figure, Rectangle rect) { final Polyline separator = new Polyline(); separator.setLineWidth(separatorWidth); separator.addPoint(new Point(rect.x, rect.y)); separator.addPoint(new Point(rect.x, rect.y + rect.height)); figure.getChildren().add(separator); separator.setParent(figure); separators.add(separator); }
Example #7
Source File: TableLayout.java From erflute with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private void addHorizontalSeparator(IFigure figure, Rectangle rect) { final Polyline separator = new Polyline(); separator.setLineWidth(separatorWidth); separator.addPoint(new Point(rect.x, rect.y)); separator.addPoint(new Point(rect.x + rect.width, rect.y)); figure.getChildren().add(separator); separator.setParent(figure); separators.add(separator); }
Example #8
Source File: ReportFlowLayoutEditPolicy.java From birt with Eclipse Public License 1.0 | 5 votes |
protected void setTargetFeedbackPoints( Point p1, Point p2 ) { Transposer transposer = new Transposer( ); transposer.setEnabled( !isHorizontal( ) ); Rectangle parentBox = transposer.t( getAbsoluteClientBounds( (GraphicalEditPart) getHost( ) ) ); Polyline fb = getLineFeedback( ); if ( p2.y >= parentBox.bottom( ) && parentBox.bottom( ) - p1.y < 10 ) { p2.y = p1.y; List list = ( (GraphicalEditPart) getHost( ) ).getChildren( ); int size = list.size( ); if ( size == 0 ) { p2.x = p1.x + Math.min( 30, parentBox.width ); } else { GraphicalEditPart last = (GraphicalEditPart) list.get( size - 1 ); Rectangle rect = getAbsoluteBounds( last ); p2.x = p1.x + Math.min( rect.width - 8, parentBox.width ); } } else if ( p2.y >= parentBox.bottom( ) ) { p2.y = parentBox.bottom( ); } fb.translateToRelative( p1 ); fb.translateToRelative( p2 ); fb.setPoint( p1, 0 ); fb.setPoint( p2, 1 ); }
Example #9
Source File: MenuEventFigure.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
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 #10
Source File: DropDownMenuFigure.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
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 #11
Source File: DropDownMenuEventFigure.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@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 #12
Source File: TableLayout.java From ermaster-b with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private void addVerticalSeparator(IFigure figure, Rectangle rect) { Polyline separator = new Polyline(); separator.setLineWidth(separatorWidth); separator.addPoint(new Point(rect.x, rect.y)); separator.addPoint(new Point(rect.x, rect.y + rect.height)); figure.getChildren().add(separator); separator.setParent(figure); this.separators.add(separator); }
Example #13
Source File: TableLayout.java From ermaster-b with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private void addHorizontalSeparator(IFigure figure, Rectangle rect) { Polyline separator = new Polyline(); separator.setLineWidth(separatorWidth); separator.addPoint(new Point(rect.x, rect.y)); separator.addPoint(new Point(rect.x + rect.width, rect.y)); figure.getChildren().add(separator); separator.setParent(figure); this.separators.add(separator); }
Example #14
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 #15
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 #16
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); } }