|
ehsbe CommonsTM Version 1.1.0rc3 |
|||||||||
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
com.ehsbe.commons.gui.JxTitledPanel
com.ehsbe.commons.gui.EditorPanel<T>
T
- the target, which the editor is able o handlepublic abstract class EditorPanel<T>
A more or less sophisticated bean editor.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected JPanel |
buttonPanel
the panel, where control buttons are added |
static String |
COMMIT_FAILED
action command usually send on a failed commits of changes |
static String |
COMMIT_PARTIAL_SUCCESS
action command usually send if a commit was canceled |
static String |
COMMIT_SUCCESS
action command usually send on a successful commit of changes |
protected InitialContext |
ctx
the context for the given target |
static int |
HGAP
default distance in pixels between a label and its input component |
static int |
SEPGAP
default additional distance in pixels to separate two lines of components |
protected T |
target
the currently attached target |
static int |
VGAP
default distance in pixels between two lines of components |
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.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 | |
---|---|
EditorPanel()
Create a panel with a border layout. |
|
EditorPanel(String title)
Create a panel with a border layout. |
Method Summary | |
---|---|
void |
addActionListener(ActionListener listener)
Add the given listener to this component. |
void |
addButton(AbstractButton... button)
Add the given button to the panels button area. |
void |
addDefaultButtons(ActionListener listener,
String... cmds)
Convinience method to lookup and add default actions and add an appropriate button to the button panel. |
protected boolean |
askForCommit()
Show a GUI dialog, which ask the user, whether changed properties should be saved. |
void |
commit(boolean doCommit)
Persist all changes to the target back to the datastore. |
void |
dispose()
Release all allocated resources and close and dispose all evtl. fired dialogs, frames and threads. |
protected void |
fireActionPerformed(ActionEvent e)
Fire the given event to all action listeners of this component. |
protected void |
fireActionPerformed(String commandName)
Convinience method to fire an action event to all action listeners of this component. |
JPanel |
getButtonPanel()
Get the panel used to layout dialog buttons. |
abstract String |
getRawName()
Get the raw name of this panel. |
T |
getTarget()
Get the currently set target |
boolean |
needCommit()
Check, whether any changes have been made to the target and thus need to be commited back to the datastore. |
void |
removeActionListener(ActionListener listener)
Remove the given listener from the internal listener list. |
void |
removeButton(AbstractButton button)
Remove the given button from the button panel. |
void |
setButtonPanel(JPanel panel)
Set the panel used to layout dialog buttons. |
void |
setTarget(T target,
InitialContext ctx)
Stores the target and context to be edit. |
Methods inherited from class com.ehsbe.commons.gui.JxTitledPanel |
---|
getTitledBorder, setTitle, setTitledBorder |
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 |
---|
protected T target
protected InitialContext ctx
protected JPanel buttonPanel
public static final int HGAP
public static final int VGAP
public static final int SEPGAP
public static final String COMMIT_SUCCESS
public static final String COMMIT_FAILED
public static final String COMMIT_PARTIAL_SUCCESS
Constructor Detail |
---|
public EditorPanel()
public EditorPanel(String title)
title
- title to setMethod Detail |
---|
public abstract String getRawName()
The name is usually used to lookup the i18n name for this editor (e.g. which is displayed in a JTab) or might be carefully used for identifying the editor.
protected boolean askForCommit()
Usually invoked by setTarget(T, javax.naming.InitialContext)
before a new target gets set,
if needCommit()
returns true
.
true
if properties have been changed and should be
commited back to the backing store.public void setTarget(T target, InitialContext ctx)
Does nothing, if the given target has a reference to the target currently
set. Otherwise it uses the needCommit()
method, to determine,
whether field values have been changed and asks for commit, if changes
were made. After that it stores the new target and context and returns
the control to the calling instance.
target
- an editable target. If null
, this is an
indication, that the controller perhaps want this instance inform
to commit all changes, if required.ctx
- context to use, if the editor needs more information.askForCommit()
,
getTarget()
,
ctx
public T getTarget()
null
setTarget(T, javax.naming.InitialContext)
public boolean needCommit()
This gives the controller the opportunity to instruct commits before it disposes this instance.
true
if the target has been changed.public void commit(boolean doCommit)
doCommit
- if false
, the values should not be commited
to the backing datastore and the GUI controls should be reset to
their inital values, so that a subsequent request to
needCommit()
return false
as long as no new
changes have been made after the reset.public void dispose()
Per default it sets the references to the currently set target and
context to null
.
public void addDefaultButtons(ActionListener listener, String... cmds)
The locale of this panel is used for i18n.
listener
- listener to add to created buttons. Ignored if
null
.cmds
- commands to lookup. Ignored if null
.ActionFactory.getDefaultAction(java.util.Locale, java.lang.String)
,
JButton.JButton(javax.swing.Action)
,
addButton(AbstractButton[])
public void addButton(AbstractButton... button)
button
- button to add. Ignored if null
.public void removeButton(AbstractButton button)
button
- button to remove. Ignored if null
.public JPanel getButtonPanel()
public void setButtonPanel(JPanel panel)
panel
- a button panel. ignored if null
.public void addActionListener(ActionListener listener)
listener
- listener to add.public void removeActionListener(ActionListener listener)
listener
- listener to removeprotected void fireActionPerformed(String commandName)
0
and the given commandName set as its
action command.
commandName
- the name of the action command in the generated
action event.protected void fireActionPerformed(ActionEvent e)
e
- event to fire.
|
ehsbe CommonsTM Version 1.1.0rc3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |