Versions Compared

Key

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

...

Code Block
package hep.aida.ref.plotter.style.registry;

import hep.aida.IPlotterStyle;

public interface IStyleRegistry {    

    // To work with Style Stores
   
    String[] getAvailableStoreNames();
   
    IStyleStore getStore(String storeName);
   
   
    // To work with categories, this can be a separate service
    // Available category keys are filled from Rules of all available Stores
   
    String[] getAvailableCategoryKeys();
   
    String[] getAvailableCategoryValues(String categoryKey);
   
    String getCategoryCurrentValue(String categoryKey);
   
    void setCategoryCurrentValue(String categoryKey, String categoryValue);
   
    // Following methods are used to obtain cumulative IPlotterStyle
    // for particular plotter, region, object, action, and (possibly) categories
   
    IPlotterStyle getStyleForState(IPlotterState state);
}

...

Code Block
package hep.aida.ref.plotter.style.registry;

import hep.aida.IPlotterStyle;

/**
 * This interface can be implemented as "In-Memory" copy of persistent
 * facility, or as keeping live connections and committing any change
 * immediately.
 */

public interface IStyleStore {
   
    // Key for AIDA type of object that the Style is going to be used with
    public static String STYLE_PREVIEW_TYPE = "STYLE_PREVIEW_TYPE";
   
    // Key for Style name
    public static String STYLE_STORE_NAME = "STYLE_STORE_NAME";
           
    String getStoreName();
   
    String getStoreType();
   
    boolean isReadOnly();
   
   
    // Manage Styles
   
    boolean hasStyle(String styleName);
   
    void addStyle(String styleName, IPlotterStyle style);
   
    void addStyle(String styleName, IPlotterStyle style, IStyleRule rule);
   
    IPlotterStyle getStyle(String styleName);
   
    /**
     * Remove Style and Rule associated with it from the Store
     */
    IPlotterStyle removeStyle(String styleName);
   
    String[] getAllStyleNames();
   
   
    // Create new Rule for this Store - Store acts as a Rule Factory
   
    IStyleRule createRule();
   
   
    // Manage Rules - only one rule per style is allowed
   
    IStyleRule getRuleForStyle(String styleName);
   
    void setRuleForStyle(String styleName, IStyleRule rule);
   
    void removeRuleForStyle(String styleName);
   
    /**
     * Write all information from Store to the undelying persistent
     * facility: XML file, database, etc.
     */
    void commit();
          
    /**
     * Close all connections and free all resources.
     * Store is not usable after this method is executed.
     */
    void close();
          
}

...

Code Block
package hep.aida.ref.plotter.style.registry;

public interface IStyleRule {

    public static String PATH = "Path";
    public static String OBJECT = "Object";
    public static String OBJECTTYPE = "ObjectType";
    public static String NULL = "Null";
    public static String ATTRIBUTE = "attribute(\"\")";
    public static String OVERLAYINDEX = "OverlayIndex";
    public static String OVERLAYTOTAL = "OverlayTotal";
    public static String REGIONINDEX = "RegionIndex";
    public static String REGIONTOTAL = "RegionTotal";
       
    String getDescription();
   
    // Evaluates the Rule   
    boolean ruleApplies(IPlotterState state);
}

...

Code Block
package hep.aida.ref.plotter.style.registry;

/**
 * This object encapsulates information about relevant
 * IPlotterRegion, object, and actions.
 * It is used for obtaining implicit IPlotterStyle
 */

import java.util.Map;

public interface IPlotterState {

    static String ATTRIBUTE_KEY_PREFIX = "IPlotterState";
           
    Object getObject();   
    String getObjectPath();
   
    int getOverlayIndex();
    int getOverlayTotal();
   
    int getRegionIndex();
    int getRegionTotal();
   
    String getAttribute(String key);
   
    Map getAttributes();   
   
    void clear();
}