Interface ConditionalStyles

All Superinterfaces:
Iterable<ConditionalStyle>
All Known Subinterfaces:
Proxy.ConditionalStyles

public interface ConditionalStyles extends Iterable<ConditionalStyle>
Node's or map's conditional-styles table: node.conditionalStyles or node.mindMap.conditionalStyles - read-only.

In the Manage Conditional Styles dialog, it's the entire table. Each row in the table is a separate ConditionalStyle/ConditionalStyleRO.

Actions known from the Manage Conditional Styles dialog can be called on ConditionalStyles

     // add a conditional style to the end of the table
     node.conditionalStyles.add(
       true, // isActive
       "node.text == 'Sunday'", // script
       'styles.important', // styleName
       false) // isLast (aka stop)

     // insert a conditional style at the beginning of the table, with the condition "always"
     node.conditionalStyles.insert(0, true, null, 'defaultstyle.floating', false)

     // move the third conditional style to the top of the table
     node.conditionalStyles.move(2, 0)

     // remove the first conditional style from the table
     node.conditionalStyles.remove(0)

     // remove all, i.e. each ConditionalStyle item
     node.conditionalStyles.each { it.remove() }
 

ConditionalStyles can be iterated over, e.g.

     // get a list of conditional styles (ConditionalStyle items)
     node.conditionalStyles.collect()

     // get a list of conditional styles, each as a string (description)
     node.conditionalStyles.collect { it.toString() }

     // get the number of conditional styles in the table
     node.conditionalStyles.size()

     // get the first conditional style in the table
     node.conditionalStyles[0]

     // find all conditional styles with the style styles.important (aka Important) and deactivate them
     node.conditionalStyles.findAll { it.styleName == 'styles.important' }.each { it.active = false }

     // find the first conditional style with ScriptCondition (aka Script Filter) and remove it
     node.conditionalStyles.find { it.hasScriptCondition() }?.remove()
 
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(boolean isActive, String script, String styleName, boolean isLast)
    Adds a conditional style to the end of the table
    void
    add(ConditionalStyleRO conditionalStyle)
    Adds a copy of conditionalStyle to the end of the table.
    void
    insert(int position, boolean isActive, String script, String styleName, boolean isLast)
    Inserts a conditional style at the specified position.
    void
    insert(int position, ConditionalStyleRO conditionalStyle)
    Inserts a copy of conditionalStyle at the specified position.
    void
    move(int position, int toPosition)
    Moves the conditional style found at position to toPosition
    remove(int position)
    It can be used to move a conditional style between nodes or between maps.

    Methods inherited from interface java.lang.Iterable

    forEach, iterator, spliterator
  • Method Details

    • add

      void add(boolean isActive, String script, String styleName, boolean isLast)
      Adds a conditional style to the end of the table
      Throws:
      IllegalArgumentException - if styleName is not found
      Since:
      1.11.1
    • add

      void add(ConditionalStyleRO conditionalStyle)
      Adds a copy of conditionalStyle to the end of the table. It can be used to copy a conditional style between nodes or between maps.
      Since:
      1.11.1
    • insert

      void insert(int position, boolean isActive, String script, String styleName, boolean isLast)
      Inserts a conditional style at the specified position.
      Throws:
      IllegalArgumentException - if styleName is not found
      Since:
      1.11.1
    • insert

      void insert(int position, ConditionalStyleRO conditionalStyle)
      Inserts a copy of conditionalStyle at the specified position. It can be used to copy a conditional style between nodes or between maps.
      Since:
      1.11.1
    • move

      void move(int position, int toPosition)
      Moves the conditional style found at position to toPosition
      Since:
      1.11.1
    • remove

      ConditionalStyle remove(int position)
      It can be used to move a conditional style between nodes or between maps.
           def cStyle = node.conditionalStyles.remove(0)
           node.parent.conditionalStyles.add(cStyle)
       
      Returns:
      the removed ConditionalStyle
      Since:
      1.11.1