Writing Widgets & Custom Script API for BOY Xihui Chen

Slides:



Advertisements
Similar presentations
Engr 691 Special Topics in Engineering Science Software Architecture Spring Semester 2004 Lecture Notes.
Advertisements

An Interactive XY Graph Plugin for SWT and GEF Applications
Software Engineering Implementation Lecture 3 ASPI8-4 Anders P. Ravn, Feb 2004.
1 Drawing C Sc 335 Object-Oriented Programming and Design Rick Mercer.
Apache Struts Technology
Introduction to Eclipse plugin development for CSU 670 course project, Selector language (Xaspect) editor plugin implementation.
GUI and Swing, part 2 The illustrated edition. Scroll bars As we have previously seen, a JTextArea has a fixed size, but the amount of text that can be.
Agenda What is BIRT? BIRT Features and Report Gallery Scripting BIRT
Advanced Object-Oriented Programming Features
Presented by IBM developer Works ibm.com/developerworks/ 2006 January – April © 2006 IBM Corporation. Making the most of Creating Eclipse plug-ins.
Java Review Structure of a graphics program. Computer Graphics and User Interfaces Java is Object-Oriented A program uses objects to model the solution.
Managed by UT-Battelle for the Department of Energy Kay Kasemir, Xihui Chen ORNL/SNS 2012, April at SLAC Eclipse Products, Features, Plugins,
UNIT-V The MVC architecture and Struts Framework.
Presented by…. Group 2 1. Programming language 2Introduction.
WebOPI -Build & Setup Xihui Chen April, 2013.
11. Java-Based Web: JSP, JSF. 2 Motto: Rule 1: Our client is always right Rule 2: If you think our client is wrong, see Rule 1. - Anonymous.
Control System Studio (CSS)‏ Kunal Shroff EPICS Training Meeting 07/10/2010.
Java Beans.
Using JavaBeans and Custom Tags in JSP Lesson 3B / Slide 1 of 37 J2EE Web Components Pre-assessment Questions 1.The _____________ attribute of a JSP page.
Deutsches Elektronen-Synchrotron DESY Helmholtz Association of German Research Centres Hamburg, Germany The European X-Ray Laser Project.
© 2006 IBM Corporation IBM WebSphere Portlet Factory Architecture.
Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter.
ECE 452 / CS 446 / SE464 Design Patterns: Part 2 - Answers A Tutorial By Peter Kim Partially based on the tutorial by Michał Antkiewicz.
Anti Orgla, Nortal AS Spring Framework
Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse.
Struts2 Plugin Development - Extending Struts2 Justin Yip.
Graph Visualization Plug-in for Eclipse Gong Jun CCIS Northeastern Univ 10/2003 How To Finish your Project within Four Weeks.
Ontology Engineering and Plugin Development with the NeOn Toolkit Plug-in Development for the NeOn Toolkit June 1st, 2008 Michael Erdmann, Peter Haase,
Jan Hatje, DESY CSS ITER March 2009: Technology and Interfaces XFEL The European X-Ray Laser Project X-Ray Free-Electron Laser 1 CSS – Control.
Control System Studio (CSS) Overview Kay Kasemir, July 2009.
Prachi Chitnis.  The CSS feel  SDS – Synoptic Display Studio  ADL Converter  PV table, Probe…
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS Jan Control System Studio, CSS Overview.
1 Chapter 12: Form Builder Objects and Flexible Code.
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS With slides from Xihui Chen May 2014 Control System Studio Training.
Present by Wu Kun-Tse Simplifying Preference Pages with Field Editors.
ModelPedia Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites Centro de Informática – CIn/UFPe ORCAS Group Eclipse GMF Fábio M. Pereira.
CSS – Control System Studio
Managed by UT-Battelle for the Department of Energy CSS Update Matthias Clausen, Helge Rickens, Jan Hatje and DESY Delphy Armstrong, Xihui Chen,
Java Beans. Definitions A reusable software component that can be manipulated visually in a ‘builder tool’. (from JavaBean Specification) The JavaBeans.
WebOPI -Bring BOY OPI to the Web and Mobile Xihui Chen, Kay Kasemir Spring 2012 EPICS Meeting.
Not Yet Another EPICS Display Manager!? Kay Kasemir, Xihui Chen Kobe EPICS Meeting October.
JSP BASICS AND ARCHITECTURE. Goals of JSP Simplify Creation of dynamic pages. Separate Dynamic and Static content.
Plug-in Architectures Presented by Truc Nguyen. What’s a plug-in? “a type of program that tightly integrates with a larger application to add a special.
Jan Hatje, DESY CSS GSI Feb. 2009: Technology and Interfaces XFEL The European X-Ray Laser Project X-Ray Free-Electron Laser 1 CSS – Control.
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS A lot of material from Nadine Utzel, ITER and BOY online help.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
Modern Programming Language. Web Container & Web Applications Web applications are server side applications The most essential requirement.
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS Jan Control System Studio Training - Extension Points:
X-RAY. A java project can be scanned for instances of design patterns The results are represented in a table – design pat- tern participants are associated.
Contribute to CSS Xihui Chen April, 2013.
Processing == Java + Extra Utilities Processing Adds: – Drawing functions – Text and font manipulations – Image and video – 3D transformations – Keyboard.
By Jonathan Smith. Road Map Introduction Company Information Project Overview Java Web Design and Development Summary Relation to IUP Acknowledgments.
BOY, A Modern Graphical Operator Interface Editor and Runtime Xihui Chen, Kay Kasemir RAD Control Group.
ECLIPSE RICH CLIENT PLATFORM Part 1 Introduction.
The Holmes Platform and Applications
Automata Editor Tool with GEF and EMF
Athanasios Topaloudis 3rd Forum 15/02/2017
Google Web Toolkit Tutorial
Java Servlets By: Tejashri Udavant..
Play Framework: Introduction
Internet and Java Foundations, Programming and Practice
GUI Components Part II.
Architecture, Components, Configuration
JavaServer Faces: The Fundamentals
Advanced Programming in Java
CMPE 135: Object-Oriented Analysis and Design March 14 Class Meeting
Display Builder Update
Plug-In Architecture Pattern
Presentation transcript:

Writing Widgets & Custom Script API for BOY Xihui Chen

2Managed by UT-Battelle for the U.S. Department of Energy BOY Architecture Abstract Widget Macro GEF Properties Utility PV Eclipse OPI Editor PaletteNavigator Outline Console Toolbar Properties Sheet Context Menu Script Engine Actions OPI Runtime Toolbar Context Menu Console XML Reader & Writer Color & Font Macro BOY Framework CSS Platform

3Managed by UT-Battelle for the U.S. Department of Energy MVC Pattern All BOY widgets should follow Model-View-Controller Pattern – Separate responsibilities – Decouple complexity – Increase flexibility – Code reuse

4Managed by UT-Battelle for the U.S. Department of Energy Widget Model Definition – Defines the set of properties – Stores the according values – Only properties in model will be persisted to.opi file Implementation – All widgets model must subclass org.csstudio.opibuilder.model.AbstractWidgetModel – All PV widgets should subclass org.csstudio.opibuilder.model.AbstractPVWidgetModel – All Container Widgets must subclass org.csstudio.opibuilder.model.AbstractContainerModel

5Managed by UT-Battelle for the U.S. Department of Energy Widget Model Example public class SimpleBarGraphModel extends AbstractPVWidgetModel{ /** Lower limit of the widget. */ public static final String PROP_MIN = "max"; //$NON-NLS-1$ /** Higher limit of the widget. */ public static final String PROP_MAX = "min"; //$NON-NLS-1$ public final String ID = "org.csstudio.opibuilder.widgetExample.SimpleBarGraph"; //$NON-NLS-1$ /** * Initialize the properties when the widget is first created. */ public SimpleBarGraphModel() { setForegroundColor(new RGB(255, 0, 0)); setBackgroundColor(new RGB(0,0,255)); setSize(50, 100); protected void configureProperties() { addProperty(new DoubleProperty(PROP_MIN, "Min", WidgetPropertyCategory.Behavior, 0)); addProperty(new DoubleProperty(PROP_MAX, "Max", WidgetPropertyCategory.Behavior, 100)); public String getTypeID() { return ID; }... }

6Managed by UT-Battelle for the U.S. Department of Energy Widget Properties Currently supported property types: Create your own property type by extending org.csstudio.opibuilder.properties.AbstractWidgetProperty Property TypeExample Properties Boolean PropertyEnabled, Visible Integer PropertyHeight, Width, X, Y Double PropertyMeter.Level HIHI, Meter.Maximum Combo PropertyBorder Style String PropertyName, PV Name, Text Color PropertyBackground Color, Foreground Color Font PropertyFont File Path PropertyImage.Image File, Linking Container.OPI File PointList PropertyPolyline.Points, Polygon.Points Macros PropertyMacros ColorMap PropertyIntensityGraph.Color Map String List PropertyItems Rules PropertyRules Actions PropertyActions Scripts PropertyScripts

7Managed by UT-Battelle for the U.S. Department of Energy Widget Figure (View) Definition – The graphical representation of the widget – No dependency on model and controller. – It should be autonomous, which means it should have its own behavior independent from model and controller Implementation – All widgets figure must be an instance of org.eclipse.draw2d.IFigure – In most cases, just subclass org.eclipse.draw2d.Figure or other existing figures will make it easier

8Managed by UT-Battelle for the U.S. Department of Energy Widget Figure(cont’d) To use SWT widgets, subclass org.csstudio.opibuilder.widgets.figures.AbstractSWTWidgetFigure – Example: combo, web browser, table widget in BOY You may use SWT_AWT bridge to use Swing widget in BOY

9Managed by UT-Battelle for the U.S. Department of Energy Available Figure Resources A widget figure can be assembled from several other figures, so you can reuse exist figures: – org.csstudio.swt.xygraph Linear Scale SWT XYGraph – org.csstudio.swt.widgets Round Scale Existing Widgets

10Managed by UT-Battelle for the U.S. Department of Energy Widget Figure Example public class SimpleBarGraphFigure extends Figure { private double min =0; private double max = 100; private double value = protected void paintClientArea(Graphics graphics) { super.paintClientArea(graphics); //fill background rectangle graphics.setBackgroundColor(getBackgroundColor()); graphics.fillRectangle(getClientArea()); //fill foreground rectangle which show the value's position graphics.setBackgroundColor(getForegroundColor()); //coerce drawing value in range double coercedValue = value; if(value < min) coercedValue = min; else if (value > max) coercedValue = max; int valueLength = (int) ((coercedValue-min)*getClientArea().height/(max-min)); graphics.fillRectangle(getClientArea().x, getClientArea().y + getClientArea().height -valueLength, getClientArea().width, valueLength); } public void setValue(double value) { this.value = value; repaint(); } public double getValue() { return value; }... }

11Managed by UT-Battelle for the U.S. Department of Energy Widget Editpart (Controller) Definition – The coordinator between model and view – Responsible for the behavior of the widget when properties value changed Implementation – All widgets editpart must subclass org.csstudio.opibuilder.editparts.AbstractWidgetEditPart – All PV widgets should subclass org.csstudio.opibuilder.editparts.AbstractPVWidgetEditPart – All Container Widgets must subclass org.csstudio.opibuilder.editparts.AbstractContainerEditpart

12Managed by UT-Battelle for the U.S. Department of Energy Widget Editpart Example public class SimpleBarGraphEditpart extends AbstractPVWidgetEditPart { /** * Create and initialize figure. protected IFigure doCreateFigure() { SimpleBarGraphFigure figure = new SimpleBarGraphFigure(); figure.setMin(getWidgetModel().getMin()); figure.setMax(getWidgetModel().getMax()); return figure; protected void registerPropertyChangeHandlers() { // The handler when PV value changed. IWidgetPropertyChangeHandler valueHandler = new IWidgetPropertyChangeHandler() { public boolean handleChange(final Object oldValue, final Object newValue, final IFigure figure) { if(newValue == null) return false; ((SimpleBarGraphFigure) figure).setValue(ValueUtil.getDouble((IValue)newValue)); return false; } }; setPropertyChangeHandler(AbstractPVWidgetModel.PROP_PVVALUE, valueHandler); //The handler when max property value changed. IWidgetPropertyChangeHandler maxHandler = new IWidgetPropertyChangeHandler() { public boolean handleChange(Object oldValue, Object newValue, IFigure figure) { ((SimpleBarGraphFigure) figure).setMax((Double)newValue); return false; } }; setPropertyChangeHandler(SimpleBarGraphModel.PROP_MAX, maxHandler); … } … }

13Managed by UT-Battelle for the U.S. Department of Energy Register the widget with BOY Use the standard Eclipse extension point mechanism Extension point: org.csstudio.opibuilder.widget

14Managed by UT-Battelle for the U.S. Department of Energy Integrate the widget with CSS CSS Developer – Include the widget plugin into your build CSS User – Export it to a deployable Plugin JAR file and copy it to your CSS dropins folder

15Managed by UT-Battelle for the U.S. Department of Energy Example Follow steps on – BOY online help->Creating Customized Widget

16Managed by UT-Battelle for the U.S. Department of Energy Create Custom Script API Purpose: call your own Java API from BOY scripts – For example, retrieve data from MySQL database and display the data on BOY widgets. Technology: Eclipse Fragment – A fragment on host of org.csstudio.opibuilder plugin will be recognized as part of the host – It allows adding third party libraries or plugins – Add static method to your utility class – Export the package from MANIFEST.MF/Runtime page

17Managed by UT-Battelle for the U.S. Department of Energy Example Follow steps on – BOY online help-> Script->Creating Custom ScriptUtil

18Managed by UT-Battelle for the U.S. Department of Energy Summary BOY Widgets – All BOY widgets must follow the MVC pattern – Each widget should have at least three classes: Model, Editpart and Figure – Using Eclipse extension point to register widgets with BOY – Glad to have your widgets included in BOY as standard widgets contact Custom Script API – Use Fragment on host of org.csstudio.opibuilder Thank you!