From c509cfea72103b3181c542b516015f16b271e396 Mon Sep 17 00:00:00 2001
From: Nils Christian Ehmke <nie@informatik.uni-kiel.de>
Date: Thu, 19 Apr 2012 12:02:16 +0200
Subject: [PATCH] Implemented resizing of workspace.

---
 .../webgui/beans/request/StringToIDBean.java  | 20 +++++++
 .../session/CurrentWorkspaceSizeBean.java     | 56 +++++++++++++++++++
 .../src/main/webapp/handleAnalysis.xhtml      | 29 +++++++---
 .../main/webapp/{main => }/js-graph-it.css    |  0
 .../src/main/webapp/{main => }/js-graph-it.js |  0
 Kieker.WebGUI/src/main/webapp/main.xhtml      | 16 +++---
 .../src/main/webapp/main/settingsDialog.xhtml |  9 ++-
 7 files changed, 113 insertions(+), 17 deletions(-)
 create mode 100644 Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentWorkspaceSizeBean.java
 rename Kieker.WebGUI/src/main/webapp/{main => }/js-graph-it.css (100%)
 rename Kieker.WebGUI/src/main/webapp/{main => }/js-graph-it.js (100%)

diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/request/StringToIDBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/request/StringToIDBean.java
index 33d45b23..2108afa4 100644
--- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/request/StringToIDBean.java
+++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/request/StringToIDBean.java
@@ -1,3 +1,23 @@
+/***************************************************************************
+ * Copyright 2012 by
+ *  + Christian-Albrechts-University of Kiel
+ *    + Department of Computer Science
+ *      + Software Engineering Group 
+ *  and others.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ***************************************************************************/
+
 package kieker.webgui.beans.request;
 
 import javax.faces.bean.ManagedBean;
diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentWorkspaceSizeBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentWorkspaceSizeBean.java
new file mode 100644
index 00000000..f391f58e
--- /dev/null
+++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentWorkspaceSizeBean.java
@@ -0,0 +1,56 @@
+/***************************************************************************
+ * Copyright 2012 by
+ *  + Christian-Albrechts-University of Kiel
+ *    + Department of Computer Science
+ *      + Software Engineering Group 
+ *  and others.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ***************************************************************************/
+package kieker.webgui.beans.session;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+
+/**
+ *
+ * @author Nils Christian Ehmke
+ */
+@ManagedBean
+@SessionScoped
+public class CurrentWorkspaceSizeBean {
+
+    private int sizeX;
+    private int sizeY;
+
+    public CurrentWorkspaceSizeBean() {
+        this.sizeX = 1000;
+        this.sizeY = 1000;
+    }
+    
+    public int getSizeX() {
+        return sizeX;
+    }
+
+    public void setSizeX(int sizeX) {
+        this.sizeX = sizeX;
+    }
+
+    public int getSizeY() {
+        return sizeY;
+    }
+
+    public void setSizeY(int sizeY) {
+        this.sizeY = sizeY;
+    }
+}
diff --git a/Kieker.WebGUI/src/main/webapp/handleAnalysis.xhtml b/Kieker.WebGUI/src/main/webapp/handleAnalysis.xhtml
index f13d15b6..623e1672 100644
--- a/Kieker.WebGUI/src/main/webapp/handleAnalysis.xhtml
+++ b/Kieker.WebGUI/src/main/webapp/handleAnalysis.xhtml
@@ -11,9 +11,19 @@
         <h:head>
             <title>Kieker.WebGUI - Analysis</title>
             <link rel="stylesheet" type="text/css" href="../handleAnalysis.css" />
+            <script type="text/javascript" src="../js-graph-it.js"/> 
+            <link rel="stylesheet" type="text/css" href="../js-graph-it.css"/>
+            <style>
+                .block { 
+                    position: absolute;
+                }
+                .connector {
+                    background-color: #FF9900;
+                }
+            </style>
         </h:head>
 
-        <h:body>
+        <h:body onload="initPageObjects();">
 
             <p:layout fullPage="true">
                 <p:layoutUnit header="Navigation" position="north" collapsible="true" resizable="true">
@@ -37,13 +47,16 @@
 
                         <p:layoutUnit  position="center" >
                             <h:form id="centerForm">
-                                <ui:repeat id="centerRepeat" value="#{selectedProjectBean.selectedProject.plugins}" var="plugin">
-                                    <p:panel header="#{plugin.name}"  toggleSpeed="200" toggleable="true" id="plugin" style="width: 20%">
-                                        <p:commandLink ajax="true" value="Show Data"/>
-                                    </p:panel> 
-                                    <p:draggable for="plugin">
-                                    </p:draggable>
-                                </ui:repeat>
+                                <div class="canvas" id="mainCanvas" style="width: auto; height: 500px">
+                                    <c:forEach items="#{selectedProjectBean.selectedProject.plugins}" var="plugin">
+                                        <div class="ui-panel ui-widget ui-widget-content ui-corner-all block draggable" id="#{stringToIDBean.stringToID(plugin)}">
+                                            <div class="ui-panel-titlebar ui-widget-header ui-corner-all">
+                                                <h:outputText style="font-weight: bold" value="#{plugin.name}"/>
+                                            </div>
+                                            <p:commandLink ajax="true" value="Show Data"/>
+                                        </div>
+                                    </c:forEach>
+                                </div>
                             </h:form>
                         </p:layoutUnit>
 
diff --git a/Kieker.WebGUI/src/main/webapp/main/js-graph-it.css b/Kieker.WebGUI/src/main/webapp/js-graph-it.css
similarity index 100%
rename from Kieker.WebGUI/src/main/webapp/main/js-graph-it.css
rename to Kieker.WebGUI/src/main/webapp/js-graph-it.css
diff --git a/Kieker.WebGUI/src/main/webapp/main/js-graph-it.js b/Kieker.WebGUI/src/main/webapp/js-graph-it.js
similarity index 100%
rename from Kieker.WebGUI/src/main/webapp/main/js-graph-it.js
rename to Kieker.WebGUI/src/main/webapp/js-graph-it.js
diff --git a/Kieker.WebGUI/src/main/webapp/main.xhtml b/Kieker.WebGUI/src/main/webapp/main.xhtml
index 8c176c59..79eb6ca1 100644
--- a/Kieker.WebGUI/src/main/webapp/main.xhtml
+++ b/Kieker.WebGUI/src/main/webapp/main.xhtml
@@ -11,8 +11,8 @@
         <h:head>
             <title>Kieker.WebGUI</title>
             <link rel="stylesheet" type="text/css" href="../main.css" />
-            <script type="text/javascript" src="../main/js-graph-it.js"/> 
-            <link rel="stylesheet" type="text/css" href="../main/js-graph-it.css"/>
+            <script type="text/javascript" src="../js-graph-it.js"/> 
+            <link rel="stylesheet" type="text/css" href="../js-graph-it.css"/>
             <style>
                 .block { 
                     position: absolute;
@@ -115,13 +115,13 @@
                 <!-- ******************************************************************************** -->
                 <!-- The following layout unit is within the center and used for the graph. -->
                 <p:layoutUnit position="center" id="centerLayout">
-                    <h:form id="centerForm">
-                        <div class="canvas" id="mainCanvas" style="width: auto; height: 500px">
+                    <h:form id="centerForm" style="height: 100%">
+                        <div class="canvas" id="mainCanvas" style="width : #{currentWorkspaceSizeBean.sizeX}px;height: #{currentWorkspaceSizeBean.sizeY}px">
                             <c:forEach items="#{selectedMainProjectBean.mainProject.plugins}" var="plugin">
-                              <div class="ui-panel ui-widget ui-widget-content ui-corner-all block draggable" id="#{stringToIDBean.stringToID(plugin)}">
-                                  <div class="ui-panel-titlebar ui-widget-header ui-corner-all">
-                                  <h:outputText style="font-weight: bold" value="#{plugin.getName()}"/>
-                                  </div>
+                                <div class="ui-panel ui-widget ui-widget-content ui-corner-all block draggable" id="#{stringToIDBean.stringToID(plugin)}">
+                                    <div class="ui-panel-titlebar ui-widget-header ui-corner-all">
+                                        <h:outputText style="font-weight: bold" value="#{plugin.getName()}"/>
+                                    </div>
                                     <p:commandLink ajax="true" value="Configure" action="#{selectedPluginBean.setPlugin(plugin)}" update=":propertiesForm"/>
                                     <br/>
                                     <p:commandLink ajax="true" value="Connect" update=":connectionDialogForm" onclick="connectionDialog.show();"/>
diff --git a/Kieker.WebGUI/src/main/webapp/main/settingsDialog.xhtml b/Kieker.WebGUI/src/main/webapp/main/settingsDialog.xhtml
index 8b3035af..7d7dfafc 100644
--- a/Kieker.WebGUI/src/main/webapp/main/settingsDialog.xhtml
+++ b/Kieker.WebGUI/src/main/webapp/main/settingsDialog.xhtml
@@ -10,13 +10,20 @@
     <p:dialog id="settingsDialog" header="Settings" resizable="false"
               modal="true" widgetVar="settingsDialog">
         <h:form>
-            <h:panelGrid columns="2" cellpadding="10">
+            <h:panelGrid columns="4" cellpadding="10">
                 <h:outputText value="Look and Feel:" />
                 <p:themeSwitcher value="#{currentThemeBean.theme}"
                                  style="width:150px" effect="fade">
                     <f:selectItem itemLabel="Choose Theme" itemValue="" />
                     <f:selectItems value="#{themeSwitcherBean.themes}" />
                 </p:themeSwitcher>
+                <h:outputText value=""/>
+                <h:outputText value=""/>
+
+                <h:outputText value="Graph Workspace Size:"/>
+                <p:spinner value="#{currentWorkspaceSizeBean.sizeX}" suffix=" px"/>
+                <h:outputText value=" x "/>
+                <p:spinner value="#{currentWorkspaceSizeBean.sizeY}" suffix=" px"/>
             </h:panelGrid>
             <hr/>
             <div style="text-align: right">
-- 
GitLab