gxp.plugins.AddLayers¶
-
class
gxp.plugins.AddLayers(config)¶ Plugin for removing a selected layer from the map. TODO Make this plural - selected layers
Config Options¶
Configuration properties in addition to those listed for Ext.util.Observable.
-
actions ArrayCustom 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 additionalmenuTextandbuttonTextproperties. The former will be used as text when the action is used in a menu. The latter will be conditionally used on buttons, only ifshowButtonTextis set to true. The nativetextproperty will unconditionally be used for buttons. Optional, only needed to create custom actions.
-
actionTarget ObjectorStringorArrayWhere 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.Containerproperty 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.
-
addActionMenuText StringText for add feed menu item (i18n).
-
addActionText StringText for the Add action. None by default.
-
addActionTip StringText for add action tooltip (i18n).
-
addButtonText StringText for add layers button (i18n).
-
addLayerSourceErrorText StringText for an error message when WMS GetCapabilities retrieval fails (i18n).
-
addServerText StringText for add server button (i18n).
-
autoActivate BooleanSet to false if the tool should be initialized without activating it. Default is true.
-
availableLayersText StringText for the available layers (i18n).
-
catalogSourceKey StringWhen lazy layerRecords are created by the ‘Find Layers’ function, they can optionally be associated with another source. E.g. the ‘local’ source in GeoNode client.
-
controlOptions ObjectIf this tool is associated with anOpenLayers.Controlthen this is an optional object to pass to the constructor of the associatedOpenLayers.Control.
-
createExpander FunctionReturns anExt.grid.RowExpander. Can be overridden by applications/subclasses to provide a custom expander.
-
defaultAction NumberOptional index of an action that should be active by default. Only works for actions that are aGeoExt.Actioninstance.
-
doneText StringText for Done button (i18n).
-
expanderTemplateText StringText for the grid expander (i18n).
-
feeds Object | BooleanIf provided, agxp.FeedSourceDialogwill be added as a menu option. This panel will be constructed using the provided config. By default, no feed functionality is provided.
-
findActionMenuText StringText for find menu item (i18n).
-
instructionsText StringText for additional instructions at the bottom of the grid (i18n). None by default.
-
layerSelectionText StringText for the layer selection (i18n).
-
nonUploadSources ArrayIfuploadis enabled, the upload button will not be displayed for sources whose identifiers or URLs are in the provided array. By default, the upload button will make an effort to be shown for all sources with a url property.
-
outputAction NumberTheactionsarray index of the action that should trigger this tool’s output. Only valid ifactionsis configured. Leave this unconfigured if none of theactionsshould trigger this tool’s output.
-
outputConfig ObjectOptional 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 StringWhere to add the tool’s output container? This can be any string that references anExt.Containerproperty on the portal, or “map” to access the viewer’s main map. If not provided, a window will be created. To reference one of the toolbars of anExt.Panel, ”.tbar”, ”.bbar” or ”.fbar” has to be appended.
-
panelTitleText StringText for the layer title (i18n).
-
postUploadAction String|ObjectEither the id of a plugin that provides the action to be performed after an upload, or an object withpluginandoutputConfigproperties. TheaddOutputmethod of the plugin referenced by the provided id (or thepluginproperty) will be called, with the providedoutputConfigas argument. A usage example would be to open the Styles tab of the LayerProperties dialog for a WMS layer:postUploadAction: { plugin: "layerproperties", outputConfig: {activeTab: 2} }
-
relativeUploadOnly BooleanIfuploadis enabled, only show the button for sources with relative URLs (e.g. “/geoserver”). Default istrue.
-
search Object | BooleanIf provided, agxp.CatalogueSearchPanelwill be added as a menu option. This panel will be constructed using the provided config. By default, no search functionality is provided.
-
searchText StringText for the search dialog title (i18n).
-
showButtonText Show the
buttonTextan action is configured with, if used as a button. Default is false.
-
startSourceId IntegerThe identifier of the source that we should start with.
-
toggleGroup StringIf this tool should be radio-button style toggled with other tools, this string is to identify the toggle group.
-
untitledText StringText for an untitled layer (i18n).
-
upload Object | BooleanIf provided, agxp.LayerUploadPanelwill be made accessible from a button on the Available Layers dialog. This panel will be constructed using the provided config. By default, no upload button will be added to the Available Layers dialog.
-
uploadRoles ArrayRoles authorized to upload layers. Default is [“ROLE_ADMINISTRATOR”]
-
uploadSource Stringid of a WMS source (:class:`gxp.plugins.WMSSource’) backed by a GeoServer instance that all uploads will be sent to. If provided, an Upload menu item will be shown in the “Add Layers” button menu.
-
uploadText StringText for upload button (only renders ifuploadis provided).
Public Properties¶
Public properties in addition to those listed for Ext.util.Observable.
-
AddLayers.active¶ BooleanIs the tool currently active?
Public Methods¶
Public methods in addition to those listed for Ext.util.Observable.
-
AddLayers.activate()¶ Returns: Booleantrue when this tool was activatedActivates this tool.
-
AddLayers.addActions()¶
-
AddLayers.addOutput()¶ Parameters: config – Objectconfiguration for theExt.Componentto be added to theoutputTarget. Properties of this configuration will be overridden by the applicationsoutputConfigfor the tool instance. Tool plugins that want to reuse their output (after being closed by a window or crumb panel) can also provide anExt.Componentinstance here, if it was previously created withaddOutput.Returns: Ext.ComponentThe component added to theoutputTarget.Adds output to the tool’s
outputTarget. This method is meant to be called and/or overridden by subclasses.
-
AddLayers.createUploadButton()¶ Parameters: Cls – FunctionThe class to use for creating the button. If not provided, anExt.Buttoninstance will be created.Ext.menu.Itemwould be another option.If this tool is provided an
uploadproperty, a button will be created that launches a window with agxp.LayerUploadPanel.
-
AddLayers.deactivate()¶ Returns: Booleantrue when this tool was deactivatedDeactivates this tool.
-
AddLayers.getState()¶ :return {Object} Gets the configured tool state. Overwrite in subclasses to return anything other than a copy of the initialConfig property.
-
AddLayers.removeOutput()¶ Removes all output created by this tool
-
AddLayers.showCapabilitiesGrid()¶ Shows the window with a capabilities grid.
-
AddLayers.showCatalogueSearch()¶ Shows the window with a search panel.
-
AddLayers.showFeedDialog()¶ Shows the window with a dialog for adding feeds.
Events¶
Events in addition to those listed for Ext.util.Observable.
-
activate Fired when the tool is activated.
Listener arguments: * tool -
gxp.plugins.Toolthe activated tool
-
deactivate Fired when the tool is deactivated.
Listener arguments: * tool -
gxp.plugins.Toolthe deactivated tool
-
sourceselected Fired when a new source is selected.
Listener arguments:
- tool -
gxp.plugins.AddLayersThis tool. - source -
gxp.plugins.LayerSourceThe selected source.
- tool -