|
SalesPoint v3.3 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sale.FormSheet
public class FormSheet
A FormSheet to be displayed in a FormSheetContainer.
FormSheets comprise a caption, a JComponent of arbitrary complexity, and a button bar. FormSheets will
be displayed by FormSheetContainers
, which define what the FormSheet finally
looks like on the screen. Usually, the FormSheet's caption will become part of the FormSheetContainer's
frame caption; the FormSheet's component will take up most of the client space of the FormSheetContainer's
frame; and the button bar will be displayed at the bottom side of the FormSheetContainer's frame.
However, FormSheets are designed to make transparent the final display of the GUI, and, thus, you as an
application developer do not need to worry about the final layout. All you need to know is what components
you want to present and which buttons you want to put into the button bar. Buttons in the button bar are
associated an Action
that will be performed when the button is clicked. In the
doAction()
method of that Action, you will have access to the SalesPoint
and SaleProcess
in whose context the FormSheet is displayed, if any. There is also a special
ActionListener, ActionActionListener
, that you can use to associate any button in a FormSheet with
an Action.
To actually display a FormSheet, you need a Display
on which you can call
Display.setFormSheet(sale.FormSheet)
or Display.popUpFormSheet(sale.FormSheet)
.
Nested Class Summary | |
---|---|
static class |
FormSheet.FormButton
A button in the FormSheet's button bar. |
Field Summary | |
---|---|
static int |
BTNID_CANCEL
Button ID used for the standard Cancel button. |
static int |
BTNID_OK
Button ID used for the standard OK button. |
protected boolean |
m_fCancelled
True if this FormSheet was canelled. |
Constructor Summary | |
---|---|
FormSheet(String sCaption,
FormSheetContentCreator fscc,
boolean fWaitResponse)
Create a new FormSheet, using a content creator. |
|
FormSheet(String sCaption,
JComponent jcmpComponent)
Create a new FormSheet. |
|
FormSheet(String sCaption,
JComponent jcmpComponent,
boolean fWaitResponse)
Create a new FormSheet. |
Method Summary | |
---|---|
void |
addButton(FormSheet.FormButton fb)
Add a button to the FormSheet's button bar. |
void |
addButton(String sCaption,
int nID,
Action aAction)
Add a button to the FormSheet's button bar. |
void |
addContentCreator(FormSheetContentCreator fscc)
Add a contents creator for this FormSheet. |
FormSheetContainer |
attach(FormSheetContainer fsc)
Attach a FormSheetContainer to this FormSheet. |
SaleProcess |
attach(SaleProcess p)
Attach a process to this FormSheet. |
SalesPoint |
attach(SalesPoint sp)
Attach a SalesPoint to this FormSheet. |
Iterator<FormSheet.FormButton> |
buttonIterator()
Return a fail-fast, readonly iterator iterating over the buttons in the button bar. |
Iterator<FormSheet.FormButton> |
buttonIterator(boolean fSorted)
Return a readonly iterator iterating over the buttons in the button bar. |
void |
cancel()
Hook method called whenever the standard "Cancel" button was clicked. |
void |
close()
Close the FormSheet. |
FormSheetContainer |
detachDisplay()
Detach the current FormSheetContainer from this FormSheet. |
SaleProcess |
detachProcess()
Detach the current process from this FormSheet. |
SalesPoint |
detachSalesPoint()
Detach the current SalesPoint from this FormSheet. |
void |
fillBtnPanel(JPanel jp)
Called by the Framework to generate the button bar's representation. |
FormSheet.FormButton |
getButton(int nID)
Get a button from the FormSheet's button bar. |
Object |
getButtonsLock()
Get the monitor used to synchronize access to the FormSheet's button bar. |
String |
getCaption()
Get the FormSheet's caption. |
JComponent |
getComponent()
Get the component of this FormSheet. |
Object |
getComponentLock()
Get the monitor to be used when accessing this FormSheet's component. |
FormSheetContainer |
getDisplay()
Get the currently attached FormSheetContainer. |
protected Object |
getDisplayLock()
Get the monitor used to synchronize access to the display. |
SaleProcess |
getProcess()
Get the currently attached process. |
SalesPoint |
getSalesPoint()
Get the currently attached SalesPoint. |
boolean |
isCancelled()
Return whether the cancel button was used to close the FormSheet. |
void |
ok()
Hook method called whenever the standard "OK" button was clicked. |
void |
removeAllButtons()
Remove all buttons from the FormSheet's button bar. |
FormSheet.FormButton |
removeButton(int nID)
Remove a button from the FormSheet's button bar. |
void |
setCaption(String sCaption)
Set the caption for this FormSheet. |
JComponent |
setComponent(JComponent jcmpComponent)
Set the component for this FormSheet. |
void |
setWaitResponse(boolean fWaitResponse)
Set the waitResponse property of this FormSheet. |
String |
toString()
|
boolean |
waitResponse()
Return true if Display.setFormSheet(sale.FormSheet) should block until the FormSheet is closed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected boolean m_fCancelled
public static final int BTNID_OK
public static final int BTNID_CANCEL
Constructor Detail |
---|
public FormSheet(String sCaption, JComponent jcmpComponent)
Display.setFormSheet(sale.FormSheet)
will block until this FormSheet is closed.
By default, a FormSheet has two standard buttons: "OK" and "Cancel".
sCaption
- the caption of the FormSheet.jcmpComponent
- the component of the FormSheet.ok()
,
cancel()
public FormSheet(String sCaption, JComponent jcmpComponent, boolean fWaitResponse)
By default, a FormSheet has two standard buttons: "OK" and "Cancel".
sCaption
- the caption of the FormSheet.jcmpComponent
- the component of the FormSheet.fWaitResponse
- if true, Display.setFormSheet(sale.FormSheet)
will
block until this FormSheet is closed.ok()
,
cancel()
public FormSheet(String sCaption, FormSheetContentCreator fscc, boolean fWaitResponse)
When the FormSheet is being serialized, only the content creator will be serialized. When the FormSheet gets deserialized, the content creator is called to restore the FormSheet's content.
sCaption
- the FormSheet's captionfscc
- the FormSheetContentCreator that will create the FormSheet's contentsfWaitResponse
- if true, Display.setFormSheet(sale.FormSheet)
will
block until this FormSheet is closed.Method Detail |
---|
public Object getComponentLock()
FormSheetContainers
can use this monitor when displaying the FormSheet, to
make sure, they don't loose any changes about the component.
public Object getButtonsLock()
FormSheetContainers
can use this lock to make
sure, they don't loose any button change events while making the FormSheet visible.
protected Object getDisplayLock()
Subclasses of FormSheet can use this lock when defining further events that
must be handled by the FormSheetContainer
.
public final void addContentCreator(FormSheetContentCreator fscc)
When the contents creator is used to create the FormSheet's contents, all contents creators that have ever been added to the FormSheet will be called in the order in which they were added. This ensures, that you can subclass FormSheets that use contents creators properly, extending their contents by simply adding another contents creator.
In the first contents creator you can assume a null
component, a "OK" as well
as a "Cancel" button.
fscc
- the new FormSheetContentCreator. Must not be null
.ok()
,
cancel()
public JComponent setComponent(JComponent jcmpComponent)
If the FormSheet is being displayed, an FormSheetContainer.onFormSheetComponentChanged(sale.FormSheet, javax.swing.JComponent)
event is fired, so that the change can affect the display instantaneously.
jcmpComponent
- the new component
public JComponent getComponent()
public void setCaption(String sCaption)
If the FormSheet is being displayed, an FormSheetContainer.onFormSheetCaptionChanged(sale.FormSheet, java.lang.String)
event is
fired, so that the change can affect the display instantaneously.
sCaption
- the new caption.public String getCaption()
public boolean isCancelled()
public void close()
FormSheetContainer.closeFormSheet(sale.FormSheet)
.
public boolean waitResponse()
Display.setFormSheet(sale.FormSheet)
should block until the FormSheet is closed.
waitResponse
property by calling setWaitResponse(boolean)
before making the FormSheet visible.public void setWaitResponse(boolean fWaitResponse)
waitResponse
property of this FormSheet.
The waitResponse
property decides whether or not Display.setFormSheet(sale.FormSheet)
should
block until the FormSheet is closed.
The new value of the waitResponse
property will have no effect before the FormSheet is
displayed the next time, by calling setFormSheet()
.
fWaitResponse
- the new value for the waitResponse
property. If true
Display.setFormSheet(sale.FormSheet)
should block until the FormSheet is closed.public SalesPoint attach(SalesPoint sp)
You will usually not call this method directly, it is called by the Framework.
sp
- the SalesPoint to be attached.
public SalesPoint detachSalesPoint()
You will usually not call this method directly, it is called by the Framework.
public SalesPoint getSalesPoint()
public SaleProcess attach(SaleProcess p)
You will usually not call this method directly, it is called by the Framework.
p
- the process to be attached.
public SaleProcess detachProcess()
You will usually not call this method directly, it is called by the Framework.
public SaleProcess getProcess()
public FormSheetContainer attach(FormSheetContainer fsc)
You will usually not call this method directly, it is called by the Framework.
fsc
- the FormSheetContainer to be attached.
public FormSheetContainer detachDisplay()
You will usually not call this method directly, it is called by the Framework.
public FormSheetContainer getDisplay()
public void addButton(String sCaption, int nID, Action aAction)
If the FormSheet is being displayed, an FormSheetContainer.onFormSheetButtonAdded(sale.FormSheet, sale.FormSheet.FormButton)
event is
fired, so that the change can affect the display instantaneously.
sCaption
- the caption of the buttonnID
- the ID of the button. This ID will later be used to identify the button and, therefore, must
be unique for this FormSheet. If there is already a button in this FormSheet that has the same ID, a
DuplicateButtonIDError
will be thrown.aAction
- the action to be associated with the button.
DuplicateButtonIDError
- if a button with the same ID already exists.public void addButton(FormSheet.FormButton fb)
If the FormSheet is being displayed, an FormSheetContainer.onFormSheetButtonAdded(sale.FormSheet, sale.FormSheet.FormButton)
event is
fired, so that the change can affect the display instantaneously.
fb
- the button to be added. The button's ID will later be used to identify it and, therefore, must
be unique for this FormSheet. If there is already a button in this FormSheet that has the same ID, a
DuplicateButtonIDError
will be thrown.
DuplicateButtonIDError
- if a button with the same ID already exists.public FormSheet.FormButton removeButton(int nID)
If the FormSheet is being displayed, an FormSheetContainer.onFormSheetButtonRemoved(sale.FormSheet, sale.FormSheet.FormButton)
event is
fired, so that the change can affect the display instantaneously.
nID
- the ID of the button to be removed. If the button does not exist, nothing happens.
public void removeAllButtons()
If the FormSheet is being displayed, an FormSheetContainer.onFormSheetButtonsCleared(sale.FormSheet)
event is
fired, so that the change can affect the display instantaneously.
public FormSheet.FormButton getButton(int nID)
nID
- the ID of the button to be returned.public Iterator<FormSheet.FormButton> buttonIterator()
The buttons will not be returned in the order in which they where added, but in
a random order. To get them sorted in order of adding, see buttonIterator(boolean)
.
public Iterator<FormSheet.FormButton> buttonIterator(boolean fSorted)
fSorted
- if true, the buttons will be returned in the order in which they
were added to the FormSheet.public void fillBtnPanel(JPanel jp)
jp
- the panel to be filled. The buttons will be added in the order in which
they where added to the FormSheet.public void ok()
public void cancel()
isCancelled()
public String toString()
toString
in class Object
|
SalesPoint v3.3 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |