gxp.plugins.FeatureEditor
¶
-
class
gxp.plugins.
FeatureEditor
(config)¶ Plugin for feature editing. Requires a
gxp.plugins.FeatureManager
.
Config Options¶
Configuration properties in addition to those listed for Ext.util.Observable.
-
actions
Array
Custom actions for tools that do not provide their own. Array elements are expected to be valid Ext config objects or strings referencing a valid Ext component. Actions provided here may have additionalmenuText
andbuttonText
properties. The former will be used as text when the action is used in a menu. The latter will be conditionally used on buttons, only ifshowButtonText
is set to true. The nativetext
property will unconditionally be used for buttons. Optional, only needed to create custom actions.
-
actionTarget
Object
orString
orArray
Where to place the tool’s actions (e.g. buttons or menus)?In case of a string, this can be any string that references an
Ext.Container
property on the portal, or a unique id configured on a component.In case of an object, the object has a “target” and an “index” property, so that the tool can be inserted at a specified index in the target.
actionTarget can also be an array of strings or objects, if the action is to be put in more than one place (e.g. a button and a context menu item).
To reference one of the toolbars of an
Ext.Panel
, ”.tbar”, ”.bbar” or ”.fbar” has to be appended. The default is “map.tbar”. The viewer’s main MapPanel can always be accessed with “map” as actionTarget. Set to null if no actions should be created.Some tools provide a context menu. To reference this context menu as actionTarget for other tools, configure an id in the tool’s outputConfig, and use the id with ”.contextMenu” appended. In the snippet below, a layer tree is created, with a “Remove layer” action as button on the tree’s top toolbar, and as menu item in its context menu:
{ xtype: "gxp_layertree", outputConfig: { id: "tree", tbar: [] } }, { xtype: "gxp_removelayer", actionTarget: ["tree.tbar", "tree.contextMenu"] }
If a tool has both actions and output, and you want to force it to immediately output to a container, set actionTarget to null. If you want to hide the actions, set actionTarget to false. In this case, you should configure a defaultAction to make sure that an action is active.
-
autoActivate
Boolean
Set to false if the tool should be initialized without activating it. Default is true.
-
autoLoadFeature
Boolean
Should this tool load a feature on click? If set to true, and if there is no loaded feature at the click position, this tool will call loadFeatures on thefeatureManager
, with aFeatureId
filter created from the id of a feature returned from a WMS GetFeatureInfo request at the click position. This feature will then be selected immediately. Default is false.
-
closeOnSave
Boolean
If true, close the popup after saving. Defaults to false.
-
commitMessage
Boolean
Should we prompt the user for a commit message? Default is false.
-
controlOptions
Object
Options for theOpenLayers.Control.SelectFeature
used with this tool.
-
createFeatureActionText
String
Create new feature text (i18n).
-
createFeatureActionTip
String
Tooltip string for create new feature action (i18n).
-
createOnly
Boolean
Set to true to use the FeatureEditor merely as a feature creation tool, i.e. there is no option to modify existing features.
-
defaultAction
Number
Optional index of an action that should be active by default. Only works for actions that are aGeoExt.Action
instance.
-
editFeatureActionText
String
Modify feature text (i18n).
-
editFeatureActionTip
String
Tooltip string for edit existing feature action (i18n).
-
excludeFields
Array
Optional list of field names (case sensitive) that are to be excluded from the property grid of the FeatureEditPopup.
-
featureManager
String
The id of thegxp.plugins.FeatureManager
to use with this tool.
-
fields
Array
List of field config names corresponding to feature attributes. If not provided, fields will be derived from attributes. If provided, the field order from this list will be used, and fields missing in the list will be excluded.
-
iconClsAdd
String
iconCls to use for the add button.
-
iconClsEdit
String
iconCls to use for the edit button.
-
modifyOnly
Boolean
Set to true to use the FeatureEditor merely as a feature modify tool, i.e. there is no option to add new features.
-
outputAction
Number
Theactions
array index of the action that should trigger this tool’s output. Only valid ifactions
is configured. Leave this unconfigured if none of theactions
should trigger this tool’s output.
-
outputConfig
Object
Optional configuration for the output container. This may be useful to override the xtype (e.g. “window” instead of “gx_popup”), or to provide layout configurations when rendering to anoutputTarget
.
-
outputTarget
String
By default, the FeatureEditPopup will be added to the map.
-
readOnly
Boolean
Set to true to use the FeatureEditor merely as a feature info tool, without editing capabilities. Default is false.
-
roles
Array
Roles authorized to edit layers. Default is [“ROLE_ADMINISTRATOR”]
-
showButtonText
Show the
buttonText
an action is configured with, if used as a button. Default is false.
-
showSelectedOnly
Boolean
If set to true, only selected features will be displayed on the layer. If set to false, all features (on the current page) will be. Default is true.
-
snappingAgent
String
Optional id of thegxp.plugins.SnappingAgent
to use with this tool.
-
splitButton
Boolean
If set to true, the actions will be rendered as a singleExt.SplitButton
instead of two separateExt.Button
instances, one for creating new features and one for editing existing features. Default is false.
-
splitButtonText
String
Text for the optional Edit SplitButton (i18n)
-
splitButtonTooltip
String
Tooltip for the optional Edit SplitButton (i18n)
-
supportAbstractGeometry
Should we support layers that advertize an abstract geometry type? In this case, we will provide menu options for digitizing point, line or polygon features. Default is false.
-
supportNoGeometry
Should we support the ability to create features with no geometry? This only works when combined with supportAbstractGeometry: true. Default is false.
-
toggleGroup
String
If this tool should be radio-button style toggled with other tools, this string is to identify the toggle group.
-
tolerance
Number
Optional pixel tolerance to use when selecting features. By default, the server decides whether a pixel click intersects a feature based on its own rules. If a pixel tolerance is provided, it will be included in requests for features to inform the server to look in a buffer around features.
Public Properties¶
Public properties in addition to those listed for Ext.util.Observable.
-
FeatureEditor.
active
¶ Boolean
Is the tool currently active?
Public Methods¶
Public methods in addition to those listed for Ext.util.Observable.
-
FeatureEditor.
activate
()¶ Returns: Boolean
true when this tool was activatedActivates this tool.
-
FeatureEditor.
addActions
()¶
-
FeatureEditor.
addOutput
()¶ Parameters: config – Object
configuration for theExt.Component
to be added to theoutputTarget
. Properties of this configuration will be overridden by the applicationsoutputConfig
for the tool instance. Tool plugins that want to reuse their output (after being closed by a window or crumb panel) can also provide anExt.Component
instance here, if it was previously created withaddOutput
.Returns: Ext.Component
The component added to theoutputTarget
.Adds output to the tool’s
outputTarget
. This method is meant to be called and/or overridden by subclasses.
-
FeatureEditor.
deactivate
()¶ Returns: Boolean
true when this tool was deactivatedDeactivates this tool.
-
FeatureEditor.
getState
()¶ :return {Object} Gets the configured tool state. Overwrite in subclasses to return anything other than a copy of the initialConfig property.
-
FeatureEditor.
removeOutput
()¶ Removes all output created by this tool
-
FeatureEditor.
select
()¶ Parameters: feature – OpenLayers.Feature.Vector
Action to perform when a feature is selected. The default action is to unselect existing selections and select the feature using the built-in SelectFeature control. To be overridden by subclasses.
Events¶
Events in addition to those listed for Ext.util.Observable.
-
activate
Fired when the tool is activated.
Listener arguments: * tool -
gxp.plugins.Tool
the activated tool
-
deactivate
Fired when the tool is deactivated.
Listener arguments: * tool -
gxp.plugins.Tool
the deactivated tool
-
featureeditable
Fired when a feature is selected or unselected for editing. Listeners can use this method to determine when a feature is ready for editing. Beware that this event is fired multiple times when a feature is unselected.
Listener arguments:
- tool -
gxp.plugins.FeatureManager
This tool - feature -
OpenLayers.Feature.Vector
The feature. - editable -
Boolean
The feature is ready to be edited.
- tool -
-
layereditable
Fired when a layer is selected or unselected in the target viewer. Listeners can use this method to determine when a layer is ready for editing.
Listener arguments:
- tool -
gxp.plugins.FeatureManager
This tool - record -
GeoExt.data.LayerRecord
The selected layer record. Will benull
if no layer record is selected. - editable -
Boolean
The layer is ready to be edited.
- tool -