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 Object
implements AuthorOperation
Base class for operations that shows a dialog which allows the user to modify
some properties for a table.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AuthorAccessThe current author access.protected TablePropertiesHelperThe 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
ConstructorsConstructorDescriptionShowTablePropertiesBaseOperation(TablePropertiesHelper tableHelper) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancheckRowSpans(List<AuthorElement> collectedRows, int parentType) Check if the selected rows can be moved (row spans don't exceed collected rows range).protected abstract booleancomputeFragmentMoveInsideHeader(List<AuthorDocumentFragment> fragments, List<Position> offsets, TabInfo tabInfo, List<AuthorElement> nodesToModify, AuthorElement currentNode) Computes the fragment and position, inside header element, for the given node.protected abstract booleancomputeFragmentsToMoveInsideBody(List<AuthorDocumentFragment> fragments, List<Position> offsets, TabInfo tabInfo, List<AuthorElement> nodesToModify, AuthorElement currentNode) Computes the fragment and position, inside body element, for the given node.protected abstract booleancomputeFragmentsToMoveInsideFooter(List<AuthorDocumentFragment> fragments, List<Position> offsets, TabInfo tabInfo, List<AuthorElement> nodesToModify, AuthorElement currentNode) Computes the fragment and position, inside footer element, for the given node.voiddoOperation(AuthorAccess authorAccess, ArgumentsMap args) Perform the actual operation.protected TablePropertygetAttrProperty(List<AuthorElement> collectedElements, String detectedAttributeValue, TableProperty currentAttribute) Obtain the table property object for the given attribute.getCategoriesAndProperties(List<Integer[]> selections) Obtain the categories from the table properties dialog.protected StringgetCommonValue(AuthorElement currentElem, String attrQname, String currentValue) Obtain the common value for the given attribute set on the given element.Obtain all the elements with all the modified attributes.Obtain a map with all the fragments which will be modified and the corresponding offsets (the offsets where the fragments will be inserted).protected StringGet the ID of the help page which will be called by the end user.protected EditedTablePropertiesInfo.TAB_TYPEgetSelectedTab(List<Integer[]> selections) Obtain the tab that will be selected in the "Table Properties" dialog.protected abstract List<TableProperty>Obtain the table attributes.protected TabInfogetTableInformation(List<Integer[]> selections) Obtain the information for table tab.voidShows the table properties and process all the modifications.
-
Field Details
-
tableHelper
The table properties helper. -
authorAccess
The current author access.
-
-
Constructor Details
-
ShowTablePropertiesBaseOperation
Constructor.- Parameters:
tableHelper- The table properties helper.
-
-
Method Details
-
doOperation
public void doOperation(AuthorAccess authorAccess, ArgumentsMap args) throws AuthorOperationException Description copied from interface:AuthorOperationPerform 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 theWorkspaceyou may use:AuthorAccess.getWorkspaceAccess().- Specified by:
doOperationin 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:
-
getArguments
- Specified by:
getArgumentsin interfaceAuthorOperation- Returns:
- An array of
ArgumentDescriptorrepresenting the arguments this operation uses. - See Also:
-
showTableProperties
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
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
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:
trueif the rows can be moved.
-
getDescription
- Specified by:
getDescriptionin interfaceExtension- Returns:
- The description of the extension.
- See Also:
-
getFragmentsAndOffsetsToInsert
protected 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
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
nullis there are no properties to edit for table.
-
getAttrProperty
protected TableProperty getAttrProperty(List<AuthorElement> collectedElements, 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
TablePropertyobject for the given attribute.
-
getCommonValue
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
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
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
Obtain the table attributes.- Returns:
- A list with
TablePropertyobjects containing the table attributes qualified name, render string and possible values.
-
computeFragmentMoveInsideHeader
protected abstract boolean computeFragmentMoveInsideHeader(List<AuthorDocumentFragment> fragments, List<Position> offsets, TabInfo tabInfo, 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:
trueif 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(List<AuthorDocumentFragment> fragments, List<Position> offsets, TabInfo tabInfo, 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:
trueif the parent of the given node parent should be also deleted.- Throws:
AuthorOperationException- If the new parent fragment could not be inserted.
-
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.
-