|
Dresden OCL Toolkit | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
tudresden.ocl.gui.OCLEditor
An editor for a list of OCL Constraints. The editor allows editing
of a list of constraint representations
as specified by its model
.
Nested Class Summary | |
protected static class |
OCLEditor.ConstraintTableModel
Table model for the table of constraints. |
protected static class |
OCLEditor.OCLEditorDocument
A specialized styled document that will prevent editing of portions of text which have been specially marked "allowEdit"==FALSE. |
Nested classes inherited from class javax.swing.JPanel |
JPanel.AccessibleJPanel |
Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
private ConstraintRepresentation |
m_crCurrent
The currently selected constraint, if any. |
private OCLEditor.ConstraintTableModel |
m_ctmTableModel
The table model used by the list of constraints table. |
private boolean |
m_fConstraintChanged
Set to false when beginning edit mode, evaluated at the end of editing a newly created constraint to determine whether to remove it again. |
private boolean |
m_fCreatedFreshConstraint
Indicates the constraint currently being edited is a newly created one. |
private boolean |
m_fDoAutoSplit
Should multi-constraint inputs be automatically split into individual constraints? |
private boolean |
m_fDoTypeCheck
Does parseAndCheckConstraint(java.lang.String, tudresden.ocl.check.types.ModelFacade) perform type checking? |
private boolean |
m_fHandleCaretUpdates
|
private boolean |
m_fInEditMode
If true, we're in edit mode. |
private boolean |
m_fNoContextEdit
Should the constraints context (everything up to the first 'inv', 'pre', or 'post') be un-editable? |
private JButton |
m_jbEdit
|
private JButton |
m_jbNew
|
private JButton |
m_jbPreferences
|
private JButton |
m_jbRemove
|
private JButton |
m_jbSaveEditResult
|
private JCheckBox |
m_jcbQuickBar
|
private JPanel |
m_jpConstraintListPane
|
private JPanel |
m_jpEditorPanel
|
private JPanel |
m_jpPreviewGroup
|
private JPanel |
m_jpPreviewPane
|
private JPanel |
m_jpToolbarWrapper
|
private JScrollPane |
m_jspConstraintEditorScroller
|
private JScrollPane |
m_jspConstraintListScroller
|
private JScrollPane |
m_jspConstraintPreviewScroller
|
private JSplitPane |
m_jspMainPane
|
private JToolBar |
m_jtbTools
|
private JTable |
m_jtConstraintList
|
private JTextPane |
m_jtpConstraintEditor
|
private JTextPane |
m_jtpConstraintPreview
|
private int |
m_nOldDot
|
private int |
m_nOldMark
|
private int |
m_nOptionMask
The options supported by this instance of the editor. |
private OCLEditorModel |
m_oclemModel
The underlying model. |
private OCLToolbar |
m_ocltbQuickBar
|
static int |
OPTIONMASK_AUTOSPLIT
|
static int |
OPTIONMASK_TYPECHECK
|
private JPanel |
pad1
|
private JPanel |
pad2
|
private static SimpleAttributeSet |
s_sasField
Attributes used to denote fields that need to be replaced. |
private static SimpleAttributeSet |
s_sasNoEditText
Attributes used to denote uneditable text. |
private static SimpleAttributeSet |
s_sasNormalText
Attributes used to denote normal OCL constraint text. |
Fields inherited from class javax.swing.JPanel |
|
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Container |
|
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
OCLEditor()
Creates new form OCLEditor |
Method Summary | |
(package private) void |
addConstraintText(String[] saBefore,
String sText,
String[] saAfter)
Add the given text to the edit pane, if a constraint is currently being edited. |
void |
constraintAdded(ConstraintChangeEvent cce)
Select the newly added constraint. |
void |
constraintDataChanged(ConstraintChangeEvent cce)
Update the editor if the currently selected constraint changed. |
void |
constraintNameChanged(ConstraintChangeEvent cce)
Ignored. |
void |
constraintRemoved(ConstraintChangeEvent cce)
If the current constraint was deleted, clear the selection. |
protected OCLEditor.ConstraintTableModel |
createConstraintTableModel()
Create and return an instance of ConstraintTableModel that will be used to represent the list of constraints currently being edited. |
protected int |
getCaretPositionFromLineAndColumn(int nLine,
int nCol)
Compute caret position for the given line and column in the editor pane's text. |
boolean |
getDoAutoSplit()
Return whether auto split mode is on. |
boolean |
getDoTypeCheck()
Return whether type checking mode is on. |
OCLEditorModel |
getModel()
Retrieve the underlying model. |
boolean |
getNoContextEdit()
Return whether context editing is currently prohibited. |
int |
getOptionMask()
|
private void |
initComponents()
This method is called from within the constructor to initialize the form. |
boolean |
isInEditMode()
Return true if the OCL editor is currently in edit mode. |
boolean |
isValidConstraintName(String sName)
Checks the specified name and returns true if it is a valid OCL name. |
private void |
onCaretUpdate(CaretEvent evt)
|
private void |
onEditButton(ActionEvent evt)
|
private void |
onNewConstraintButton(ActionEvent evt)
|
private void |
onPreferencesButton(ActionEvent evt)
|
private void |
onQuickBarButton(ActionEvent evt)
|
private void |
onRemoveConstraintButton(ActionEvent evt)
React to the remove button. |
private void |
onSubmitConstraintButton(ActionEvent evt)
React to the submit button. |
OclTree |
parseAndCheckConstraint(String sConstraint,
ModelFacade mfFacade)
Check the specified constraint using the specified model facade for model information. |
void |
setDoAutoSplit(boolean fDoAutoSplit)
Set the auto split mode. |
void |
setDoTypeCheck(boolean fDoTypeCheck)
Set the type checking mode. |
void |
setEditMode(boolean fEditMode)
Set the edit mode of the OCL editor. |
protected void |
setEditorText(ConstraintRepresentation cr)
Replace the contents of the edior by the data of the specified constraint. |
void |
setModel(OCLEditorModel oclemModel)
Set the underlying model and update the display. |
void |
setNoContextEdit(boolean fNoContextEdit)
Specify whether or not to allow editing the context of a constraint. |
void |
setOptionMask(int nOptionMask)
Specify which user option check boxes should be displayed. |
List |
splitConstraint(OclTree ocltConstraint)
Split the specified constraint into its constituting constraints. |
void |
valueChanged(ListSelectionEvent p1)
The selection in the table changed. |
protected String |
wrapMessage(String sMessage,
int nMaxLineLen)
|
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static SimpleAttributeSet s_sasField
private static SimpleAttributeSet s_sasNormalText
private static SimpleAttributeSet s_sasNoEditText
private OCLEditorModel m_oclemModel
private ConstraintRepresentation m_crCurrent
private OCLEditor.ConstraintTableModel m_ctmTableModel
private boolean m_fDoTypeCheck
parseAndCheckConstraint(java.lang.String, tudresden.ocl.check.types.ModelFacade)
perform type checking?
private boolean m_fDoAutoSplit
private boolean m_fNoContextEdit
public static final int OPTIONMASK_TYPECHECK
public static final int OPTIONMASK_AUTOSPLIT
private int m_nOptionMask
private boolean m_fInEditMode
private boolean m_fConstraintChanged
constraintDataChanged(tudresden.ocl.gui.events.ConstraintChangeEvent)
event is received for the currently selected
constraint, this is set to true.
private boolean m_fCreatedFreshConstraint
private boolean m_fHandleCaretUpdates
private int m_nOldDot
private int m_nOldMark
private JToolBar m_jtbTools
private JButton m_jbNew
private JButton m_jbRemove
private JButton m_jbEdit
private JButton m_jbSaveEditResult
private JPanel pad1
private JButton m_jbPreferences
private JPanel pad2
private JCheckBox m_jcbQuickBar
private JPanel m_jpToolbarWrapper
private OCLToolbar m_ocltbQuickBar
private JPanel m_jpEditorPanel
private JScrollPane m_jspConstraintEditorScroller
private JTextPane m_jtpConstraintEditor
private JSplitPane m_jspMainPane
private JPanel m_jpConstraintListPane
private JScrollPane m_jspConstraintListScroller
private JTable m_jtConstraintList
private JPanel m_jpPreviewPane
private JPanel m_jpPreviewGroup
private JScrollPane m_jspConstraintPreviewScroller
private JTextPane m_jtpConstraintPreview
Constructor Detail |
public OCLEditor()
Method Detail |
protected OCLEditor.ConstraintTableModel createConstraintTableModel()
Attention! This method is called from the constructor
and should therefore be overridden with great care. When referencing
this
from within this method care must be taken to recognize
that this
will not have been fully initialized yet. In
particular, any field introduced by subclasses of OCLEditor
will not have been initialized, and any code specified in constructors of
subclasses of OCLEditor
will not have been executed.
public OCLEditorModel getModel()
public void setModel(OCLEditorModel oclemModel)
public boolean isInEditMode()
public void setEditMode(boolean fEditMode)
public boolean isValidConstraintName(String sName)
isValidConstraintName
in interface EditingUtilities
public void setOptionMask(int nOptionMask)
public int getOptionMask()
public void setNoContextEdit(boolean fNoContextEdit)
public boolean getNoContextEdit()
public void setDoTypeCheck(boolean fDoTypeCheck)
public boolean getDoTypeCheck()
parseAndCheckConstraint(java.lang.String, tudresden.ocl.check.types.ModelFacade)
will also check type conformance of
constraints.
public OclTree parseAndCheckConstraint(String sConstraint, ModelFacade mfFacade) throws OclParserException, IOException, OclTypeException
This is a short-cut helper function for editor models that want to parse constraints before adding them to the model base.
parseAndCheckConstraint
in interface EditingUtilities
OclParserException
- if a syntax error occurred.
IOException
- if an I/O operation failed.
OclTypeException
- if a type checking error occurred.public void setDoAutoSplit(boolean fDoAutoSplit)
public boolean getDoAutoSplit()
splitConstraint(tudresden.ocl.OclTree)
and create one
constraint representation per actual constraint.
getDoAutoSplit
in interface EditingUtilities
public List splitConstraint(OclTree ocltConstraint)
context Test inv: a > 0 inv: a < 10 inv: a * 100 = 900would be split into three constraints:
context Test inv: a > 0 context Test inv: a < 10 context Test inv: a * 100 = 900
splitConstraint
in interface EditingUtilities
void addConstraintText(String[] saBefore, String sText, String[] saAfter)
null
and contain elements, these will be added as
items to be replaced. The first such item will be selected.
protected void setEditorText(ConstraintRepresentation cr)
private void initComponents()
private void onEditButton(ActionEvent evt)
private void onNewConstraintButton(ActionEvent evt)
private void onPreferencesButton(ActionEvent evt)
private void onCaretUpdate(CaretEvent evt)
private void onQuickBarButton(ActionEvent evt)
protected String wrapMessage(String sMessage, int nMaxLineLen)
private void onSubmitConstraintButton(ActionEvent evt)
protected int getCaretPositionFromLineAndColumn(int nLine, int nCol)
private void onRemoveConstraintButton(ActionEvent evt)
public void valueChanged(ListSelectionEvent p1)
valueChanged
in interface ListSelectionListener
public void constraintAdded(ConstraintChangeEvent cce)
constraintAdded
in interface ConstraintChangeListener
public void constraintRemoved(ConstraintChangeEvent cce)
constraintRemoved
in interface ConstraintChangeListener
public void constraintNameChanged(ConstraintChangeEvent cce)
constraintNameChanged
in interface ConstraintChangeListener
public void constraintDataChanged(ConstraintChangeEvent cce)
constraintDataChanged
in interface ConstraintChangeListener
|
Dresden OCL Toolkit | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |