[overlord-commits] Overlord SVN: r1025 - activity-monitor/trunk/gui/war/src/main/java/org/jboss/bpm/monitor/gui/client.

overlord-commits at lists.jboss.org overlord-commits at lists.jboss.org
Wed Mar 31 04:51:12 EDT 2010


Author: heiko.braun at jboss.com
Date: 2010-03-31 04:51:12 -0400 (Wed, 31 Mar 2010)
New Revision: 1025

Modified:
   activity-monitor/trunk/gui/war/src/main/java/org/jboss/bpm/monitor/gui/client/DefinitionHistoryView.java
Log:
Implement chart resize handling

Modified: activity-monitor/trunk/gui/war/src/main/java/org/jboss/bpm/monitor/gui/client/DefinitionHistoryView.java
===================================================================
--- activity-monitor/trunk/gui/war/src/main/java/org/jboss/bpm/monitor/gui/client/DefinitionHistoryView.java	2010-03-30 16:06:19 UTC (rev 1024)
+++ activity-monitor/trunk/gui/war/src/main/java/org/jboss/bpm/monitor/gui/client/DefinitionHistoryView.java	2010-03-31 08:51:12 UTC (rev 1025)
@@ -27,6 +27,7 @@
 import org.timepedia.chronoscope.client.browser.json.GwtJsonDataset;
 import org.timepedia.chronoscope.client.browser.json.JsonDatasetJSO;
 import org.timepedia.chronoscope.client.canvas.View;
+import org.timepedia.chronoscope.client.canvas.ViewReadyCallback;
 import org.timepedia.chronoscope.client.data.tuple.Tuple2D;
 import org.timepedia.chronoscope.client.event.PlotFocusEvent;
 import org.timepedia.chronoscope.client.event.PlotFocusHandler;
@@ -91,10 +92,12 @@
     title.getElement().setAttribute("style", "font-size:24px; font-weight:BOLD");
 
     // ------------
+
+    BoxLayout boxLayout = new BoxLayout(BoxLayout.Orientation.HORIZONTAL);    
+    timespanPanel = new LayoutPanel(boxLayout);
     
-    timespanPanel = new LayoutPanel(new BoxLayout(BoxLayout.Orientation.HORIZONTAL));
     timespan = new HTML();
-    timespan.getElement().setAttribute("style", "padding-top:2px; color:#ccc;font-size:16px;text-align:left;");
+    timespan.getElement().setAttribute("style", "padding-top:2px; color:#C8C8C8;font-size:16px;text-align:left;");
     timespanButton = new ToolButton();
     timespanButton.setVisible(false);    
     timespanButton.setStyle(ToolButton.ToolButtonStyle.MENU);
@@ -120,6 +123,7 @@
     // ------------
     
     LayoutPanel contents = new LayoutPanel(new RowLayout());
+        
     LayoutPanel headerPanel = new LayoutPanel(new ColumnLayout());
     headerPanel.add(title, new ColumnLayoutData("50%"));
     headerPanel.add(timespanPanel, new ColumnLayoutData("50%"));
@@ -291,6 +295,16 @@
     // ------
 
     timespan.setText(datasets[0].getRangeLabel());
+
+    chartPanel.setViewReadyCallback(
+        new ViewReadyCallback() {
+          public void onViewReady(View view)
+          {
+            resizeChartArea(view);
+          }
+        }
+    );
+
     chartArea.add(chartPanel);
 
     // ------
@@ -304,17 +318,27 @@
         return chartPanel.isAttached();
       }
 
-      public void onResize(int width, int height) {        
+      public void onResize(int width, int height)
+      {        
         int chartWidth = chartArea.getOffsetWidth()/2;
         int chartHeight = (int) (chartWidth / GOLDEN__RATIO);
 
         // Resizing the chart once displayed currently unsupported
         View view = chartPanel.getChart().getView();
         view.resize(chartWidth, chartHeight);
+        resizeChartArea(view);
       }
     });
   }
 
+  private void resizeChartArea(View view)
+  {    
+    Log.debug(view.getWidth()+ "/"+view.getHeight());
+    int resizeTo= Integer.valueOf(view.getHeight()) + 75;
+    chartArea.setHeight(resizeTo+"px");
+    chartArea.layout();
+  }
+
   private static native JsonDatasetJSO getJson(String varName) /*-{
        return $wnd[varName];
     }-*/;



More information about the overlord-commits mailing list