/** * Create the NotationProviders. * * @param own the current owner */ protected void initNotationProviders(Object own) { if (Model.getFacade().isAModelElement(own)) { notationProviderName = NotationProviderFactory2.getInstance() .getNotationProvider(NotationProviderFactory2.TYPE_NAME, own); notationProviderName.putValue("edge", Boolean.TRUE); } }
/** generate the notation for the modelelement and stuff it into the text Fig */ protected void updateNameText() { if (getOwner() == null) { return; } if (notationProviderName != null) { String nameStr = notationProviderName.toString(); nameFig.setText(nameStr); calcBounds(); setBounds(getBounds()); } }
/** * This method is called after the user finishes editing a text field that is in the * FigEdgeModelElement. Determine which field and update the model. This class handles the name, * subclasses should override to handle other text elements. * * @param ft the text Fig that has been edited */ protected void textEdited(FigText ft) { if (ft == nameFig) { if (getOwner() == null) return; ft.setText(notationProviderName.parse(ft.getText())); } }
/** * This method is called when the user doubleclicked on the text field, and starts editing. * Subclasses should overrule this field to e.g. supply help to the user about the used format. * * <p>It is also possible to alter the text to be edited already here, e.g. by adding the * stereotype in front of the name, but that seems not user-friendly. * * @param ft the FigText that will be edited and contains the start-text */ protected void textEditStarted(FigText ft) { if (ft == getNameFig()) { showHelp(notationProviderName.getParsingHelp()); ft.setText(notationProviderName.toString()); } }