ilog.webui.dhtml.components
Class IlxWButton
- java.lang.Object
-
- ilog.webui.dhtml.IlxWContainer
-
- ilog.webui.dhtml.IlxWComponent
-
- ilog.webui.dhtml.components.IlxWButton
-
- All Implemented Interfaces:
- ilog.webui.dhtml.IlxWConstants, ilog.webui.dhtml.IlxWCSSModelProvider, ilog.webui.dhtml.IlxWDependencyProvider, ilog.webui.dhtml.IlxWJSObject, java.io.Serializable
public class IlxWButton extends IlxWComponent
This class implements a simple button component. A button component is rendered on the web browser as an<input type="submit">
element.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ilog.webui.dhtml.IlxWComponent
IlxWComponent.DynamicStyleMap
-
-
Field Summary
-
Fields inherited from class ilog.webui.dhtml.IlxWContainer
listenerList
-
-
Constructor Summary
Constructors Constructor and Description IlxWButton()
Constructs an empty button, with no text.IlxWButton(java.lang.String text)
Constructs a button with the given caption.
-
Method Summary
Methods Modifier and Type Method and Description void
addActionListener(java.awt.event.ActionListener listener)
Adds the specified action listener.protected IlxWAction
createDefaultAction()
Create the default action.protected void
doPrint(IlxWPort port)
protected void
fireActionPerformed()
Notifies all action listeners than an action has been triggered, using the text of the button as the name of the event command.IlxWAction
getAction()
Gets the action which will be called when the user clicks on the button.java.lang.String
getText()
Gets the text displayed in the buttonboolean
isEnabled()
Specifies whether the component is enabled or not.protected void
printComponent(IlxWPort port)
Prints the HTML code that will display the graphical representation of this component.void
removeActionListener(java.awt.event.ActionListener listener)
Removes the specified action listener.void
setAction(IlxWAction action)
Sets the action which will be called when the user clicks on this button.void
setEnabled(boolean enabled)
Sets the component as enabled or disabled.void
setText(java.lang.String text)
Sets the text to display in the button.-
Methods inherited from class ilog.webui.dhtml.IlxWComponent
addPropertyChangeListener, addPropertyChangeListener, detach, firePropertyChange, firePropertyChange, getName, getRealHtmlTagName, getStyle, invalidate, isInvalidated, notifyDependencies, print, removePropertyChangeListener, removePropertyChangeListener, setName, validate
-
Methods inherited from class ilog.webui.dhtml.IlxWContainer
add, add, getAttribute, getAttributeNames, getComponent, getComponentCount, getComponentNamed, getComponents, getManager, getParent, getUserAgentRules, indexOf, isAncestorOf, remove, remove, removeAll, removeAttribute, setAttribute, setAuthorRules, setFinalizer
-
-
-
-
Constructor Detail
-
IlxWButton
public IlxWButton()
Constructs an empty button, with no text.
-
IlxWButton
public IlxWButton(java.lang.String text)
Constructs a button with the given caption.- Parameters:
text
- The text to display in the button.
-
-
Method Detail
-
setText
public void setText(java.lang.String text)
Sets the text to display in the button.- Parameters:
text
- any string
-
getText
public java.lang.String getText()
Gets the text displayed in the button- Returns:
- The text displayed in the button.
-
setEnabled
public void setEnabled(boolean enabled)
Sets the component as enabled or disabled.- Parameters:
enabled
- enabled flag value
-
isEnabled
public boolean isEnabled()
Specifies whether the component is enabled or not.- Returns:
true
if the button is enabled.
-
setAction
public void setAction(IlxWAction action)
Sets the action which will be called when the user clicks on this button. If you define your own action, be aware that the default action will not be called anymore and the registered action listeners will not be notified anymore, unless you do it explicitly.- Parameters:
action
- The action to perform when the user clicks on the button.- See Also:
getAction()
-
getAction
public IlxWAction getAction()
Gets the action which will be called when the user clicks on the button.By default, this action is a Java action (
IlxWJavaAction
) of which theperform
method callsfireActionPerformed
on the button.- Returns:
- The action to perform when the user clicks on the button.
- See Also:
setAction(ilog.webui.dhtml.components.IlxWAction)
-
createDefaultAction
protected IlxWAction createDefaultAction()
Create the default action. The default action is a Java action of which theperform
method simply callsfireActionPerformed
.
-
doPrint
protected void doPrint(IlxWPort port) throws java.io.IOException
- Overrides:
doPrint
in classIlxWComponent
- Throws:
java.io.IOException
-
printComponent
protected void printComponent(IlxWPort port) throws java.io.IOException
Description copied from class:IlxWComponent
Prints the HTML code that will display the graphical representation of this component. This method is called by theIlxWComponent.print(ilog.webui.dhtml.IlxWPort)
method.- Specified by:
printComponent
in classIlxWComponent
- Throws:
java.io.IOException
- Parameters:
port
- The port on which the component will be printed.- See Also:
IlxWComponent.print(ilog.webui.dhtml.IlxWPort)
-
addActionListener
public void addActionListener(java.awt.event.ActionListener listener)
Adds the specified action listener.- Parameters:
listener
- the action listener
-
removeActionListener
public void removeActionListener(java.awt.event.ActionListener listener)
Removes the specified action listener.- Parameters:
listener
- the action listener
-
fireActionPerformed
protected void fireActionPerformed()
Notifies all action listeners than an action has been triggered, using the text of the button as the name of the event command.
-
-