/** * Creates a new field that selects the language for an expression. * * @param m Expression model, should be shared between Language and Body fields * @param n Only one of Language and Body fields should forward events to model */ public UMLExpressionLanguageField(UMLExpressionModel m, boolean n) { model = m; notifyModel = n; getDocument().addDocumentListener(this); setToolTipText(Translator.localize("label.language.tooltip")); setFont(LookAndFeelMgr.getInstance().getStandardFont()); update(); }
/** * The constructor. * * @param expressionModel Expression model, should be shared between Language and Body fields */ public ExpressionBodyField(ExpressionModel expressionModel) { model = expressionModel; getDocument().addDocumentListener(this); setToolTipText(Translator.localize("label.body.tooltip")); setFont(LookAndFeelMgr.getInstance().getStandardFont()); setRows(2); // make it stretch vertically String oldText = getText(); String newText = model.getBody(); if (oldText == null || newText == null || !oldText.equals(newText)) { if (oldText != newText) { setText(newText); } } }