Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/TemperatureJPanel.java URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/TemperatureJPanel.java?rev=189764&view=auto ============================================================================== --- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/TemperatureJPanel.java (added) +++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/TemperatureJPanel.java Thu Jun 9 08:03:19 2005 @@ -0,0 +1,326 @@ +package org.apache.wsdm.interop.wcm.impl.ui; + +import javax.swing.JPanel; +import javax.swing.JFrame; +import java.awt.Dimension; + + +import javax.swing.JLabel; +import java.awt.FlowLayout; +import javax.swing.SwingConstants; +import javax.swing.JProgressBar; + +import org.jfree.chart.ChartFactory; +import org.jfree.chart.ChartPanel; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.plot.CategoryPlot; +import org.jfree.chart.plot.Plot; +import org.jfree.chart.plot.PlotOrientation; +import org.jfree.data.category.DefaultIntervalCategoryDataset; +import org.jfree.data.xy.CategoryTableXYDataset; +import org.jfree.data.xy.XYDataset; +import org.jfree.data.xy.XYSeries; +import org.jfree.data.xy.XYSeriesCollection; + +import java.awt.BorderLayout; +import java.util.Date; +import java.awt.GridLayout; +import java.awt.Insets; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +/** +* This code was generated using CloudGarden's Jigloo +* SWT/Swing GUI Builder, which is free for non-commercial +* use. If Jigloo is being used commercially (ie, by a corporation, +* company or business for any purpose whatever) then you +* should purchase a license for each developer using Jigloo. +* Please visit www.cloudgarden.com for details. +* Use of Jigloo implies acceptance of these licensing terms. +* ************************************* +* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED +* for this machine, so Jigloo or this code cannot be used legally +* for any corporate or commercial purpose. +* ************************************* +*/ +public class TemperatureJPanel extends javax.swing.JPanel { + private JLabel jLabelTemperature; + private JPanel jPanelChartContainer; + private JPanel jPanelThermometer; + private JLabel jLabelOneTwenty; + private JLabel jLabelStatusValue; + private JLabel jLabelFifty; + private JLabel jLabelZero; + private JLabel jLabelStatus; + private JLabel jLabelCostValue; + private JLabel jLabelCost; + private JLabel jLabelStationNameValue; + private JLabel jLabelStationName; + private JPanel jPanelData; + private JProgressBar jProgressBarTemp; + private ChartPanel jPanelChart; + private int interval=100; + private XYSeries series; + private int tickCount; + + + /** + * Auto-generated main method to display this + * JPanel inside a new JFrame. + */ + public static void main(String[] args) { + JFrame frame = new JFrame(); + frame.getContentPane().add(new TemperatureJPanel()); + frame.pack(); + frame.show(); + } + + public TemperatureJPanel() { + super(); + initGUI(); + addChart(); + } + + /** + * + */ + private void addChart() { + series = new XYSeries("Temperature"); + XYDataset xyDataset=new XYSeriesCollection(series); + JFreeChart chart=ChartFactory.createTimeSeriesChart("History","Time","Temperature", + xyDataset,false,false,false); + //chart.getXYPlot() + jPanelChart=new ChartPanel(chart); + jPanelChart.setOpaque(false); + + jPanelChartContainer.add(jPanelChart); + + } + + private void initGUI() { + try { + this.setPreferredSize(new java.awt.Dimension(400, 372)); + GridBagLayout thisLayout = new GridBagLayout(); + thisLayout.columnWeights = new double[] {0.1,0.1,0.1,0.1}; + thisLayout.columnWidths = new int[] {7,7,7,7}; + thisLayout.rowWeights = new double[] {0.1,0.1,0.1,0.1}; + thisLayout.rowHeights = new int[] {7,7,7,7}; + this.setLayout(thisLayout); + { + jLabelTemperature = new JLabel(); + this.add(jLabelTemperature, new GridBagConstraints( + 0, + 0, + 1, + 1, + 0.0, + 0.1, + GridBagConstraints.CENTER, + GridBagConstraints.NONE, + new Insets(0, 15, 0, 0), + 0, + 0)); + jLabelTemperature.setText("?? ° F"); + jLabelTemperature.setFont(new java.awt.Font("Dialog",1,36)); + jLabelTemperature.setBounds(7, 9, 107, 47); + jLabelTemperature.setHorizontalAlignment(SwingConstants.CENTER); + } + { + jPanelData = new JPanel(); + this.add(jPanelData, new GridBagConstraints( + 1, + 0, + 3, + 1, + 0.0, + 0.1, + GridBagConstraints.CENTER, + GridBagConstraints.HORIZONTAL, + new Insets(0, 0, 0, 0), + 0, + 0)); + FlowLayout jPanelDataLayout = new FlowLayout(); + jPanelData.setOpaque(false); + + jPanelData.setBounds(130, 17, 264, 37); + jPanelData.setLayout(jPanelDataLayout); + { + jLabelStationName = new JLabel(); + jPanelData.add(jLabelStationName); + jLabelStationName.setText("Station:"); + jLabelStationName.setFont(new java.awt.Font("Dialog",1,14)); + } + { + jLabelStationNameValue = new JLabel(); + jPanelData.add(jLabelStationNameValue); + jLabelStationNameValue.setText("?"); + jLabelStationNameValue.setFont(new java.awt.Font("Dialog",0,14)); + } + { + jLabelCost = new JLabel(); + jPanelData.add(jLabelCost); + jLabelCost.setText(" Cost:"); + jLabelCost.setFont(new java.awt.Font("Dialog",1,14)); + } + { + jLabelCostValue = new JLabel(); + jPanelData.add(jLabelCostValue); + jLabelCostValue.setText("?"); + jLabelCostValue.setFont(new java.awt.Font("Dialog",0,14)); + } + { + jLabelStatus = new JLabel(); + jPanelData.add(jLabelStatus); + jLabelStatus.setText(" Status:"); + jLabelStatus.setFont(new java.awt.Font("Dialog",1,14)); + } + { + jLabelStatusValue = new JLabel(); + jPanelData.add(jLabelStatusValue); + jLabelStatusValue.setText("?"); + jLabelStatusValue.setFont(new java.awt.Font("Dialog",0,14)); + } + } + { + jPanelThermometer = new JPanel(); + this.add(jPanelThermometer, new GridBagConstraints( + 0, + 1, + 1, + 3, + 0.1, + 0.9, + GridBagConstraints.NORTH, + GridBagConstraints.VERTICAL, + new Insets(0, 0, 0, 0), + 0, + 0)); + GridBagLayout jPanelThermometerLayout = new GridBagLayout(); + jPanelThermometerLayout.columnWeights = new double[] {0.1,0.1}; + jPanelThermometerLayout.columnWidths = new int[] {7,7}; + jPanelThermometerLayout.rowWeights = new double[] {0.1,0.1,0.1}; + jPanelThermometerLayout.rowHeights = new int[] {7,7,7}; + jPanelThermometer.setLayout(jPanelThermometerLayout); + jPanelThermometer.setBounds(19, 73, 68, 263); + { + jProgressBarTemp = new JProgressBar(); + jPanelThermometer.add( + jProgressBarTemp, + new GridBagConstraints( + 0, + 1, + 1, + 1, + 0.0, + 0.0, + GridBagConstraints.CENTER, + GridBagConstraints.BOTH, + new Insets(0, 0, 0, 0), + 0, + 0)); + jProgressBarTemp.setBounds(34, 56, 17, 220); + jProgressBarTemp + .setForeground(new java.awt.Color(255, 0, 0)); + jProgressBarTemp.setOrientation(SwingConstants.VERTICAL); + jProgressBarTemp.setMaximum(120); + jProgressBarTemp.setPreferredSize(new java.awt.Dimension( + 14, + 208)); + } + { + jLabelOneTwenty = new JLabel(); + jPanelThermometer.add( + jLabelOneTwenty, + new GridBagConstraints( + 1, + 0, + 1, + 1, + 0.0, + 0.0, + GridBagConstraints.SOUTHWEST, + GridBagConstraints.NONE, + new Insets(0, 0, 0, 0), + 0, + 0)); + jLabelOneTwenty.setText("120"); + jLabelOneTwenty.setBounds(59, 53, 22, 15); + } + { + jLabelFifty = new JLabel(); + jPanelThermometer.add(jLabelFifty, new GridBagConstraints( + 1, + 1, + 1, + 1, + 0.0, + 0.0, + GridBagConstraints.WEST, + GridBagConstraints.NONE, + new Insets(0, 0, 0, 0), + 0, + 0)); + jLabelFifty.setText(" 60"); + jLabelFifty.setBounds(59, 157, 21, 17); + } + { + jLabelZero = new JLabel(); + jPanelThermometer.add(jLabelZero, new GridBagConstraints( + 1, + 2, + 1, + 1, + 0.0, + 0.0, + GridBagConstraints.NORTHWEST, + GridBagConstraints.NONE, + new Insets(0, 0, 0, 0), + 0, + 0)); + jLabelZero.setText("0"); + jLabelZero.setBounds(58, 267, 17, 15); + } + } + { + jPanelChartContainer = new JPanel(); + this.add(jPanelChartContainer, new GridBagConstraints( + 1, + 1, + 3, + 3, + 0.9, + 0.9, + GridBagConstraints.NORTHWEST, + GridBagConstraints.BOTH, + new Insets(0, 0, 20, 20), + 0, + 0)); + BorderLayout jPanelChartContainerLayout = new BorderLayout(); + jPanelChartContainer.setOpaque(false); + jPanelChartContainer.setLayout(jPanelChartContainerLayout); + jPanelChartContainer.setBounds(83, 79, 301, 244); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void addMeasurement(int temperature){ + Date time = new Date(); + series.add(time.getTime(),(double)temperature); + jProgressBarTemp.setValue(temperature); + jLabelTemperature.setText(""+temperature+"° F"); + tickCount++; + } + + public void setStation(String stationName){ + jLabelStationNameValue.setText(stationName); + } + + public void setCost(String cost){ + jLabelCostValue.setText("$"+cost); + } + public void setStatus(String status){ + jLabelStatusValue.setText(status); + } + +}
Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/WcJFrame.java URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/WcJFrame.java?rev=189764&view=auto ============================================================================== --- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/WcJFrame.java (added) +++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/WcJFrame.java Thu Jun 9 08:03:19 2005 @@ -0,0 +1,108 @@ +package org.apache.wsdm.interop.wcm.impl.ui; + +import javax.swing.WindowConstants; + + +import javax.swing.JSplitPane; + +import org.apache.wsdm.interop.wcm.model.IWcm; +import org.apache.wsdm.interop.wcm.model.IWs; + + +import java.awt.BorderLayout; +/** +* This code was generated using CloudGarden's Jigloo +* SWT/Swing GUI Builder, which is free for non-commercial +* use. If Jigloo is being used commercially (ie, by a corporation, +* company or business for any purpose whatever) then you +* should purchase a license for each developer using Jigloo. +* Please visit www.cloudgarden.com for details. +* Use of Jigloo implies acceptance of these licensing terms. +* ************************************* +* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED +* for this machine, so Jigloo or this code cannot be used legally +* for any corporate or commercial purpose. +* ************************************* +*/ +public class WcJFrame extends javax.swing.JFrame implements IWcm { + private JSplitPane jSplitPaneHorizontal; + private JSplitPane jSplitPaneVertical; + + /** + * Auto-generated main method to display this JFrame + */ + public static void main(String[] args) { + WcJFrame inst = new WcJFrame(); + inst.setVisible(true); + } + + public WcJFrame() { + super(); + initGUI(); + jSplitPaneHorizontal.setRightComponent(new MessagesJPanel()); + jSplitPaneVertical.setLeftComponent(new StatusJPanel()); + jSplitPaneVertical.setRightComponent(new TemperatureJPanel()); + } + + private void initGUI() { + try { + setSize(400, 300); + setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + { + jSplitPaneHorizontal = new JSplitPane(JSplitPane.VERTICAL_SPLIT); + this.getContentPane().add( + jSplitPaneHorizontal, + BorderLayout.CENTER); + { + jSplitPaneVertical = new JSplitPane(); + jSplitPaneHorizontal.add( + jSplitPaneVertical, + JSplitPane.LEFT); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + /* (non-Javadoc) + * @see com.hp.wsdm.interop.wcm.IWcm#setCurrentTempurature(int) + */ + public void setCurrentTempurature(int temp) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see com.hp.wsdm.interop.wcm.IWcm#setCurrentCost(double) + */ + public void setCurrentCost(double d) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see com.hp.wsdm.interop.wcm.IWcm#setCurrentBackup(java.lang.String) + */ + public void setCurrentBackup(String backupName) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see com.hp.wsdm.interop.wcm.IWcm#setCurrentMessage(java.lang.String, java.lang.String) + */ + public void setCurrentMessage(String request, String response) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see com.hp.wsdm.interop.wcm.IWcm#setServiceModel(com.hp.wsdm.interop.wcm.IWs[]) + */ + public void setServiceModel(IWs[] services) { + // TODO Auto-generated method stub + + } + +} Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/CustomCellViewFactory.java URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/CustomCellViewFactory.java?rev=189764&view=auto ============================================================================== --- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/CustomCellViewFactory.java (added) +++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/CustomCellViewFactory.java Thu Jun 9 08:03:19 2005 @@ -0,0 +1,31 @@ +/* + * Created on Jun 1, 2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.apache.wsdm.interop.wcm.impl.ui.jgraph; + +import org.jgraph.graph.DefaultCellViewFactory; +import org.jgraph.graph.VertexView; + +/** + * @author wire + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class CustomCellViewFactory extends DefaultCellViewFactory { + + protected VertexView createVertexView(Object arg0) { + if(arg0 instanceof WcGraphCell){ + return new WcView(arg0); + } + else + if(arg0 instanceof WsGraphCell){ + return new WsView(arg0); + } + else + return super.createVertexView(arg0); + } +} Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/WcGraphCell.java URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/WcGraphCell.java?rev=189764&view=auto ============================================================================== --- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/WcGraphCell.java (added) +++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/WcGraphCell.java Thu Jun 9 08:03:19 2005 @@ -0,0 +1,53 @@ +/* + * Created on Jun 1, 2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.apache.wsdm.interop.wcm.impl.ui.jgraph; + +import javax.swing.tree.MutableTreeNode; + +import org.jgraph.graph.AttributeMap; +import org.jgraph.graph.DefaultGraphCell; + +/** + * @author wire + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class WcGraphCell extends DefaultGraphCell { + + /** + * + */ + public WcGraphCell() { + super(); + // TODO Auto-generated constructor stub + } + /** + * @param arg0 + */ + public WcGraphCell(Object arg0) { + super(arg0); + // TODO Auto-generated constructor stub + } + /** + * @param arg0 + * @param arg1 + */ + public WcGraphCell(Object arg0, AttributeMap arg1) { + super(arg0, arg1); + // TODO Auto-generated constructor stub + } + /** + * @param arg0 + * @param arg1 + * @param arg2 + */ + public WcGraphCell(Object arg0, AttributeMap arg1, MutableTreeNode[] arg2) { + super(arg0, arg1, arg2); + // TODO Auto-generated constructor stub + } +} Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/WcView.java URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/WcView.java?rev=189764&view=auto ============================================================================== --- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/WcView.java (added) +++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/WcView.java Thu Jun 9 08:03:19 2005 @@ -0,0 +1,83 @@ +/* + * Created on Jun 1, 2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.apache.wsdm.interop.wcm.impl.ui.jgraph; + +import java.awt.Color; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; + +import javax.swing.SwingConstants; + +import org.jgraph.graph.CellMapper; +import org.jgraph.graph.CellViewRenderer; +import org.jgraph.graph.GraphModel; +import org.jgraph.graph.VertexRenderer; +import org.jgraph.graph.VertexView; + +/** + * @author wire + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class WcView extends VertexView { + static WsRenderer renderer = new WsRenderer(); + /** + * + */ + public WcView() { + super(); +// renderer.setHorizontalAlignment(SwingConstants.RIGHT); +// renderer.setVerticalAlignment(SwingConstants.BOTTOM); + + // TODO Auto-generated constructor stub + } + /** + * @param arg0 + */ + public WcView(Object arg0) { + super(arg0); + // TODO Auto-generated constructor stub + } + // Constructor for Superclass + + + // public WsView(Object cell, GraphModel model, +// CellMapper cm) { +// super(cell, model, cm); +// } + // Returns Perimeter Point for Ellipses +// public Point getPerimeterPoint(Point source, Point p) { ... +// } + // Returns the Renderer for this View + public CellViewRenderer getRenderer() { + return renderer; + } + + // Define the Renderer for an EllipseView + static class WsRenderer extends VertexRenderer { + public void paint(Graphics g) { + try { + super.paint(g); + g.setColor(Color.BLACK); + setOpaque(false); + int xo=3; + int yo=3; + g.drawRect(xo+0,yo+0,xo+14,yo+12); + g.drawLine(xo+7,yo+15,xo+7,yo+20); + g.drawLine(xo+11,yo+15,xo+11,yo+20); + g.drawLine(xo+5,yo+20,xo+14,yo+20); + paintSelectionBorder(g); + } catch (IllegalArgumentException e) { + // JDK Bug: Zero length string passed to TextLayout constructor + } + } + } + + +} Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/WsGraphCell.java URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/WsGraphCell.java?rev=189764&view=auto ============================================================================== --- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/WsGraphCell.java (added) +++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/WsGraphCell.java Thu Jun 9 08:03:19 2005 @@ -0,0 +1,53 @@ +/* + * Created on Jun 1, 2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.apache.wsdm.interop.wcm.impl.ui.jgraph; + +import javax.swing.tree.MutableTreeNode; + +import org.jgraph.graph.AttributeMap; +import org.jgraph.graph.DefaultGraphCell; + +/** + * @author wire + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class WsGraphCell extends DefaultGraphCell { + + /** + * + */ + public WsGraphCell() { + super(); + // TODO Auto-generated constructor stub + } + /** + * @param arg0 + */ + public WsGraphCell(Object arg0) { + super(arg0); + // TODO Auto-generated constructor stub + } + /** + * @param arg0 + * @param arg1 + */ + public WsGraphCell(Object arg0, AttributeMap arg1) { + super(arg0, arg1); + // TODO Auto-generated constructor stub + } + /** + * @param arg0 + * @param arg1 + * @param arg2 + */ + public WsGraphCell(Object arg0, AttributeMap arg1, MutableTreeNode[] arg2) { + super(arg0, arg1, arg2); + // TODO Auto-generated constructor stub + } +} Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/WsView.java URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/WsView.java?rev=189764&view=auto ============================================================================== --- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/WsView.java (added) +++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/impl/ui/jgraph/WsView.java Thu Jun 9 08:03:19 2005 @@ -0,0 +1,94 @@ +/* + * Created on Jun 1, 2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.apache.wsdm.interop.wcm.impl.ui.jgraph; + +import java.awt.Color; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; + +import javax.swing.SwingConstants; + +import org.jgraph.graph.CellMapper; +import org.jgraph.graph.CellViewRenderer; +import org.jgraph.graph.GraphModel; +import org.jgraph.graph.VertexRenderer; +import org.jgraph.graph.VertexView; + +/** + * @author wire + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class WsView extends VertexView { + static WsRenderer renderer = new WsRenderer(); + /** + * + */ + public WsView() { + super(); +// renderer.setHorizontalAlignment(SwingConstants.RIGHT); +// renderer.setVerticalAlignment(SwingConstants.BOTTOM); + + // TODO Auto-generated constructor stub + } + /** + * @param arg0 + */ + public WsView(Object arg0) { + super(arg0); + // TODO Auto-generated constructor stub + } + // Constructor for Superclass + + + // public WsView(Object cell, GraphModel model, +// CellMapper cm) { +// super(cell, model, cm); +// } + // Returns Perimeter Point for Ellipses +// public Point getPerimeterPoint(Point source, Point p) { ... +// } + // Returns the Renderer for this View + public CellViewRenderer getRenderer() { + return renderer; + } + + // Define the Renderer for an EllipseView + static class WsRenderer extends VertexRenderer { + public void paint(Graphics g) { + try { + super.paint(g); + g.setColor(Color.BLACK); +// if (gradientColor != null && !preview && isOpaque()) { + setOpaque(false); +// Graphics2D g2d = (Graphics2D) g; +// g2d.setPaint(new GradientPaint(0, 0, getBackground(), +// getWidth(), getHeight(), gradientColor, true)); +// g2d.fillRect(0, 0, getWidth(), getHeight()); + int xo=3; + int yo=3; + g.fillArc(xo+1,yo+1,5,5,0,360); + g.fillArc(xo+11,yo+1,5,5,0,360); + g.fillArc(xo+1,yo+11,5,5,0,360); + g.fillArc(xo+11,yo+11,5,5,0,360); + g.drawLine(xo+5,yo+5,xo+11,yo+11); + g.drawLine(xo+5,yo+11,xo+11,yo+5); + g.drawLine(xo+8,yo+7,xo+8,yo+20); + g.drawLine(xo+5,yo+20,xo+12,yo+20); + +// } + paintSelectionBorder(g); + } catch (IllegalArgumentException e) { + // JDK Bug: Zero length string passed to TextLayout constructor + } + } + } + + +} Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/model/IWc.java URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/model/IWc.java?rev=189764&view=auto ============================================================================== --- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/model/IWc.java (added) +++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/model/IWc.java Thu Jun 9 08:03:19 2005 @@ -0,0 +1,13 @@ +/* + * Created on May 23, 2005 + * + */ +package org.apache.wsdm.interop.wcm.model; + +/** + * @author wire + * + */ +public interface IWc extends IWs { + public IWs getActive(); +} Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/model/IWcm.java URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/model/IWcm.java?rev=189764&view=auto ============================================================================== --- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/model/IWcm.java (added) +++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/model/IWcm.java Thu Jun 9 08:03:19 2005 @@ -0,0 +1,18 @@ +/* + * Created on May 23, 2005 + * + */ +package org.apache.wsdm.interop.wcm.model; + +/** + * Interface used to report real time data to the WCM. + * @author wire + * + */ +public interface IWcm { + void setCurrentTempurature(int temp); + void setCurrentCost(double d); + void setCurrentBackup(String backupName); + void setCurrentMessage(String request,String response); + void setServiceModel(IWs[] services); +} Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/model/IWs.java URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/model/IWs.java?rev=189764&view=auto ============================================================================== --- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/model/IWs.java (added) +++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/model/IWs.java Thu Jun 9 08:03:19 2005 @@ -0,0 +1,20 @@ +/* + * Created on May 23, 2005 + * + */ +package org.apache.wsdm.interop.wcm.model; + +/** + * @author wire + * + */ +public interface IWs { + public void setStatus(int status); + public int getStatus(); + public void setName(String name); + public String getName(); + public IWs getBackup(); + public void setBackup(IWs backup); + public double getTemperature(); + public void setTemperature(double temp); +} Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/model/WcmFactory.java URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/model/WcmFactory.java?rev=189764&view=auto ============================================================================== --- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/model/WcmFactory.java (added) +++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/model/WcmFactory.java Thu Jun 9 08:03:19 2005 @@ -0,0 +1,34 @@ +/* + * Created on May 23, 2005 + * + */ +package org.apache.wsdm.interop.wcm.model; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.apache.wsdm.interop.wcm.impl.WcImpl; +import org.apache.wsdm.interop.wcm.impl.WcmImpl; +import org.apache.wsdm.interop.wcm.impl.WsImpl; +import org.apache.wsdm.interop.wcm.impl.ui.WcJFrame; + + +/** + * @author wire + * + */ +public class WcmFactory { + public static IWcm createWcm(URL wcUrl,boolean showUi) { + return new WcmImpl( wcUrl,showUi); + } + + public static IWc createWC(int status, String name, IWs active){ + return new WcImpl(status, name, active); + } + + public static IWs createWS(int status, String name, IWs backup){ + return new WsImpl(status, name, backup); + } + + +} Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/InteropSimulator.java URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/InteropSimulator.java?rev=189764&view=auto ============================================================================== --- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/InteropSimulator.java (added) +++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/InteropSimulator.java Thu Jun 9 08:03:19 2005 @@ -0,0 +1,145 @@ +/* + * Created on May 23, 2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.apache.wsdm.interop.wcm.simulator; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Timer; +import java.util.TimerTask; + +import org.apache.wsdm.interop.wcm.model.IWcm; +import org.apache.wsdm.interop.wcm.model.IWs; +import org.apache.wsdm.interop.wcm.model.WcmFactory; + + +/** + * @author wire + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class InteropSimulator extends TimerTask{ + static Timer timer=new Timer(); + static IWcm wcm; + int lastTemp=-1; + /** + * @param wcm + */ + public InteropSimulator(IWcm wcm) { + InteropSimulator.wcm=wcm; + } + + public static void main(String[] args) throws MalformedURLException, InterruptedException { + wcm=WcmFactory.createWcm(new URL("http://localhost:8080/wsdm/wcm"),true); + timer=new Timer(true); + timer.scheduleAtFixedRate(new InteropSimulator(wcm),5000,5000); + + // This thread now sleeps forever + while(true){ + Thread.sleep(10000); + } + } + + /** + * Will be called every 5 seconds. Should send new data to the Wcm each time. + */ + public void run() { + wcm.setCurrentTempurature(getNextTempValue()); + wcm.setCurrentMessage(getRandomMessage(),getRandomMessage()); + + + int active=2; + int total=5; + + // pic a state combo + int combo=(int) Math.round(Math.random()*4); + switch (combo) { + case 0: + wcm.setCurrentCost(0.99); + wcm.setCurrentBackup("Ws3"); + wcm.setServiceModel(buildModel(2,total,new int[]{1,0,1,0,1})); + + break; + case 1: + wcm.setCurrentCost(1.05); + wcm.setCurrentBackup("Ws2"); + wcm.setServiceModel(buildModel(1,total,new int[]{1,1,0,1,1})); + break; + case 2: + wcm.setCurrentCost(2.99); + wcm.setCurrentBackup("Ws4"); + wcm.setServiceModel(buildModel(3,total,new int[]{1,0,0,1,1})); + break; + case 3: + wcm.setCurrentCost(0.50); + wcm.setCurrentBackup("Ws1"); + wcm.setServiceModel(buildModel(4,total,new int[]{1,1,0,0,1})); + break; + + default: + break; + } + + } + + /** + * @param active + * @param total + * @return + */ + IWs[] buildModel(int active, int total, int[] status) { + IWs[] arry=new IWs[total]; + + for(int index=1;index<total;index++){ + if(index==total-1) + arry[index]=WcmFactory.createWS(status[0],"WS"+index,arry[1]); + else + arry[index]=WcmFactory.createWS(status[0],"WS"+index,arry[index+1]); + } + + // Add Wc + arry[0]=WcmFactory.createWC(status[0],"WC",arry[active]); + + return arry; + } + + /** + * Returns a new temp value based on the previous value. + * @return + */ + public int getNextTempValue(){ + if(lastTemp==-1){ + lastTemp=(int) Math.round(100*Math.random()); + } else { + int deflection=(int) Math.round(5*Math.random()); + int direction=(int) Math.round(2*Math.random()); + if(direction==1) + lastTemp=lastTemp+deflection; + else + lastTemp=lastTemp-deflection; + if(lastTemp<0) + lastTemp=0; + if(lastTemp>120) + lastTemp=120; + } + + return lastTemp; + } + + public static String getRandomMessage(){ + int length =(int) Math.round(Math.random()*100); + String retString=""; + for(int index=0;index<length;index++){ + int charVal=(int) Math.round(Math.random()*9); + retString+=String.valueOf(charVal); + } + + return retString; + + } + +} Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/InteropSimulatorTest.java URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/InteropSimulatorTest.java?rev=189764&view=auto ============================================================================== --- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/InteropSimulatorTest.java (added) +++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/InteropSimulatorTest.java Thu Jun 9 08:03:19 2005 @@ -0,0 +1,63 @@ +/* + * Created on May 23, 2005 + * + */ +package org.apache.wsdm.interop.wcm.simulator; + +import java.net.URL; + +import org.apache.wsdm.interop.wcm.model.IWc; +import org.apache.wsdm.interop.wcm.model.IWs; +import org.apache.wsdm.interop.wcm.model.WcmFactory; + + +import junit.framework.TestCase; + +/** + * @author wire + * + */ +public class InteropSimulatorTest extends TestCase { + + private InteropSimulator sim; + + /* + * @see TestCase#setUp() + */ + protected void setUp() throws Exception { + super.setUp(); + sim=new InteropSimulator(WcmFactory.createWcm(new URL("http://localhost:8080/wsdm/wc"),false)); + } + + /* + * @see TestCase#tearDown() + */ + protected void tearDown() throws Exception { + super.tearDown(); + } + + public void testGetNextTempValue() { + int firstValue = sim.getNextTempValue(); + assertTrue(firstValue<101); + assertTrue(firstValue>-1); + + int value2 = sim.getNextTempValue(); + assertTrue(Math.abs(firstValue-value2)<=5); + int value3 = sim.getNextTempValue(); + assertTrue(Math.abs(value3-value2)<=5); + } + + public void testGetRandomMessage() { + String message=sim.getRandomMessage(); + assertTrue("Failed with length="+message.length() ,message.length()<101); + assertTrue(message.length()>0); + } + + public void testBuildModel(){ + IWs[] model = sim.buildModel(2,10,new int[]{1,0,1,1,1,0,1,0,1,0}); + assertEquals(10,model.length); + assertTrue(model[0] instanceof IWc); + assertEquals(model[1],model[9].getBackup()); + } + +} Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/MessageSimulator.java URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/MessageSimulator.java?rev=189764&view=auto ============================================================================== --- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/MessageSimulator.java (added) +++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/MessageSimulator.java Thu Jun 9 08:03:19 2005 @@ -0,0 +1,58 @@ +/* + * Created on May 24, 2005 + * + */ +package org.apache.wsdm.interop.wcm.simulator; + +import java.util.Timer; +import java.util.TimerTask; + +import javax.swing.JFrame; + +import org.apache.ws.muws.interop.client.WcmMessage; +import org.apache.wsdm.interop.wcm.impl.ui.MessagesJPanel; + + +/** + * @author wire + * + */ +public class MessageSimulator extends TimerTask { + + private static Timer timer; + private MessagesJPanel mp; + + /** + * @param mp + * + */ + public MessageSimulator(MessagesJPanel mp) { + super(); + this.mp=mp; + } + + public static void main(String[] args) throws InterruptedException { + JFrame frame = new JFrame(); + MessagesJPanel mp = new MessagesJPanel(); + frame.getContentPane().add(mp); + frame.pack(); + frame.show(); + + timer=new Timer(true); + timer.scheduleAtFixedRate(new MessageSimulator(mp),5000,5000); + + + // This thread now sleeps forever + while(true){ + Thread.sleep(10000); + } + + } + + /* (non-Javadoc) + * @see java.util.TimerTask#run() + */ + public void run() { + mp.setMessage(new WcmMessage(InteropSimulator.getRandomMessage(),InteropSimulator.getRandomMessage())); + } +} Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/StatusSimulator.java URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/StatusSimulator.java?rev=189764&view=auto ============================================================================== --- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/StatusSimulator.java (added) +++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/StatusSimulator.java Thu Jun 9 08:03:19 2005 @@ -0,0 +1,101 @@ +/* + * Created on May 24, 2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.apache.wsdm.interop.wcm.simulator; + +import java.awt.Color; +import java.util.Timer; +import java.util.TimerTask; + +import javax.swing.JFrame; + +import org.apache.wsdm.interop.wcm.impl.WcImpl; +import org.apache.wsdm.interop.wcm.impl.WsImpl; +import org.apache.wsdm.interop.wcm.impl.ui.MessagesJPanel; +import org.apache.wsdm.interop.wcm.impl.ui.StatusJPanel; +import org.apache.wsdm.interop.wcm.impl.ui.TemperatureJPanel; +import org.apache.wsdm.interop.wcm.model.IWc; +import org.apache.wsdm.interop.wcm.model.IWs; + + +/** + * @author wire + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class StatusSimulator extends TimerTask { + private static Timer timer; + private StatusJPanel tp; + private InteropSimulator is=new InteropSimulator(null); + static StatusJPanel mp; + + public static void main(String[] args) throws InterruptedException { + JFrame frame = new JFrame(); + frame.setTitle("WCMgr"); + mp = new StatusJPanel(); + frame.getContentPane().add(mp); + frame.pack(); + frame.show(); + + IWs ws1=new WsImpl(0,"Ws1",null); + IWs ws2=new WsImpl(0,"Ws2",ws1); + IWs ws3=new WsImpl(0,"Ws3",ws2); + ws1.setBackup(ws3); + IWc wc=new WcImpl(0,"Wc",ws1); + mp.setModel(new IWs[]{wc,ws1,ws2,ws3}); + + + timer=new Timer(true); + timer.scheduleAtFixedRate(new StatusSimulator(mp),5000,5000); + + + // This thread now sleeps forever + while(true){ + Thread.sleep(10000); + } + + } + + /* (non-Javadoc) + * @see java.util.TimerTask#run() + */ + public void run() { +// IWs node; + //mp.updateNode(new WsImpl(0,"ws1",null)); + long rand = Math.round(3*Math.random())+1; + + String name="Ws"+rand; + mp.setCurrentWc(name); + + + rand = Math.round(3*Math.random())+1; + name="Ws"+rand; + + long color = Math.round(3*Math.random())+1; + if(color==1){ + mp.setColor(name,Color.RED); + return; + } + if(color==2){ + mp.setColor(name,Color.YELLOW); + return; + } + if(color==3){ + mp.setColor(name,Color.GREEN); + return; + } + + } + + /** + * + */ + public StatusSimulator(StatusJPanel tp) { + super(); + this.tp=tp; + } +} Added: incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/TemperatureSimulator.java URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/TemperatureSimulator.java?rev=189764&view=auto ============================================================================== --- incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/TemperatureSimulator.java (added) +++ incubator/muse/trunk/src/ieeedemo/client/src/org/apache/wsdm/interop/wcm/simulator/TemperatureSimulator.java Thu Jun 9 08:03:19 2005 @@ -0,0 +1,62 @@ +/* + * Created on May 24, 2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.apache.wsdm.interop.wcm.simulator; + +import java.util.Timer; +import java.util.TimerTask; + +import javax.swing.JFrame; + +import org.apache.wsdm.interop.wcm.impl.ui.MessagesJPanel; +import org.apache.wsdm.interop.wcm.impl.ui.TemperatureJPanel; + + +/** + * @author wire + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class TemperatureSimulator extends TimerTask { + private static Timer timer; + private TemperatureJPanel tp; + private InteropSimulator is=new InteropSimulator(null); + + public static void main(String[] args) throws InterruptedException { + JFrame frame = new JFrame(); + frame.setTitle("WCDisplay "); + TemperatureJPanel mp = new TemperatureJPanel(); + frame.getContentPane().add(mp); + frame.pack(); + frame.show(); + + timer=new Timer(true); + timer.scheduleAtFixedRate(new TemperatureSimulator(mp),5000,5000); + + + // This thread now sleeps forever + while(true){ + Thread.sleep(10000); + } + + } + + /* (non-Javadoc) + * @see java.util.TimerTask#run() + */ + public void run() { + tp.addMeasurement(is.getNextTempValue()); + } + + /** + * + */ + public TemperatureSimulator(TemperatureJPanel tp) { + super(); + this.tp=tp; + } +} Added: incubator/muse/trunk/src/ieeedemo/client/wcclient.jar URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/wcclient.jar?rev=189764&view=auto ============================================================================== Binary file - no diff available. Propchange: incubator/muse/trunk/src/ieeedemo/client/wcclient.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/muse/trunk/src/ieeedemo/client/wcclient.jardesc URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/client/wcclient.jardesc?rev=189764&view=auto ============================================================================== --- incubator/muse/trunk/src/ieeedemo/client/wcclient.jardesc (added) +++ incubator/muse/trunk/src/ieeedemo/client/wcclient.jardesc Thu Jun 9 08:03:19 2005 @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<jardesc> + <jar path="wcm/wcclient.jar"/> + <options overwrite="false" compress="true" exportErrors="true" exportWarnings="true" saveDescription="true" descriptionLocation="/wcm/wcclient.jardesc" useSourceFolders="false" buildIfNeeded="true"/> + <manifest manifestVersion="1.0" usesManifest="true" reuseManifest="false" saveManifest="false" generateManifest="true" manifestLocation="" mainClassHandleIdentifier="=wcm/src<org.apache.wsdm.interop.wcm{WcDisplayApp.java[WcDisplayApp"> + <sealing sealJar="false"> + <packagesToSeal/> + <packagesToUnSeal/> + </sealing> + </manifest> + <selectedElements exportClassFiles="true" exportOutputFolder="false" exportJavaFiles="false"> + <javaElement handleIdentifier="=wcm"/> + </selectedElements> +</jardesc> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
