Class adf.ToolItem
Defined in: core.js.
Constructor Attributes | Constructor Name and Description |
---|---|
adf.ToolItem(id, name, action, isMarker)
A ToolItem can represent a Tool or a Command.
|
Field Attributes | Field Name and Description |
---|---|
The adf.action associated with the ToolItem
|
|
When true, the ToolItem submits the form using AJAX.
|
|
adf.Control which this ToolItem works with
|
|
The default image of the ToolItem
|
|
The default style of the ToolItem
|
|
The disabled image of the ToolItem
|
|
The disabled style of the ToolItem
|
|
The HTML DOM element on which the adf.Action performs its operation
|
|
The hover image of the ToolItem
|
|
The hover style of the ToolItem
|
|
The id of the ToolItem
|
|
Whether the ToolItem is active
|
|
Whether ToolItem is a command.
|
|
Whether toolitem is enabled/disabled
|
|
Whether ToolItem is a marker (drawn as graphic on screen) or tool (sends coordinates/request to server)
|
|
The name of the ToolItem
|
|
The selected image of the ToolItem
|
|
The selected style of the ToolItem
|
|
If working with a map control, whether to show the loading image.
|
|
Tool tip string for mouse over
|
Method Attributes | Method Name and Description |
---|---|
activate()
Activates the tool and its adf.Action
|
|
Deactivates the tool and its adf.Action
|
|
The callback function to call after a adf.ToolItem's adf.Action was completed
|
Class Detail
adf.ToolItem(id, name, action, isMarker)
A ToolItem can represent a Tool or a Command. As a Tool, the ToolItem uses an adf.Action to
capture user interaction and then does something meaningful with the result of that interaction.
For example, a ToolItem using adf.DrawPointAction to display coordinates where the mouse was
clicked in an alert box.
As a Command, the ToolItem is not associated any adf.Action (it does not require any user interaction). For example, a ToolItem that displays the text "Hello World" in an alert box.
ToolItems have a visual representation which allows users to invoke them. Using JSF controls, ToolItems can be visualized through a Toolbar control or through a Button control.
1. Using Toolbar Control
2. Using a Button Control
ToolItems can also be visualized using Javascript by either using the Toolbar object or by using Map.createToolItem() When visualized using the approaches described above, the ADF ensures that atmost one ToolItem is active at any given time.
adfdojo.declare("my.DisplayCoordinateTool, adf.ToolItem, {
constructor: function(id, toolName) {
this.id = id;
this.name = toolName;
this.action = new adf.PointAction();
},
postAction: function(point) {
alert("Mouse was Clicked At" + point.x + ',' + point.y);
}
}
));
As a Command, the ToolItem is not associated any adf.Action (it does not require any user interaction). For example, a ToolItem that displays the text "Hello World" in an alert box.
adfdojo.declare("my.HelloCommand, adf.ToolItem, {
constructor: function(id, toolName) {
this.id = id;
this.name = toolName;
},
postAction: function(point) {
alert("Hello World Welcome to Java ArcGIS Server");
}
}
));
ToolItems have a visual representation which allows users to invoke them. Using JSF controls, ToolItems can be visualized through a Toolbar control or through a Button control.
1. Using Toolbar Control
a:tool id="mytool" clientAction="my.DisplayCoordinateTool" serverAction="com.my.event.processCoordinates" toolText="Zoom In" lineColor="#0000FF" lineWidth="3"
2. Using a Button Control
a:button id="select" mapId="map1" onclick="adf.EditTask.clearEditSketch('E1');" clientAction="adf.MapRectangle" serverAction="#{mapContext.attributes.mapEditor.select}"
defaultImage="./images/tasks/editing/selectfeature.gif" hoverImage="./images/tasks/editing/selectfeatureU.gif" selectedImage="./images/tasks/editing/selectfeatureD.gif"
toolTip="EditTask.TaskInfo.Tip.selectfeatures"
ToolItems can also be visualized using Javascript by either using the Toolbar object or by using Map.createToolItem() When visualized using the approaches described above, the ADF ensures that atmost one ToolItem is active at any given time.
- Parameters:
- {String} id
- the id of the tool
- {String} name
- the name of the tool
- {adf.Action} action
- the adf.Action bound to this tool
- {Boolean} isMarker Optional, Default: false
- This parameter has been deprecated.
Field Detail
{adf.Action}
action
The adf.action associated with the ToolItem
{Boolean}
clientPostBack
When true, the ToolItem submits the form using AJAX. Otherwise, it submits the form
in the traditional way causing a full page refresh.
- Default Value:
- false
{adf.Control}
control
adf.Control which this ToolItem works with
defaultImage
The default image of the ToolItem
{String}
defaultStyle
The default style of the ToolItem
disabledImage
The disabled image of the ToolItem
{String}
disabledStyle
The disabled style of the ToolItem
{HTMLElement}
element
The HTML DOM element on which the adf.Action performs its operation
hoverImage
The hover image of the ToolItem
{String}
hoverStyle
The hover style of the ToolItem
{String}
id
The id of the ToolItem
{Boolean}
isActive
Whether the ToolItem is active
- Default Value:
- false
{Boolean}
isCommand
Whether ToolItem is a command. If is a command, the activate and deactivate functions are called in succession.
- Default Value:
- true
{Boolean}
isDisabled
Whether toolitem is enabled/disabled
- Default Value:
- false
{Boolean}
isMarker
Whether ToolItem is a marker (drawn as graphic on screen) or tool (sends coordinates/request to server)
{String}
name
The name of the ToolItem
selectedImage
The selected image of the ToolItem
{String}
selectedStyle
The selected style of the ToolItem
{Boolean}
showLoading
If working with a map control, whether to show the loading image.
- Default Value:
- true
{String}
toolTip
Tool tip string for mouse over
Method Detail
activate()
Activates the tool and its adf.Action
deactivate()
Deactivates the tool and its adf.Action
postAction()
The callback function to call after a adf.ToolItem's adf.Action was completed