Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
public interface IStyleRegistry {
   
    // Following methods are used for setup and save/restore of IStyleRegistry
   
    void addStyle(String styleName, IPlotterStyle style);
   
    boolean hasStyle(String styleName);
   
    IPlotterStyle getStyle(String styleName);
   
    String[] getAllNames();
   
    IStyleRule[] getRulesForStyle(String styleName);
   
    void addRuleForStyle(String styleName, IStyleRule rule);
   
    void setRuleForStyle(String styleName, IStyleRule rule);
   
    void removeRuleForStyle(String styleName, IStyleRule rule);
   
    void removeAllRulesForStyle(String styleName);
   
   
    // Following methods are used to obtain cumulative IPlotterStyle
    // for particular region, object, action, and actioncategory
   
    IPlotterStyle getStyleForState(IPlotterState state);
}

IStyleRule interface:

Style Rule has type and value. Also it has a priority - defines the order in which Style that corresponds to this Rule will be used if Rule does apply.

Code Block
public interface IStyleRule {           // Possible types of Style Rules
    static int CLASS    CLASS     = 0;  // Class of the object: hep.aida.IHistogram1D
    static int PATH        = 1;  // Position of the object in a Tree
    static int ORDER    ORDER     = 2;  // Order in the IPlotterRegion: specific number, or cyclical
    static int ACTION     = 3;  // What is going to happen with the object: plotting, printing
    static int CATEGORY = 4;  // "experiment=GLAST", "quality=preliminary"
                              // ACTION seems like a sub-type of CATEGORY: "printing=true"        int getType();
   
    /**
     * Priority determines the order in which corresponding IPlotterStyle
     * should be used when assembling the cumulative IPlotterStyle
     */
    int getPriority();
   
    String getValue();
   
    /**
     * Determines if this rule should be used.
     *
     * If type=CATEGORY, same rule as for AIDA options should be applied:
     * have to pass "key=value" pair as value, for only "key" -> "key=true",
     */
    boolean ruleApplies(int type, String value);
   
    /**
     * Or maybe it is better to hide all this type/"key=value" complexity and do this:
     */
    boolean ruleApplies(IPlotterState state);
}

...