public String getNiceName() {
   String niceName = getName();
   if (niceName != null && niceName.trim().length() > 0) {
     return ToolBox.getJavaName(niceName);
   }
   return getNodeTypeName();
 }
 @Override
 protected String getProcedureName() {
   return "sendMessageTo"
       + ToolBox.getJavaName(
           (getServiceOperation() != null
               ? getServiceOperation().getFullyQualifiedName()
                   + "_"
                   + getServiceOperation().getFlexoID()
               : "Null"));
 }
  /** @param model */
  public DoubleWidget(PropertyModel model, AbstractController controller) {
    super(model, controller);

    double min, max, inc;
    if (model.hasValueForParameter(MIN_VALUE_PARAM)) {
      min = model.getDoubleValueForParameter(MIN_VALUE_PARAM);
    } else {
      min = DEFAULT_MIN_VALUE;
    }
    if (model.hasValueForParameter(MAX_VALUE_PARAM)) {
      max = model.getDoubleValueForParameter(MAX_VALUE_PARAM);
    } else {
      max = DEFAULT_MAX_VALUE;
    }
    if (model.hasValueForParameter(INCREMENT_VALUE_PARAM)) {
      inc = model.getDoubleValueForParameter(INCREMENT_VALUE_PARAM);
    } else {
      inc = DEFAULT_INC_VALUE;
    }

    SpinnerNumberModel valueModel = new SpinnerNumberModel(min, min, max, inc);
    valueChooser = new JSpinner(valueModel);
    valueChooser.setEditor(new JSpinner.NumberEditor(valueChooser /*, "#.##"*/));
    valueChooser.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            if (e.getSource() == valueChooser) {
              updateModelFromWidget();
            }
          }
        });
    valueChooser.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    JComponent editor = valueChooser.getEditor();
    if (editor instanceof DefaultEditor) {
      ((DefaultEditor) editor).getTextField().setHorizontalAlignment(SwingConstants.LEFT);
      if (ToolBox.getPLATFORM() != ToolBox.MACOS) {
        ((DefaultEditor) editor)
            .getTextField()
            .setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 0));
      }
    }
    if (model.hasValueForParameter(READONLY_TEXTFIELD)
        && model.getBooleanValueForParameter(READONLY_TEXTFIELD)) {
      valueChooser.setEnabled(false);
    }

    getDynamicComponent().addFocusListener(new WidgetFocusListener(this));
  }
  public EntitySpecializationGR(EntitySpecialization anEntitySpecialization, Drawing<?> aDrawing) {
    super(
        ConnectorType.RECT_POLYLIN,
        (ShapeGraphicalRepresentation<?>)
            aDrawing.getGraphicalRepresentation(anEntitySpecialization.getSpecializedEntity()),
        (ShapeGraphicalRepresentation<?>)
            aDrawing.getGraphicalRepresentation(anEntitySpecialization.getParentEntity()),
        anEntitySpecialization,
        aDrawing);
    // setText(getRole().getName());

    updateStyles();

    propertyNameStyle = TextStyle.makeTextStyle(Color.DARK_GRAY, ATTRIBUTE_FONT);

    setTextStyle(propertyNameStyle);

    getConnector().setIsRounded(true);
    getConnector().setRectPolylinConstraints(RectPolylinConstraints.VERTICAL_LAYOUT);
    getConnector().setAdjustability(RectPolylinAdjustability.FULLY_ADJUSTABLE);
    getConnector().setStraightLineWhenPossible(true);
    getConnector().setPixelOverlap(30);

    setEndSymbol(EndSymbolType.PLAIN_ARROW);
    setEndSymbolSize(15);

    if (getSpecializedEntity().hasGraphicalPropertyForKey(getStoredPolylinKey())) {
      ensurePolylinConverterIsRegistered();
      polylinIWillBeAdustedTo =
          (FGERectPolylin) getSpecializedEntity()._graphicalPropertyForKey(getStoredPolylinKey());
      getConnector().setWasManuallyAdjusted(true);
    }

    setForeground(ForegroundStyle.makeStyle(Color.DARK_GRAY, 1.6f));

    setIsFocusable(true);

    addToMouseClickControls(new ResetLayout(), true);
    addToMouseClickControls(new ERDiagramController.ShowContextualMenuControl());
    if (ToolBox.getPLATFORM() != ToolBox.MACOS) {
      addToMouseClickControls(new ERDiagramController.ShowContextualMenuControl(true));
    }
    // addToMouseDragControls(new DrawRoleSpecializationControl());

  }
 /** Creates a new empty project in a temp directory */
 public void test0CreateProject() {
   logger.info("test0CreateProject");
   ToolBox.setPlatform();
   FlexoLoggingManager.forceInitialize(-1, true, null, Level.INFO, null);
   try {
     File tempFile = File.createTempFile(TEST_CG, "");
     _projectDirectory = new File(tempFile.getParentFile(), tempFile.getName() + ".prj");
     tempFile.delete();
   } catch (IOException e) {
     fail();
   }
   logger.info("Project directory: " + _projectDirectory.getAbsolutePath());
   _projectIdentifier =
       _projectDirectory.getName().substring(0, _projectDirectory.getName().length() - 4);
   logger.info("Project identifier: " + _projectIdentifier);
   _editor = FlexoResourceManager.initializeNewProject(_projectDirectory, EDITOR_FACTORY, null);
   _project = _editor.getProject();
   logger.info("Project has been SUCCESSFULLY created");
 }
  public ConnectorGraphicalRepresentation(
      ConnectorType aConnectorType,
      ShapeGraphicalRepresentation<?> aStartObject,
      ShapeGraphicalRepresentation<?> anEndObject,
      O aDrawable,
      Drawing<?> aDrawing) {
    super(aDrawable, aDrawing);

    layer = FGEConstants.DEFAULT_CONNECTOR_LAYER;

    setStartObject(aStartObject);
    setEndObject(anEndObject);
    setConnectorType(aConnectorType);
    graphics = new FGEConnectorGraphics(this);

    foreground = ForegroundStyle.makeStyle(Color.BLACK);
    // foreground.setGraphicalRepresentation(this);
    foreground.addObserver(this);

    addToMouseClickControls(
        MouseClickControl.makeMouseClickControl(
            "Selection", MouseButton.LEFT, 1, MouseClickControlActionType.SELECTION));
    if (ToolBox.getPLATFORM() == ToolBox.MACOS) {
      addToMouseClickControls(
          MouseClickControl.makeMouseMetaClickControl(
              "Multiple selection",
              MouseButton.LEFT,
              1,
              MouseClickControlActionType.MULTIPLE_SELECTION));
    } else {
      addToMouseClickControls(
          MouseClickControl.makeMouseControlClickControl(
              "Multiple selection",
              MouseButton.LEFT,
              1,
              MouseClickControlActionType.MULTIPLE_SELECTION));
    }
  }
 public static String getProcessBusinessDataEntityNameForProcess(FlexoProcess process) {
   return ToolBox.getJavaClassName(process.getName() + "BusinessData");
 }