コード例 #1
0
  public void refreshVisuals() {
    // If the text position has been changed by user update it
    if (fDiagramModelConnection.getTextPosition() != fTextPosition) {
      fTextPosition = fDiagramModelConnection.getTextPosition();
      setLabelLocator(fTextPosition);
    }

    setLabelFont();

    setLabelFontColor();

    setLineColor();

    setConnectionText();

    setLineWidth();

    // Set Enabled according to current Viewpoint
    boolean enabled = ViewpointsManager.INSTANCE.isAllowedType(getModelConnection());
    setEnabled(enabled);
    if (getSourceDecoration() != null) {
      getSourceDecoration().setEnabled(enabled);
    }
    if (getTargetDecoration() != null) {
      getTargetDecoration().setEnabled(enabled);
    }
    getConnectionLabel().setEnabled(enabled);
  }
コード例 #2
0
 /** Set the line color to that in the model, or failing that, as per default */
 protected void setLineColor() {
   String val = fDiagramModelConnection.getLineColor();
   Color c = ColorFactory.get(val);
   if (c != fLineColor) {
     fLineColor = c;
     setForegroundColor(c);
   }
 }
コード例 #3
0
 /** Set the font color to that in the model, or failing that, as per default */
 protected void setLabelFontColor() {
   String val = fDiagramModelConnection.getFontColor();
   Color c = ColorFactory.get(val);
   if (c == null) {
     c = ColorConstants.black; // have to set default color otherwise it inherits line color
   }
   if (c != fFontColor) {
     fFontColor = c;
     getConnectionLabel().setForegroundColor(c);
   }
 }
コード例 #4
0
  /** Set the font in the label to that in the model, or failing that, as per user's default */
  protected void setLabelFont() {
    String fontName = fDiagramModelConnection.getFont();
    Font font = FontFactory.get(fontName);

    // Adjust for Windows DPI
    if (PlatformUtils.isWindows()) {
      font = FontFactory.getAdjustedWindowsFont(font);
    }

    getConnectionLabel().setFont(font);
  }
コード例 #5
0
 protected void setLineWidth() {
   setLineWidth(fDiagramModelConnection.getLineWidth());
 }
コード例 #6
0
 protected void setConnectionText() {
   getConnectionLabel().setText(fDiagramModelConnection.getName());
 }
コード例 #7
0
 @Override
 public boolean isConnectionVisible(EditPart editPart, IDiagramModelConnection connection) {
   // This ensures that there are no dangling connections if this filter has removed an editpart
   return isChildElementVisible(editPart, connection.getSource())
       && isChildElementVisible(editPart, connection.getTarget());
 }