コード例 #1
0
 private void addEdgeWidthControl(final List<IPropertyControl> controls) {
   mSetEdgeWidth = new BooleanProperty(StyleEditorPanel.SET_RESOURCE);
   controls.add(mSetEdgeWidth);
   mEdgeWidth = new NumberProperty(StyleEditorPanel.EDGE_WIDTH, 0, 100, 1);
   controls.add(mEdgeWidth);
   final EdgeWidthChangeListener listener = new EdgeWidthChangeListener(mSetEdgeWidth, mEdgeWidth);
   mSetEdgeWidth.addPropertyChangeListener(listener);
   mEdgeWidth.addPropertyChangeListener(listener);
   mEdgeWidth.fireOnMouseClick();
 }
コード例 #2
0
 private void addMinNodeWidthControl(final List<IPropertyControl> controls) {
   mSetMinNodeWidth = new BooleanProperty(StyleEditorPanel.SET_RESOURCE);
   controls.add(mSetMinNodeWidth);
   mMinNodeWidth = new NumberProperty(StyleEditorPanel.MIN_NODE_WIDTH, 1, Integer.MAX_VALUE, 1);
   controls.add(mMinNodeWidth);
   final MinNodeWidthChangeListener listener =
       new MinNodeWidthChangeListener(mSetMinNodeWidth, mMinNodeWidth);
   mSetMinNodeWidth.addPropertyChangeListener(listener);
   mMinNodeWidth.addPropertyChangeListener(listener);
   mMinNodeWidth.fireOnMouseClick();
 }
