Class ShowTablePropertiesBaseOperation
- java.lang.Object
-
- ro.sync.ecss.extensions.commons.table.properties.ShowTablePropertiesBaseOperation
-
- All Implemented Interfaces:
AuthorOperation
,Extension
- Direct Known Subclasses:
CALSAndHTMLShowTablePropertiesBase
,RelTableShowPropertiesOperation
,SimpleTableShowPropertiesOperationBase
@API(type=INTERNAL, src=PUBLIC) public abstract class ShowTablePropertiesBaseOperation extends java.lang.Object implements AuthorOperation
Base class for operations that shows a dialog which allows the user to modify some properties for a table.
-
-
Field Summary
Fields Modifier and Type Field Description protected AuthorAccess
authorAccess
The current author access.protected TablePropertiesHelper
tableHelper
The table properties helper.-
Fields inherited from interface ro.sync.ecss.extensions.api.AuthorOperation
NAMESPACE_ARGUMENT, NAMESPACE_ARGUMENT_DESCRIPTOR, SCHEMA_AWARE_ARGUMENT, SCHEMA_AWARE_ARGUMENT_DESCRIPTOR
-
-
Constructor Summary
Constructors Constructor Description ShowTablePropertiesBaseOperation(TablePropertiesHelper tableHelper)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
checkRowSpans(java.util.List<AuthorElement> collectedRows, int parentType)
Check if the selected rows can be moved (row spans don't exceed collected rows range).protected abstract boolean
computeFragmentMoveInsideHeader(java.util.List<AuthorDocumentFragment> fragments, java.util.List<javax.swing.text.Position> offsets, TabInfo tabInfo, java.util.List<AuthorElement> nodesToModify, AuthorElement currentNode)
Computes the fragment and position, inside header element, for the given node.protected abstract boolean
computeFragmentsToMoveInsideBody(java.util.List<AuthorDocumentFragment> fragments, java.util.List<javax.swing.text.Position> offsets, TabInfo tabInfo, java.util.List<AuthorElement> nodesToModify, AuthorElement currentNode)
Computes the fragment and position, inside body element, for the given node.protected abstract boolean
computeFragmentsToMoveInsideFooter(java.util.List<AuthorDocumentFragment> fragments, java.util.List<javax.swing.text.Position> offsets, TabInfo tabInfo, java.util.List<AuthorElement> nodesToModify, AuthorElement currentNode)
Computes the fragment and position, inside footer element, for the given node.void
doOperation(AuthorAccess authorAccess, ArgumentsMap args)
Perform the actual operation.ArgumentDescriptor[]
getArguments()
protected TableProperty
getAttrProperty(java.util.List<AuthorElement> collectedElements, java.lang.String detectedAttributeValue, TableProperty currentAttribute)
Obtain the table property object for the given attribute.protected abstract java.util.List<TabInfo>
getCategoriesAndProperties(java.util.List<java.lang.Integer[]> selections)
Obtain the categories from the table properties dialog.protected java.lang.String
getCommonValue(AuthorElement currentElem, java.lang.String attrQname, java.lang.String currentValue)
Obtain the common value for the given attribute set on the given element.java.lang.String
getDescription()
protected java.util.List<TabInfo>
getElementsWithModifiedAttributes(EditedTablePropertiesInfo tableInfo)
Obtain all the elements with all the modified attributes.protected java.util.List<TabInfo>
getFragmentsAndOffsetsToInsert(EditedTablePropertiesInfo tableInfo)
Obtain a map with all the fragments which will be modified and the corresponding offsets (the offsets where the fragments will be inserted).protected java.lang.String
getHelpPageID()
Get the ID of the help page which will be called by the end user.protected EditedTablePropertiesInfo.TAB_TYPE
getSelectedTab(java.util.List<java.lang.Integer[]> selections)
Obtain the tab that will be selected in the "Table Properties" dialog.protected abstract java.util.List<TableProperty>
getTableAttribute()
Obtain the table attributes.protected TabInfo
getTableInformation(java.util.List<java.lang.Integer[]> selections)
Obtain the information for table tab.void
showTableProperties(ArgumentsMap args)
Shows the table properties and process all the modifications.
-
-
-
Field Detail
-
tableHelper
protected TablePropertiesHelper tableHelper
The table properties helper.
-
authorAccess
protected AuthorAccess authorAccess
The current author access.
-
-
Constructor Detail
-
ShowTablePropertiesBaseOperation
public ShowTablePropertiesBaseOperation(TablePropertiesHelper tableHelper)
Constructor.- Parameters:
tableHelper
- The table properties helper.
-
-
Method Detail
-
doOperation
public void doOperation(AuthorAccess authorAccess, ArgumentsMap args) throws AuthorOperationException
Description copied from interface:AuthorOperation
Perform the actual operation. You can check if the operation was invoked from the oXygen standalone application or from the oXygen plugin for Eclipse by using the method:ApplicationInformationAccess.getPlatform()
. To get to theWorkspace
you may use:AuthorAccess.getWorkspaceAccess()
.- Specified by:
doOperation
in interfaceAuthorOperation
- Parameters:
authorAccess
- The author access. Provides access to specific informations and actions for editor, document, workspace, tables, change tracking, utility a.s.o.args
- The map of arguments. All the arguments defined by methodAuthorOperation.getArguments()
must be present in the map of arguments.- Throws:
AuthorOperationException
- Thrown when the operation fails.- See Also:
AuthorOperation.doOperation(ro.sync.ecss.extensions.api.AuthorAccess, ro.sync.ecss.extensions.api.ArgumentsMap)
-
getArguments
public ArgumentDescriptor[] getArguments()
- Specified by:
getArguments
in interfaceAuthorOperation
- Returns:
- An array of
ArgumentDescriptor
representing the arguments this operation uses. - See Also:
AuthorOperation.getArguments()
-
showTableProperties
public void showTableProperties(ArgumentsMap args) throws AuthorOperationException
Shows the table properties and process all the modifications.- Parameters:
args
- the arguments the operation was invoked with.- Throws:
AuthorOperationException
- When the action cannot be performed.
-
getElementsWithModifiedAttributes
protected java.util.List<TabInfo> getElementsWithModifiedAttributes(EditedTablePropertiesInfo tableInfo)
Obtain all the elements with all the modified attributes.- Parameters:
tableInfo
- The obtained table information from the table properties dialog.- Returns:
- A map containing all the elements whose attributes will be modified and the corresponding attributes.
-
checkRowSpans
protected boolean checkRowSpans(java.util.List<AuthorElement> collectedRows, int parentType)
Check if the selected rows can be moved (row spans don't exceed collected rows range).- Parameters:
collectedRows
- The rows to be checked.parentType
- The type of the parent element.- Returns:
true
if the rows can be moved.
-
getDescription
public java.lang.String getDescription()
- Specified by:
getDescription
in interfaceExtension
- Returns:
- The description of the extension.
- See Also:
Extension.getDescription()
-
getFragmentsAndOffsetsToInsert
protected java.util.List<TabInfo> getFragmentsAndOffsetsToInsert(EditedTablePropertiesInfo tableInfo) throws AuthorOperationException
Obtain a map with all the fragments which will be modified and the corresponding offsets (the offsets where the fragments will be inserted).- Parameters:
tableInfo
- The obtained table information from the table properties dialog.- Returns:
- a list tab info objects which contains all the fragments which will be modified and the corresponding offsets (the offsets where the fragments will be inserted).
- Throws:
AuthorOperationException
-
getTableInformation
protected TabInfo getTableInformation(java.util.List<java.lang.Integer[]> selections)
Obtain the information for table tab. This information will contain the properties which will be edited, the table elements on which those properties applies and some context information.- Parameters:
selections
- The list with the selection intervals.- Returns:
- The tab info object or
null
is there are no properties to edit for table.
-
getAttrProperty
protected TableProperty getAttrProperty(java.util.List<AuthorElement> collectedElements, java.lang.String detectedAttributeValue, TableProperty currentAttribute)
Obtain the table property object for the given attribute.- Parameters:
collectedElements
- The list of all rows which will be edited.detectedAttributeValue
- Current value of the attribute. It is the value set on the element(s).currentAttribute
- The current attribute.- Returns:
- a
TableProperty
object for the given attribute.
-
getCommonValue
protected java.lang.String getCommonValue(AuthorElement currentElem, java.lang.String attrQname, java.lang.String currentValue)
Obtain the common value for the given attribute set on the given element.- Parameters:
currentElem
- The element to check for given attribute.attrQname
- The attribute qualified name.currentValue
- The currently computed common value for the given attribute.- Returns:
- The common value between the given value and the attribute values set on the given element.
-
getSelectedTab
protected EditedTablePropertiesInfo.TAB_TYPE getSelectedTab(java.util.List<java.lang.Integer[]> selections)
Obtain the tab that will be selected in the "Table Properties" dialog.- Parameters:
selections
- The currently selected nodes or the node at caret position.- Returns:
- the tab that will be selected in the "Table Properties" dialog.
-
getCategoriesAndProperties
protected abstract java.util.List<TabInfo> getCategoriesAndProperties(java.util.List<java.lang.Integer[]> selections)
Obtain the categories from the table properties dialog. The categories maps the tab name to the list of properties that will be modified in the corresponding tab panel. Every property will be modified using a combobox/radios which will contain the possible values for that property. The label string for the combobox/radios group will be the provided render string of the property or the property name, if a render string is not provided.- Parameters:
selections
- The currently selected nodes or the node at caret position.- Returns:
- A list of tab info objects containing the tab names and the corresponding properties list.
-
getTableAttribute
protected abstract java.util.List<TableProperty> getTableAttribute()
Obtain the table attributes.- Returns:
- A list with
TableProperty
objects containing the table attributes qualified name, render string and possible values.
-
computeFragmentsToMoveInsideFooter
protected abstract boolean computeFragmentsToMoveInsideFooter(java.util.List<AuthorDocumentFragment> fragments, java.util.List<javax.swing.text.Position> offsets, TabInfo tabInfo, java.util.List<AuthorElement> nodesToModify, AuthorElement currentNode) throws AuthorOperationException
Computes the fragment and position, inside footer element, for the given node.- Parameters:
fragments
- A list with already computed fragments. The new fragment will be added to this list.offsets
- A list with positions where the given fragments will be inserted.tabInfo
- The current edited tab info.nodesToModify
- A list containing all the nodes that will be deleted.currentNode
- The node to be checked if it should be moved.- Returns:
true
if the parent of the given node parent should be also deleted.- Throws:
AuthorOperationException
- If the new parent fragment could not be inserted.
-
computeFragmentMoveInsideHeader
protected abstract boolean computeFragmentMoveInsideHeader(java.util.List<AuthorDocumentFragment> fragments, java.util.List<javax.swing.text.Position> offsets, TabInfo tabInfo, java.util.List<AuthorElement> nodesToModify, AuthorElement currentNode) throws AuthorOperationException
Computes the fragment and position, inside header element, for the given node.- Parameters:
fragments
- A list with already computed fragments. The new fragment will be added to this list.offsets
- A list with positions where the given fragments will be inserted.tabInfo
- The current edited tab info.nodesToModify
- A list containing all the nodes that will be deleted.currentNode
- The node to be checked if it should be moved.- Returns:
true
if the parent of the given node parent should be also deleted.- Throws:
AuthorOperationException
- If the new parent fragment could not be inserted.
-
computeFragmentsToMoveInsideBody
protected abstract boolean computeFragmentsToMoveInsideBody(java.util.List<AuthorDocumentFragment> fragments, java.util.List<javax.swing.text.Position> offsets, TabInfo tabInfo, java.util.List<AuthorElement> nodesToModify, AuthorElement currentNode) throws AuthorOperationException
Computes the fragment and position, inside body element, for the given node.- Parameters:
fragments
- A list with already computed fragments. The new fragment will be added to this list.offsets
- A list with positions where the given fragments will be inserted.tabInfo
- The current edited tab info.nodesToModify
- A list containing all the nodes that will be deleted.currentNode
- The node to be checked if it should be moved.- Returns:
true
if the parent of the given node parent should be also deleted.- Throws:
AuthorOperationException
- If the new parent fragment could not be inserted.
-
getHelpPageID
protected java.lang.String getHelpPageID()
Get the ID of the help page which will be called by the end user.- Returns:
- the ID of the help page which will be called by the end user or
null
.
-
-