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 Details

    • tableHelper

      protected TablePropertiesHelper tableHelper
      The table properties helper.
    • authorAccess

      protected AuthorAccess authorAccess
      The current author access.
  • Constructor Details

    • ShowTablePropertiesBaseOperation

      public ShowTablePropertiesBaseOperation(TablePropertiesHelper tableHelper)
      Constructor.
      Parameters:
      tableHelper - The table properties helper.
  • Method Details

    • 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 the Workspace you may use: AuthorAccess.getWorkspaceAccess().
      Specified by:
      doOperation in interface AuthorOperation
      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 method AuthorOperation.getArguments() must be present in the map of arguments.
      Throws:
      AuthorOperationException - Thrown when the operation fails.
      See Also:
    • getArguments

      public ArgumentDescriptor[] getArguments()
      Specified by:
      getArguments in interface AuthorOperation
      Returns:
      An array of ArgumentDescriptor representing the arguments this operation uses.
      See Also:
    • 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 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(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 String getDescription()
      Specified by:
      getDescription in interface Extension
      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

      protected TabInfo getTableInformation(List<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(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 TableProperty object for the given attribute.
    • getCommonValue

      protected String getCommonValue(AuthorElement currentElem, String attrQname, 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(List<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 List<TabInfo> getCategoriesAndProperties(List<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 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(List<AuthorDocumentFragment> fragments, List<Position> offsets, TabInfo tabInfo, 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(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:
      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(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:
      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 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.