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);
  }
 /** 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);
   }
 }
 /** 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);
   }
 }
  /** 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);
  }
 protected void setLineWidth() {
   setLineWidth(fDiagramModelConnection.getLineWidth());
 }
 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());
 }