コード例 #3
0
  public void setStyle(final NodeModel node) {
    if (internalChange) {
      return;
    }
    internalChange = true;
    try {
      final LogicalStyleController logicalStyleController = LogicalStyleController.getController();
      if (addStyleBox) {
        final boolean isStyleSet = LogicalStyleModel.getStyle(node) != null;
        mSetStyle.setValue(isStyleSet);
        setStyleList(mMapStyleButton, logicalStyleController.getMapStyleNames(node, "\n"));
      }
      setStyleList(mNodeStyleButton, logicalStyleController.getNodeStyleNames(node, "\n"));
      final NodeStyleController styleController = NodeStyleController.getController();
      {
        final Color nodeColor = NodeStyleModel.getColor(node);
        final Color viewNodeColor = styleController.getColor(node);
        mSetNodeColor.setValue(nodeColor != null);
        mNodeColor.setColorValue(viewNodeColor);
      }
      {
        final Color color = NodeStyleModel.getBackgroundColor(node);
        final Color viewColor = styleController.getBackgroundColor(node);
        mSetNodeBackgroundColor.setValue(color != null);
        mNodeBackgroundColor.setColorValue(
            viewColor != null
                ? viewColor
                : Controller.getCurrentController().getMapViewManager().getBackgroundColor(node));
      }
      {
        final String shape = NodeStyleModel.getShape(node);
        final String viewShape = styleController.getShape(node);
        mSetNodeShape.setValue(shape != null);
        mNodeShape.setValue(viewShape);
      }
      final NodeSizeModel nodeSizeModel = NodeSizeModel.getModel(node);
      {
        final int width =
            nodeSizeModel != null ? nodeSizeModel.getMaxNodeWidth() : NodeSizeModel.NOT_SET;
        final int viewWidth = styleController.getMaxWidth(node);
        mSetMaxNodeWidth.setValue(width != NodeSizeModel.NOT_SET);
        mMaxNodeWidth.setValue(Integer.toString(viewWidth));
      }
      {
        final int width =
            nodeSizeModel != null ? nodeSizeModel.getMinNodeWidth() : NodeSizeModel.NOT_SET;
        final int viewWidth = styleController.getMinWidth(node);
        mSetMinNodeWidth.setValue(width != NodeSizeModel.NOT_SET);
        mMinNodeWidth.setValue(Integer.toString(viewWidth));
      }
      final EdgeController edgeController = EdgeController.getController();
      final EdgeModel edgeModel = EdgeModel.getModel(node);
      {
        final Color edgeColor = edgeModel != null ? edgeModel.getColor() : null;
        final Color viewColor = edgeController.getColor(node);
        mSetEdgeColor.setValue(edgeColor != null);
        mEdgeColor.setColorValue(viewColor);
      }
      {
        final EdgeStyle style = edgeModel != null ? edgeModel.getStyle() : null;
        final EdgeStyle viewStyle = edgeController.getStyle(node);
        mSetEdgeStyle.setValue(style != null);
        mEdgeStyle.setValue(viewStyle.toString());
      }
      {
        final int width = edgeModel != null ? edgeModel.getWidth() : EdgeModel.DEFAULT_WIDTH;
        final int viewWidth = edgeController.getWidth(node);
        mSetEdgeWidth.setValue(width != EdgeModel.DEFAULT_WIDTH);
        mEdgeWidth.setValue(Integer.toString(viewWidth));
      }
      {
        final CloudController cloudController = CloudController.getController();
        final CloudModel cloudModel = CloudModel.getModel(node);
        final Color viewCloudColor = cloudController.getColor(node);
        mSetCloud.setValue(cloudModel != null);
        mCloudColor.setColorValue(viewCloudColor);

        final CloudModel.Shape viewCloudShape = cloudController.getShape(node);
        mCloudShape.setValue(
            viewCloudShape != null ? viewCloudShape.toString() : CloudModel.Shape.ARC.toString());
      }
      {
        final String fontFamilyName = NodeStyleModel.getFontFamilyName(node);
        final String viewFontFamilyName = styleController.getFontFamilyName(node);
        mSetNodeFontName.setValue(fontFamilyName != null);
        mNodeFontName.setValue(viewFontFamilyName);
      }
      {
        final Integer fontSize = NodeStyleModel.getFontSize(node);
        final Integer viewfontSize = styleController.getFontSize(node);
        mSetNodeFontSize.setValue(fontSize != null);
        mNodeFontSize.setValue(viewfontSize.toString());
      }
      {
        final Boolean bold = NodeStyleModel.isBold(node);
        final Boolean viewbold = styleController.isBold(node);
        mSetNodeFontBold.setValue(bold != null);
        mNodeFontBold.setValue(viewbold);
      }
      {
        final Boolean italic = NodeStyleModel.isItalic(node);
        final Boolean viewitalic = styleController.isItalic(node);
        mSetNodeFontItalic.setValue(italic != null);
        mNodeFontItalic.setValue(viewitalic);
      }
      {
        final Boolean hyperlink = NodeLinks.formatNodeAsHyperlink(node);
        final Boolean viewhyperlink = LinkController.getController().formatNodeAsHyperlink(node);
        mSetNodeFontHyperlink.setValue(hyperlink != null);
        mNodeFontHyperlink.setValue(viewhyperlink);
      }
      {
        final Boolean nodeNumbering = NodeStyleModel.getNodeNumbering(node);
        final Boolean viewNodeNumbering = styleController.getNodeNumbering(node);
        mSetNodeNumbering.setValue(nodeNumbering != null);
        mNodeNumbering.setValue(viewNodeNumbering);
      }
      {
        String nodeFormat = NodeStyleModel.getNodeFormat(node);
        String viewNodeFormat = TextController.getController().getNodeFormat(node);
        mSetNodeFormat.setValue(nodeFormat != null);
        if (viewNodeFormat == null && node.getUserObject() instanceof IFormattedObject)
          viewNodeFormat = ((IFormattedObject) node.getUserObject()).getPattern();
        mNodeFormat.setValue(viewNodeFormat);
      }
      if (mAutomaticLayoutComboBox != null) {
        final ModeController modeController = Controller.getCurrentModeController();
        AutomaticLayoutController al = modeController.getExtension(AutomaticLayoutController.class);
        IExtension extension = al.getExtension(node);
        if (extension == null) mAutomaticLayoutComboBox.setSelectedItem(AUTOMATIC_LAYOUT_DISABLED);
        else mAutomaticLayoutComboBox.setSelectedIndex(((AutomaticLayout) extension).ordinal());
      }
      if (mAutomaticEdgeColorCheckBox != null) {
        final ModeController modeController = Controller.getCurrentModeController();
        AutomaticEdgeColorHook al =
            (AutomaticEdgeColorHook) modeController.getExtension(AutomaticEdgeColorHook.class);
        mAutomaticEdgeColorCheckBox.setSelected(al.isActive(node));
      }
    } finally {
      internalChange = false;
    }
  }