|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
semorg.gui.util.ForeignKeyConstraintSelector
public class ForeignKeyConstraintSelector
This class provides a SWT composite which allows the user to manage several associations.
Field Summary | |
---|---|
private boolean |
controlEnabled
true if the control is enabled, false otherwise. |
private org.eclipse.swt.widgets.ToolItem |
deleteItem
Button to delete the associated object. |
private org.eclipse.swt.widgets.ToolItem |
disconnectItem
Button to disconnect the current item and the yet associated item. |
static int |
FK_CLIENT
Instances from this type allow to manage the association to a Client object. |
static int |
FK_COMPANY
Instances from this type allow to manage the association to a Company object. |
static int |
FK_COMPANYINTERNALPRESENTATION
Instances from this type allow to manage the association to a CompanyInternalPresentation object. |
static int |
FK_PUBLICPRESENTATION
Instances from this type allow to manage the association to a PublicPresentation object. |
static int |
FK_SEMINARTYPE
Instances from this type allow to manage the association to a SeminarType object. |
private org.eclipse.swt.widgets.ToolItem |
newItem
Button to create a new item which gets associated to the current item. |
private int |
selectedId
The id of the associated object. |
private org.eclipse.swt.widgets.Text |
selectedValueText
A text field to display some information about the associated object. |
private org.eclipse.swt.widgets.ToolItem |
showListItem
Button to show the available objects for associating. |
private org.eclipse.swt.widgets.ToolBar |
toolBar
SWT ToolBar widget which contains some Buttons to manage the association to a object. |
private int |
type
The current type of this control. |
Fields inherited from class org.eclipse.swt.widgets.Control |
---|
handle |
Constructor Summary | |
---|---|
ForeignKeyConstraintSelector(org.eclipse.swt.widgets.Composite parent,
int type)
Creates an instance of this class using the given parameters. |
Method Summary | |
---|---|
void |
addModifyListener(org.eclipse.swt.events.ModifyListener listener)
Adds a ModifyListener to the text field
selectedValueText . |
private boolean |
deleteFromDB()
Deletes the record corresponding to selectedId (the associated
object) from the database. |
private String |
determineDeleteMessage()
This method determines the right deletion dialog hint text against the type of the foreign key of the data record managed by this control. |
int |
getSelectedId()
|
private boolean |
isLockedId(int id)
Checks whether the given id is locked,i.e. the object to the id is edited elsewhere, or not. |
private void |
onDelete()
This method implements the functionality of the deletion button, i.e. it deletes the selected element if it isn't locked. |
void |
setData(String key,
String value)
Sets a pair of key and value to this control needed for testing with ATOSj. |
void |
setEnabled(boolean enabled)
Enables or disables the disconnectItem , deleteItem and
showListItem . |
void |
setSelectedId(int selectedId)
Sets the selectedId to the given id and enables the items
disconnectItem and deleteItem if necessary. |
private void |
updateText()
Updates the text shown in the selectedValueText widget. |
Methods inherited from class org.eclipse.swt.widgets.Composite |
---|
changed, checkSubclass, computeSize, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList |
Methods inherited from class org.eclipse.swt.widgets.Scrollable |
---|
computeTrim, getClientArea, getHorizontalBar, getVerticalBar |
Methods inherited from class org.eclipse.swt.widgets.Control |
---|
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update |
Methods inherited from class org.eclipse.swt.widgets.Widget |
---|
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int FK_COMPANY
Company
object.
public static final int FK_CLIENT
Client
object.
public static final int FK_SEMINARTYPE
SeminarType
object.
public static final int FK_COMPANYINTERNALPRESENTATION
CompanyInternalPresentation
object.
public static final int FK_PUBLICPRESENTATION
PublicPresentation
object.
private final org.eclipse.swt.widgets.Text selectedValueText
private final org.eclipse.swt.widgets.ToolBar toolBar
private final org.eclipse.swt.widgets.ToolItem showListItem
private final org.eclipse.swt.widgets.ToolItem disconnectItem
private final org.eclipse.swt.widgets.ToolItem newItem
private final org.eclipse.swt.widgets.ToolItem deleteItem
private final int type
private int selectedId
private boolean controlEnabled
Constructor Detail |
---|
public ForeignKeyConstraintSelector(org.eclipse.swt.widgets.Composite parent, int type)
Method Detail |
---|
private void updateText()
selectedValueText
widget.
public void setSelectedId(int selectedId)
selectedId
to the given id and enables the items
disconnectItem
and deleteItem
if necessary.
selectedId
- the id of the new associated object.public void addModifyListener(org.eclipse.swt.events.ModifyListener listener)
ModifyListener
to the text field
selectedValueText
.
listener
- the listener to add.public void setEnabled(boolean enabled)
disconnectItem
, deleteItem
and
showListItem
.controlEnabled
is also set to the given value. If the
items got enabled depends also on the fact, whether there is a object
associated or not.
setEnabled
in class org.eclipse.swt.widgets.Control
enabled
- if true the widgets get enabled, if
false disabled.public void setData(String key, String value)
key
- the key (type) of the value setvalue
- the value set to the controlprivate boolean isLockedId(int id)
id
- the id to check.
private void onDelete()
private String determineDeleteMessage()
private boolean deleteFromDB() throws SQLException
selectedId
(the associated
object) from the database.
SQLException
public int getSelectedId()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |