Package org.opencms.gwt.client.seo
Class CmsAliasList
- java.lang.Object
-
- com.google.gwt.user.client.ui.UIObject
-
- com.google.gwt.user.client.ui.Widget
-
- com.google.gwt.user.client.ui.Composite
-
- org.opencms.gwt.client.seo.CmsAliasList
-
- All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasAttachHandlers
,com.google.gwt.event.shared.HasHandlers
,com.google.gwt.user.client.EventListener
,com.google.gwt.user.client.ui.HasVisibility
,com.google.gwt.user.client.ui.IsRenderable
,com.google.gwt.user.client.ui.IsWidget
public class CmsAliasList extends com.google.gwt.user.client.ui.Composite
A widget used for editing the alias list of a page.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
CmsAliasList.AliasControls
A helper class which encapsulates the input widgets for a single alias.
-
Field Summary
Fields Modifier and Type Field Description protected static CmsAliasMessages
aliasMessages
The alias messages.protected static int
idCounter
Static variable used to generate new ids.static I_CmsInputCss
INPUT_CSS
The CSS bundle for input widgets.protected com.google.gwt.user.client.rpc.AsyncCallback<java.util.Map<java.lang.String,java.lang.String>>
m_defaultValidationHandler
The callback which is normally used for validation of the site paths.protected boolean
m_hasValidationErrors
A flag used to keep track of whether the last validation had any errors.protected org.opencms.util.CmsUUID
m_structureId
The structure id of the page for which the aliases are being edited.
-
Constructor Summary
Constructors Constructor Description CmsAliasList(org.opencms.util.CmsUUID structureId, java.util.List<org.opencms.gwt.shared.alias.CmsAliasBean> aliases)
Creates a new widget instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAlias(org.opencms.gwt.shared.alias.CmsAliasBean alias)
Adds the controls for a single alias to the widget.void
clearValidationErrors()
Clears the validation error flag.protected com.google.gwt.user.client.ui.PushButton
createAddButton()
Creates the button used for adding new aliases.protected com.google.gwt.user.client.ui.PushButton
createDeleteButton()
Creates the button used for deleting aliases.protected com.google.gwt.user.client.ui.PushButton
createIconButton(java.lang.String icon)
Creates an icon button for editing aliases.protected com.google.gwt.user.client.ui.Label
createLabel(java.lang.String text)
Creates a label for this widget.protected CmsSelectBox
createSelectBox()
Creates the select box for selecting alias modes.protected CmsTextBox
createTextBox()
Creates a text box for entering an alias path.java.util.List<org.opencms.gwt.shared.alias.CmsAliasBean>
getAliases()
Gets a list of the changed aliases.java.util.Map<java.lang.String,java.lang.String>
getAliasPaths()
Gets a map of the current alias site paths, with the alias controls ids as the keys.boolean
hasValidationErrors()
Checks whether there have been validation errors since the validation errors were cleared the last time.void
init(java.util.List<org.opencms.gwt.shared.alias.CmsAliasBean> aliases)
Initializes the alias controls.protected void
onChangePath(CmsAliasList.AliasControls controls)
This method is called when an alias path changes.void
validate(java.lang.Runnable nextAction)
Simplified method to perform a full validation of the aliases in the list and execute an action afterwards.void
validateAliases(org.opencms.util.CmsUUID uuid, java.util.Map<java.lang.String,java.lang.String> aliasPaths, com.google.gwt.user.client.rpc.AsyncCallback<java.util.Map<java.lang.String,java.lang.String>> callback)
Validates aliases.protected void
validateFull(org.opencms.util.CmsUUID structureId, java.util.Map<java.lang.String,java.lang.String> sitePaths, com.google.gwt.user.client.rpc.AsyncCallback<java.util.Map<java.lang.String,java.lang.String>> errorCallback)
Performs a validation of the current list of aliases in the widget.protected void
validateSingle(org.opencms.util.CmsUUID structureId, java.util.Map<java.lang.String,java.lang.String> sitePaths, java.lang.String newSitePath, com.google.gwt.user.client.rpc.AsyncCallback<java.lang.String> errorCallback)
Validation method used when adding a new alias.-
Methods inherited from class com.google.gwt.user.client.ui.Composite
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
-
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
-
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
-
-
-
-
Field Detail
-
INPUT_CSS
public static final I_CmsInputCss INPUT_CSS
The CSS bundle for input widgets.
-
aliasMessages
protected static CmsAliasMessages aliasMessages
The alias messages.
-
idCounter
protected static int idCounter
Static variable used to generate new ids.
-
m_defaultValidationHandler
protected com.google.gwt.user.client.rpc.AsyncCallback<java.util.Map<java.lang.String,java.lang.String>> m_defaultValidationHandler
The callback which is normally used for validation of the site paths.
-
m_hasValidationErrors
protected boolean m_hasValidationErrors
A flag used to keep track of whether the last validation had any errors.
-
m_structureId
protected org.opencms.util.CmsUUID m_structureId
The structure id of the page for which the aliases are being edited.
-
-
Constructor Detail
-
CmsAliasList
public CmsAliasList(org.opencms.util.CmsUUID structureId, java.util.List<org.opencms.gwt.shared.alias.CmsAliasBean> aliases)
Creates a new widget instance.- Parameters:
structureId
- the structure id of the page for which the aliases should be editedaliases
- the aliases being edited
-
-
Method Detail
-
addAlias
public void addAlias(org.opencms.gwt.shared.alias.CmsAliasBean alias)
Adds the controls for a single alias to the widget.- Parameters:
alias
- the alias for which the controls should be added
-
clearValidationErrors
public void clearValidationErrors()
Clears the validation error flag.
-
getAliases
public java.util.List<org.opencms.gwt.shared.alias.CmsAliasBean> getAliases()
Gets a list of the changed aliases.- Returns:
- a list of the aliases
-
getAliasPaths
public java.util.Map<java.lang.String,java.lang.String> getAliasPaths()
Gets a map of the current alias site paths, with the alias controls ids as the keys.- Returns:
- a map from control ids to alias site paths
-
hasValidationErrors
public boolean hasValidationErrors()
Checks whether there have been validation errors since the validation errors were cleared the last time.- Returns:
- true if there were validation errors
-
init
public void init(java.util.List<org.opencms.gwt.shared.alias.CmsAliasBean> aliases)
Initializes the alias controls.- Parameters:
aliases
- the existing aliases
-
validate
public void validate(java.lang.Runnable nextAction)
Simplified method to perform a full validation of the aliases in the list and execute an action afterwards.- Parameters:
nextAction
- the action to execute after the validation finished
-
validateAliases
public void validateAliases(org.opencms.util.CmsUUID uuid, java.util.Map<java.lang.String,java.lang.String> aliasPaths, com.google.gwt.user.client.rpc.AsyncCallback<java.util.Map<java.lang.String,java.lang.String>> callback)
Validates aliases.- Parameters:
uuid
- The structure id for which the aliases should be validaliasPaths
- a map from id strings to alias pathscallback
- the callback which should be called with the validation results
-
createAddButton
protected com.google.gwt.user.client.ui.PushButton createAddButton()
Creates the button used for adding new aliases.- Returns:
- the new button
-
createDeleteButton
protected com.google.gwt.user.client.ui.PushButton createDeleteButton()
Creates the button used for deleting aliases.- Returns:
- the new button
-
createIconButton
protected com.google.gwt.user.client.ui.PushButton createIconButton(java.lang.String icon)
Creates an icon button for editing aliases.- Parameters:
icon
- the icon css class to use- Returns:
- the new icon button
-
createLabel
protected com.google.gwt.user.client.ui.Label createLabel(java.lang.String text)
Creates a label for this widget.- Parameters:
text
- the text to display in the label- Returns:
- the created label
-
createSelectBox
protected CmsSelectBox createSelectBox()
Creates the select box for selecting alias modes.- Returns:
- the select box for selecting alias modes
-
createTextBox
protected CmsTextBox createTextBox()
Creates a text box for entering an alias path.- Returns:
- the new text box
-
onChangePath
protected void onChangePath(CmsAliasList.AliasControls controls)
This method is called when an alias path changes.- Parameters:
controls
- the alias controls
-
validateFull
protected void validateFull(org.opencms.util.CmsUUID structureId, java.util.Map<java.lang.String,java.lang.String> sitePaths, com.google.gwt.user.client.rpc.AsyncCallback<java.util.Map<java.lang.String,java.lang.String>> errorCallback)
Performs a validation of the current list of aliases in the widget.- Parameters:
structureId
- the resource's structure idsitePaths
- the map from ids to alias site pathserrorCallback
- the callback to invoke when the validation finishes
-
validateSingle
protected void validateSingle(org.opencms.util.CmsUUID structureId, java.util.Map<java.lang.String,java.lang.String> sitePaths, java.lang.String newSitePath, com.google.gwt.user.client.rpc.AsyncCallback<java.lang.String> errorCallback)
Validation method used when adding a new alias.- Parameters:
structureId
- the structure idsitePaths
- the site pathsnewSitePath
- the new site patherrorCallback
- on error callback
-
-