public class CmsMessageBundleEditorModel extends java.lang.Object
IndexedContainer.| Modifier and Type | Class and Description |
|---|---|
static class |
CmsMessageBundleEditorModel.ConfigurableMessages
Wrapper for the configurable messages for the column headers of the message bundle editor.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PROPERTY_BUNDLE_DESCRIPTOR_LOCALIZATION
The property for configuring the message bundle used for localizing the bundle descriptors entries.
|
| Constructor and Description |
|---|
CmsMessageBundleEditorModel(CmsObject cms,
CmsResource resource) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addDescriptor()
Creates a descriptor for the currently edited message bundle.
|
boolean |
canAddKeys()
Returns a flag, indicating if keys can be added in the current edit mode.
|
void |
deleteDescriptorIfNecessary()
When the descriptor was added while editing, but the change was not saved, it has to be removed
when the editor is closed.
|
java.util.Set<java.lang.Object> |
getAllUsedKeys()
Returns the a set with all keys that are used at least in one translation.
|
CmsMessageBundleEditorTypes.BundleType |
getBundleType()
Returns the type of the currently edited bundle.
|
CmsMessageBundleEditorModel.ConfigurableMessages |
getConfigurableMessages(CmsMessages defaultMessages,
java.util.Locale locale)
Returns the configured bundle, or the provided default bundle.
|
com.vaadin.v7.data.util.IndexedContainer |
getContainerForCurrentLocale()
Returns the container filled according to the current locale.
|
CmsContextMenu |
getContextMenuForItem(java.lang.Object itemId)
Returns the context menu for the table item.
|
java.util.List<CmsMessageBundleEditorTypes.TableProperty> |
getEditableColumns()
Returns the editable columns for the current edit mode.
|
java.util.List<CmsMessageBundleEditorTypes.TableProperty> |
getEditableColumns(org.opencms.ui.editors.messagebundle.CmsMessageBundleEditorTypes.EditMode mode)
Returns the editable columns for the provided edit mode.
|
java.lang.String |
getEditedFilePath()
Returns the site path for the edited bundle file.
|
org.opencms.ui.editors.messagebundle.CmsMessageBundleEditorTypes.EditMode |
getEditMode()
Returns the current edit mode.
|
java.util.Locale |
getLocale()
Returns the currently edited locale.
|
java.util.Collection<java.util.Locale> |
getLocales()
Returns the locales available for the specific resource.
|
boolean |
getSwitchedLocaleOnOpening()
Returns a flag, indicating if the locale has been switched on opening.
|
void |
handleChange(java.lang.Object propertyId)
Handles the change of a value in the current translation.
|
org.opencms.ui.editors.messagebundle.CmsMessageBundleEditorModel.KeyChangeResult |
handleKeyChange(org.opencms.ui.editors.messagebundle.CmsMessageBundleEditorTypes.EntryChangeEvent event,
boolean allLanguages)
Handles a key change.
|
boolean |
handleKeyDeletion(java.lang.String key)
Handles the deletion of a key.
|
boolean |
hasChanges()
Returns a flag, indicating if something was edited.
|
boolean |
hasDefaultValues()
Returns a flag, indicating if the descriptor specifies any default values.
|
boolean |
hasDescriptionValues()
Returns a flag, indicating if the descriptor specifies any descriptions.
|
boolean |
hasDescriptor()
Returns a flag, indicating if a bundle descriptor is present.
|
boolean |
hasMasterMode()
Returns a flag, indicating if a master edit mode is available.
|
boolean |
isShowOptionsColumn(org.opencms.ui.editors.messagebundle.CmsMessageBundleEditorTypes.EditMode mode)
Returns a flag, indicating if the options column (with add and delete option for rows)
should be shown in the given edit mode.
|
void |
publish()
Publish the bundle resources directly.
|
void |
save()
Saves the messages for all languages that were opened in the editor.
|
void |
saveAsPropertyBundle()
Saves the loaded XML bundle as property bundle.
|
boolean |
setEditMode(org.opencms.ui.editors.messagebundle.CmsMessageBundleEditorTypes.EditMode mode)
Set the edit mode.
|
boolean |
setLocale(java.util.Locale locale)
Set the currently edited locale.
|
void |
unlock()
Unlock all files opened for writing.
|
public static final java.lang.String PROPERTY_BUNDLE_DESCRIPTOR_LOCALIZATION
public CmsMessageBundleEditorModel(CmsObject cms, CmsResource resource) throws CmsException, java.io.IOException
cms - the CmsObject used for reading / writing.resource - the file that is opened for editing.CmsException - thrown if reading some of the involved CmsResources is not possible.java.io.IOException - initialization of a property bundle failspublic boolean addDescriptor()
true if the descriptor could be created, false otherwise.public boolean canAddKeys()
public void deleteDescriptorIfNecessary() throws CmsException
CmsException - thrown when deleting the descriptor resource failspublic java.util.Set<java.lang.Object> getAllUsedKeys()
public CmsMessageBundleEditorTypes.BundleType getBundleType()
public CmsMessageBundleEditorModel.ConfigurableMessages getConfigurableMessages(CmsMessages defaultMessages, java.util.Locale locale)
defaultMessages - the default bundlelocale - the preferred localepublic com.vaadin.v7.data.util.IndexedContainer getContainerForCurrentLocale() throws java.io.IOException, CmsException
java.io.IOException - thrown if reading a bundle resource fails.CmsException - thrown if reading a bundle resource fails.public CmsContextMenu getContextMenuForItem(java.lang.Object itemId)
itemId - the table item.public java.util.List<CmsMessageBundleEditorTypes.TableProperty> getEditableColumns()
public java.util.List<CmsMessageBundleEditorTypes.TableProperty> getEditableColumns(org.opencms.ui.editors.messagebundle.CmsMessageBundleEditorTypes.EditMode mode)
mode - the edit mode.public java.lang.String getEditedFilePath()
public org.opencms.ui.editors.messagebundle.CmsMessageBundleEditorTypes.EditMode getEditMode()
public java.util.Locale getLocale()
public java.util.Collection<java.util.Locale> getLocales()
public boolean getSwitchedLocaleOnOpening()
public void handleChange(java.lang.Object propertyId)
propertyId - the property id of the column where the value has changed.public org.opencms.ui.editors.messagebundle.CmsMessageBundleEditorModel.KeyChangeResult handleKeyChange(org.opencms.ui.editors.messagebundle.CmsMessageBundleEditorTypes.EntryChangeEvent event, boolean allLanguages)
event - the key change event.allLanguages - true for changing the key for all languages, false if the key should be changed only for the current language.public boolean handleKeyDeletion(java.lang.String key)
key - the deleted key.true if the deletion was successful, false otherwise.public boolean hasChanges()
public boolean hasDefaultValues()
public boolean hasDescriptionValues()
public boolean hasDescriptor()
public boolean hasMasterMode()
public boolean isShowOptionsColumn(org.opencms.ui.editors.messagebundle.CmsMessageBundleEditorTypes.EditMode mode)
mode - the edit mode for which the column option is requested.public void publish()
public void save() throws CmsException
CmsException - thrown if saving fails.public void saveAsPropertyBundle() throws java.io.UnsupportedEncodingException, CmsException, java.io.IOException
java.io.UnsupportedEncodingException - thrown if localizations from the XML bundle could not be loaded correctly.CmsException - thrown if any of the interactions with the VFS fails.java.io.IOException - thrown if localizations from the XML bundle could not be loaded correctly.public boolean setEditMode(org.opencms.ui.editors.messagebundle.CmsMessageBundleEditorTypes.EditMode mode)
mode - the edit mode to set.public boolean setLocale(java.util.Locale locale)
locale - the currently edited locale.true if the locale could be set, false otherwise.public void unlock()