From 340a5e1cf5114af1e3a660a8e5508d22651d8abc Mon Sep 17 00:00:00 2001 From: Nils Christian Ehmke <nie@informatik.uni-kiel.de> Date: Sat, 4 Feb 2012 22:06:48 +0100 Subject: [PATCH] Refactoring --- .../application/AvailableProjectsBean.java | 12 ++ .../webgui/beans/request/StringBean.java | 8 +- Kieker.WebGUI/src/main/webapp/main.css | 8 + Kieker.WebGUI/src/main/webapp/main.xhtml | 156 ++++-------------- .../src/main/webapp/main/aboutDialog.xhtml | 25 +++ .../src/main/webapp/main/projectDialogs.xhtml | 33 ++++ .../src/main/webapp/main/settingsDialog.xhtml | 27 +++ 7 files changed, 139 insertions(+), 130 deletions(-) create mode 100644 Kieker.WebGUI/src/main/webapp/main/aboutDialog.xhtml create mode 100644 Kieker.WebGUI/src/main/webapp/main/projectDialogs.xhtml create mode 100644 Kieker.WebGUI/src/main/webapp/main/settingsDialog.xhtml diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/AvailableProjectsBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/AvailableProjectsBean.java index 5c5d1232..3607d369 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/AvailableProjectsBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/AvailableProjectsBean.java @@ -102,4 +102,16 @@ public class AvailableProjectsBean { return root; } + + public synchronized void saveProject(final MIProject project) { + + } + + public synchronized void deleteProject(final MIProject project) { + + } + + public synchronized void resetProject(final MIProject project) { + + } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/request/StringBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/request/StringBean.java index 5310f8a4..5a98fdba 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/request/StringBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/request/StringBean.java @@ -59,11 +59,5 @@ public class StringBean { public void setString(final String string) { this.string = string; } - - /** - * Clears the bean; in other words: Sets the value of this bean to an empty string. - */ - public void clear() { - this.string = ""; - } + } diff --git a/Kieker.WebGUI/src/main/webapp/main.css b/Kieker.WebGUI/src/main/webapp/main.css index 208b019b..08ff2943 100644 --- a/Kieker.WebGUI/src/main/webapp/main.css +++ b/Kieker.WebGUI/src/main/webapp/main.css @@ -39,4 +39,12 @@ .ui-dialog { font-size: 15px; width: auto; +} + +.projectInputText { + width: 90%; +} + +.ui-tree { + width: auto; } \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/main.xhtml b/Kieker.WebGUI/src/main/webapp/main.xhtml index 1b6da6e5..76e06c9e 100644 --- a/Kieker.WebGUI/src/main/webapp/main.xhtml +++ b/Kieker.WebGUI/src/main/webapp/main.xhtml @@ -2,6 +2,7 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" + xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"> @@ -21,34 +22,25 @@ <h:form> <p:menubar> <p:submenu label="File"> - <p:menuitem value="New Project" onclick="newProjectDialog.show()" - ajax="true" /> - <p:menuitem value="Manage Dependencies" ajax="false" - url="/Kieker.WebGUI/manageDependencies" /> + <p:menuitem value="New Project" onclick="newProjectDialog.show()" ajax="true" /> + <p:menuitem value="Manage Dependencies" ajax="false" url="/Kieker.WebGUI/manageDependencies" /> <p:separator /> - - <p:menuitem value="Settings" onclick="settingsDialog.show()" - ajax="true" /> + <p:menuitem value="Settings" onclick="settingsDialog.show()" ajax="true" /> </p:submenu> <!-- This is the submenu for the current project, for example if someone doesn't want to use the context menu within the browser. --> <p:submenu label="Current Project"> - <p:menuitem value="Save Project" ajax="true" /> - <p:menuitem value="Set as Main Project" ajax="true" - action="#{selectedProjectBean.setMainProject(selectedProjectBean.getSelectedProject())}" - update="projectsForm" /> + <p:menuitem value="Save Project" ajax="true" action="#{availableProjectsBean.saveProject(selectedProjectBean.getSelectedProject)}" update=":projectsForm" /> + <p:menuitem value="Set as Main Project" ajax="true" action="#{selectedProjectBean.setMainProject(selectedProjectBean.getSelectedProject())}" update=":projectsForm" /> <p:separator /> - - <p:menuitem value="Delete Project" ajax="true" /> - <p:menuitem value="Reset Project" ajax="true" /> + <p:menuitem value="Delete Project" ajax="true" action="#{availableProjectsBean.deleteProject(selectedProjectBean.getSelectedProject)}" update=":projectsForm" /> + <p:menuitem value="Reset Project" ajax="true" action="#{availableProjectsBean.resetProject(selectedProjectBean.getSelectedProject)}" update=":projectsForm" /> <p:separator /> - - <p:menuitem value="Configure Dependencies" ajax="false" - url="/Kieker.WebGUI/projectDependencies" /> + <p:menuitem value="Configure Dependencies" ajax="false" url="/Kieker.WebGUI/projectDependencies" /> </p:submenu> <p:submenu label="Help"> - <p:menuitem value="About..." onclick="AboutDialog.show();" /> + <p:menuitem value="About..." ajax="true" onclick="AboutDialog.show();" /> </p:submenu> </p:menubar> @@ -59,43 +51,42 @@ <!-- ******************************************************************************** --> <!-- The following layout is at the left side of the page and shows the available projects. --> - <p:layoutUnit id="projectsLayout" header="Projects" collapsible="true" position="west" + <p:layoutUnit header="Projects" collapsible="true" position="west" size="200" resizable="true" minSize="100"> <h:form id="projectsForm"> - <p:tree selection="#{selectedProjectBean.selectedNode}" - id="projectsTree" selectionMode="single" style="width: auto" - value="#{availableProjectsBean.projectsRoot}" var="node"> + <p:tree selection="#{selectedProjectBean.selectedNode}" id="projectsTree" selectionMode="single" value="#{availableProjectsBean.projectsRoot}" var="node"> <p:ajax event="select" listener="#{selectedProjectBean.onNodeSelect}"/> + <p:treeNode type="project"> - <h:outputText - style="font-weight: #{selectedProjectBean.getFontWeight(node)}" - value="#{node}"> + <h:outputText style="font-weight: #{selectedProjectBean.getFontWeight(node)}" value="#{node}"> <f:converter converterId="kieker.webgui.converter.MIProjectToStringConverter" /> </h:outputText> </p:treeNode> + <p:treeNode type="dependencies"> <h:outputText value="#{node}" /> </p:treeNode> + <p:treeNode type="usedPlugins"> <h:outputText value="#{node}" /> </p:treeNode> + </p:tree> <p:contextMenu for="projectsTree" nodeType="project"> - <p:menuitem value="Save Project" ajax="true" /> - <p:menuitem value="Set as Main Project" ajax="true" - action="#{selectedProjectBean.setMainProject(selectedProjectBean.getSelectedProject())}" - update="projectsForm" /> - + <p:menuitem value="Save Project" ajax="true" action="#{availableProjectsBean.saveProject(selectedProjectBean.getSelectedProject)}" update=":projectsForm" /> + <p:menuitem value="Set as Main Project" ajax="true" action="#{selectedProjectBean.setMainProject(selectedProjectBean.getSelectedProject())}" update=":projectsForm" /> <p:separator /> - <p:menuitem value="Delete Project" ajax="true" /> - <p:menuitem value="Reset Project" ajax="true" /> + <p:menuitem value="Delete Project" ajax="true" action="#{availableProjectsBean.deleteProject(selectedProjectBean.getSelectedProject)}" update=":projectsForm" /> + <p:menuitem value="Reset Project" ajax="true" action="#{availableProjectsBean.resetProject(selectedProjectBean.getSelectedProject)}" update=":projectsForm" /> <p:separator /> - <p:menuitem value="Configure Dependencies" ajax="true" /> + <p:menuitem value="Configure Dependencies" ajax="false" url="/Kieker.WebGUI/projectDependencies" /> </p:contextMenu> + <p:contextMenu for="projectsTree" nodeType="dependencies"> </p:contextMenu> + <p:contextMenu for="projectsTree" nodeType="usedPlugins"> </p:contextMenu> </h:form> @@ -111,12 +102,9 @@ <!-- ******************************************************************************** --> <!-- The following layout unit is located at the bottom and will be used for properties. --> - <p:layoutUnit position="south" size="150" header="Properties" - resizable="true" collapsible="true"> + <p:layoutUnit position="south" size="150" header="Properties" resizable="true" collapsible="true"> <h:form> - <p:dataTable id="carList"> - - + <p:dataTable id="propertiesList"> <p:column headerText="Key" style="width:125px"> <p:cellEditor> <f:facet name="output"> @@ -164,93 +152,15 @@ <!-- ******************************************************************************** --> </p:layout> + <!-- Include the dialogs for creating/deleting projects etc. --> + <ui:include src="main\projectDialogs.xhtml" /> - <!-- ******************************************************************************** --> - <!-- This is the about-dialog. --> - <p:dialog header="About..." resizable="false" modal="true" - widgetVar="AboutDialog"> - <h:form> - <h:outputText value="Kieker.WebGUI" /> - <br /> - <br /> - <h:outputText value="Version: 1.0-SNAPSHOT" /> - <br /> - <h:outputText value="Copyright (c) 2012 Kieker Project" /> - <br /> - <br /> - <a href="http://www.kieker-monitoring.net/">http://www.kieker-monitoring.net/</a> - </h:form> - </p:dialog> - <!-- ******************************************************************************** --> - - <!-- ******************************************************************************** --> - <!-- This is the dialog to create a new project. --> - <p:dialog id="newProjectDialog" header="New Project" resizable="false" - modal="true" widgetVar="newProjectDialog"> - <!-- Make sure that closing of the dialog also clears the input field. --> - <p:ajax event="close" update="newProjectDialog" - listener="#{stringBean.clear()}" /> - - <h:form> - <h:outputText value="Please enter the name of the new project: " /> - <br /> - <br /> - <center> - <p:inputText id="NewProjectInput" style="width: 90%" - value="#{stringBean.string}" /> - <br /> <br /> - <p:commandButton value="Ok" - action="#{availableProjectsBean.addProject(stringBean.string)}" - update="projectsForm" - oncomplete="newProjectDialog.hide()" /> - <p:spacer width="100" height="10" /> - <p:commandButton value="Cancel" onclick="newProjectDialog.hide()" /> - </center> - </h:form> - </p:dialog> - <!-- ******************************************************************************** --> + <!-- Include the dialog for the configuration. --> + <ui:include src="main\settingsDialog.xhtml" /> - <!-- ******************************************************************************** --> - <!-- This is the dialog for settings and properties. --> - <p:dialog id="settingsDialog" header="Settings" resizable="false" - modal="true" widgetVar="settingsDialog"> - <h:form> - <h:panelGrid columns="2" 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:panelGrid> - <center> - <p:commandButton value="Ok" oncomplete="settingsDialog.hide();" /> - </center> - </h:form> - </p:dialog> - <!-- ******************************************************************************** --> - - <!-- ******************************************************************************** --> - <!-- This is the dialog for uploading dependencies. --> - <p:dialog id="dependenciesUploadDialog" header="Add Dependency" - resizable="false" modal="true" widgetVar="dependenciesUploadDialog"> - - <h:form enctype="multipart/form-data"> - - <p:messages showDetail="true" /> - - <p:fileUpload value="#{dependencyUploadController.file}" - mode="simple" /> - - <p:commandButton value="Submit" ajax="false" - actionListener="#{dependencyUploadController.upload}" /> - - </h:form> - - </p:dialog> - <!-- ******************************************************************************** --> + <!-- Include the about-dialog. --> + <ui:include src="main\aboutDialog.xhtml" /> </h:body> </f:view> -</html> - +</html> \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/main/aboutDialog.xhtml b/Kieker.WebGUI/src/main/webapp/main/aboutDialog.xhtml new file mode 100644 index 00000000..38dc4a65 --- /dev/null +++ b/Kieker.WebGUI/src/main/webapp/main/aboutDialog.xhtml @@ -0,0 +1,25 @@ +<ui:composition + xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:p="http://primefaces.org/ui"> + + <!-- ******************************************************************************** --> + <!-- This is the about-dialog. --> + <p:dialog header="About..." resizable="false" modal="true" + widgetVar="AboutDialog"> + <h:form> + <h:outputText value="Kieker.WebGUI" /> + <br /> + <br /> + <h:outputText value="Version: 1.0-SNAPSHOT" /> + <br /> + <h:outputText value="Copyright (c) 2012 Kieker Project" /> + <br /> + <br /> + <a href="http://www.kieker-monitoring.net/">http://www.kieker-monitoring.net/</a> + </h:form> + </p:dialog> + <!-- ******************************************************************************** --> +</ui:composition> \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/main/projectDialogs.xhtml b/Kieker.WebGUI/src/main/webapp/main/projectDialogs.xhtml new file mode 100644 index 00000000..e448ae66 --- /dev/null +++ b/Kieker.WebGUI/src/main/webapp/main/projectDialogs.xhtml @@ -0,0 +1,33 @@ +<ui:composition + xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:p="http://primefaces.org/ui"> + + <!-- ******************************************************************************** --> + <!-- This is the dialog to create a new project. --> + <p:dialog id="newProjectDialog" header="New Project" resizable="false" + modal="true" widgetVar="newProjectDialog"> + <!-- Make sure that closing of the dialog also clears the input field. --> + <p:ajax event="close" update="newProjectDialog" /> + + <h:form> + <h:outputText value="Please enter the name of the new project: " /> + <br /> + <br /> + <center> + <p:inputText id="NewProjectInput" styleClass="projectInputText" + value="#{stringBean.string}" /> + <br /> <br /> + <p:commandButton value="Ok" + action="#{availableProjectsBean.addProject(stringBean.string)}" + update=":projectsForm" + oncomplete="newProjectDialog.hide()" /> + <p:spacer width="100" height="10" /> + <p:commandButton value="Cancel" onclick="newProjectDialog.hide()" /> + </center> + </h:form> + </p:dialog> + <!-- ******************************************************************************** --> +</ui:composition> \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/main/settingsDialog.xhtml b/Kieker.WebGUI/src/main/webapp/main/settingsDialog.xhtml new file mode 100644 index 00000000..6f331701 --- /dev/null +++ b/Kieker.WebGUI/src/main/webapp/main/settingsDialog.xhtml @@ -0,0 +1,27 @@ +<ui:composition + xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:p="http://primefaces.org/ui"> + + <!-- ******************************************************************************** --> + <!-- This is the dialog for settings and properties. --> + <p:dialog id="settingsDialog" header="Settings" resizable="false" + modal="true" widgetVar="settingsDialog"> + <h:form> + <h:panelGrid columns="2" 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:panelGrid> + <center> + <p:commandButton value="Ok" oncomplete="settingsDialog.hide();" /> + </center> + </h:form> + </p:dialog> + <!-- ******************************************************************************** --> +</ui:composition> \ No newline at end of file -- GitLab