JoiMint Graphical objects and their XML configuration files Piotr K. Bartkiewicz, DESY, MST-1
Agenda Only graphical aspects of the JoiMint project! JoiMint graphical objects: a short overview Graphical Objects – implementation VisibleObject: a base class functionality JoiButton – an example of JoiMint Graphical Object LoadableObject interface An example of XML configuration file Final remarks
JoiMint Graphical Objects By design: two base types of objects: –Object container: a frame, which contains other graphical objects (including object containers) –Visible objects: plots, buttons, text fields etc. User can create his synoptic table by adding graphical objects to object container, and afterwards, by locating, resizing, and setting object properties The synoptic table project is stored as an XML file Configuration of object container knows the list of contained objects Each graphical object is capable to generate the XML section, which describes his properties Each graphical object is capable to parse his XML description
Graphical Objects - implementation Object container: public class ObjContainerFrame extends JFrame implements LoadableObject Visible Object: public abstract class VisibleObj extends JPanel implements LoadableObject questionable approach
VisibleObject: a base class functionality Connection to the JoiMint registry Handling “own” XML section –Content Handler for SAX parser, automatic properties ( “joi” properties) recognition and execution (java.lang.reflect*) –AutoConfig: an XML section is generated automatically Important feature, which makes the JoiMint ‘open’, new objects can be added just by delivering a jar file Connection to the ObjectContainer Standard actions like: move, resize, copy, paste, delete “Right mouse click” menu Property list missing: property window, which might offer easier property manipulation than a ‘default’ property table
JoiButton – an example of JoiMint Graphical Object public class JoiButton extends VisibleObj implements LoadableObject { JButton b; JoiButton(ObjContainerFrame parentFrame) { super(parentFrame); Text.setDefault("JoiButton"); Value.setCanBeActive(); setDefaultSize(120, 50);//default joiSetText(getTypeName()); b = new JButton(); add(b); b.addMouseListener(new MouseAction()); MainFrame.propertyTableShow(this, false); } public void setSize(int width, int height) { super.setSize(width,height); b.setBounds(5,5,width-10,height-25); } VisibleObject base JButton JoiButton
import java.io.*; import java.util.Vector; interface LoadableObject { public void saveConfig(IndentOutputStreamWriter sw) throws IOException; public void saveConfig(File file) throws IOException; public int loadConfig(XmlProcessor xp, String closingTag) throws Exception; public String getTypeName(); public Vector getProperties(); public Property getProperty(String propName); public void addProperty(Property p); public void propertyChanged(Property p, int changeCode ); public void destroy(); // all below might be a part of another inetrface, eg. AutoConfiguarbleObject Interface public void joiSetText(String text); public void joiSetX(String x); public void joiSetY(String y); public void joiSetWidth(String w); public void joiSetHeight(String h); public void joiSetName( String name ); public void joiSetParentName( String pname ); public void joiSetValue( String value ); public String joiGetName(); public String joiGetParentName(); public String joiGetText(); public String joiGetX(); public String joiGetY(); public String joiGetWidth(); public String joiGetHeight(); public String joiGetValue(); }
Final remarks Probably correct: –concept of object containers and visible objects –concept of parsing the XML configuration file To be considered: –implementation of VisibleObjects. –implementation of ObjectContainers: run/edit mode? Wrong or missing: –not enough time/discussions about object relationships, inheritance, interfaces –a language for project description, object relationships, interactions etc. (UML?) –documentation generation tools