From 2f200e66523d800413156c373e3e5f36fb5ba519 Mon Sep 17 00:00:00 2001 From: Nils Christian Ehmke <nie@informatik.uni-kiel.de> Date: Mon, 25 Mar 2013 14:14:27 +0100 Subject: [PATCH] Solved some problems during the project saving. --- Kieker.WebGUI/pom.xml | 3 ++- .../beans/view/CurrentAnalysisEditorBean.java | 16 ++++++---------- .../dialogs/AnalysisEditorPageDialogs.xhtml | 2 +- .../main/webapp/pages/AnalysisEditorPage.xhtml | 9 ++++----- .../main/webapp/pages/CockpitEditorPage.xhtml | 6 +++--- .../main/webapp/templates/CommonTemplate.xhtml | 2 +- 6 files changed, 17 insertions(+), 21 deletions(-) diff --git a/Kieker.WebGUI/pom.xml b/Kieker.WebGUI/pom.xml index 537bfd90..cbf45ea6 100644 --- a/Kieker.WebGUI/pom.xml +++ b/Kieker.WebGUI/pom.xml @@ -305,8 +305,9 @@ </dependency> <dependency> <groupId>net.kieker-monitoring</groupId> - <artifactId>kieker-emf</artifactId> + <artifactId>kieker</artifactId> <version>1.7-SNAPSHOT</version> + <classifier>emf</classifier> </dependency> <dependency> <groupId>kieler</groupId> diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorBean.java index 5111c21d..387210a5 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorBean.java @@ -279,22 +279,18 @@ public final class CurrentAnalysisEditorBean { return new ArrayList<String>(); } - /** - * This method should be called before saving the project to deliver the current layout within the request parameter map. - */ - public synchronized void preSaveProject() { - // Get the parameters - final Map<String, String> paramMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); - this.currentLayout = paramMap.get("layoutString"); - } - /** * This method tries to save the current project and informs the user about success or fail. * * @param overwriteNewerProject * This flag determines whether a newer project should be overwritten. */ - public synchronized void saveProject(final boolean overwriteNewerProject) { + public synchronized void saveProject() { + // Get the parameters + final Map<String, String> paramMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); + this.currentLayout = paramMap.get("layoutString"); + final boolean overwriteNewerProject = Boolean.parseBoolean(paramMap.get("overwriteNewerProject")); + try { this.projectService.saveProject(this.projectName, this.project, this.timeStamp, overwriteNewerProject, this.userBean.getUsername(), this.currentLayout); GlobalPropertiesBean.showMessage(FacesMessage.SEVERITY_INFO, this.globalPropertiesBean.getMsgProjectSaved()); diff --git a/Kieker.WebGUI/src/main/webapp/dialogs/AnalysisEditorPageDialogs.xhtml b/Kieker.WebGUI/src/main/webapp/dialogs/AnalysisEditorPageDialogs.xhtml index 3b305610..e135e206 100644 --- a/Kieker.WebGUI/src/main/webapp/dialogs/AnalysisEditorPageDialogs.xhtml +++ b/Kieker.WebGUI/src/main/webapp/dialogs/AnalysisEditorPageDialogs.xhtml @@ -48,7 +48,7 @@ </div> <hr/> <div style="text-align: right"> - <p:commandButton value="#{localizedMessages.yes}" action="#{currentAnalysisEditorBean.saveProject(true)}" oncomplete="forceSaveDlg.hide()" update=":messages" /> + <p:commandButton value="#{localizedMessages.yes}" onclick="preSaveProject(true)" ajax="true" oncomplete="forceSaveDlg.hide()" update=":messages" /> <p:spacer width="10px" height="10" /> <p:commandButton value="#{localizedMessages.cancel}" onclick="forceSaveDlg.hide()" /> </div> diff --git a/Kieker.WebGUI/src/main/webapp/pages/AnalysisEditorPage.xhtml b/Kieker.WebGUI/src/main/webapp/pages/AnalysisEditorPage.xhtml index 3b034dfd..094f083d 100644 --- a/Kieker.WebGUI/src/main/webapp/pages/AnalysisEditorPage.xhtml +++ b/Kieker.WebGUI/src/main/webapp/pages/AnalysisEditorPage.xhtml @@ -43,7 +43,6 @@ nodeClickListener = function(node, info, e) { nodeClickCommand([{name : 'ID', value : node.id}]); markNode(node, '#FF0000'); - graph.refresh(); } nodeRemoveListener = function(node) { @@ -62,9 +61,9 @@ autoLayoutCommand([{name : 'nodes', value : nodes}, {name : 'edges', value : edges}]); } - function preSaveProject() { + function preSaveProject(overwriteNewerProject) { var layoutString = graph.savePositions(); - preSaveProjectCommand([{name : 'layoutString', value : layoutString}]); + saveProjectCommand([{name : 'layoutString', value : layoutString}, {name : 'overwriteNewerProject', value : overwriteNewerProject}]); } // "Overwrite" the function in the template @@ -85,7 +84,7 @@ <p:remoteCommand name="edgeCreateCommand" action="#{currentAnalysisEditorGraphBean.edgeCreated()}"/> <p:remoteCommand name="edgeRemoveCommand" action="#{currentAnalysisEditorGraphBean.edgeRemoved()}"/> <p:remoteCommand name="autoLayoutCommand" action="#{currentAnalysisEditorGraphBean.autoLayout()}"/> - <p:remoteCommand name="preSaveProjectCommand" action="#{currentAnalysisEditorBean.preSaveProject()}"/> + <p:remoteCommand name="saveProjectCommand" action="#{currentAnalysisEditorBean.saveProject()}" update=":messages"/> </h:form> </ui:define> @@ -93,7 +92,7 @@ <ui:define name="furtherMenuBarEntries"> <p:submenu label="#{localizedMessages.file}"> <c:if test="#{sec:areAnyGranted('User, Administrator')}"> - <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-save" value=" #{localizedMessages.saveProject}" update=":messages" ajax="true" onstart="preSaveProject()" action="#{currentAnalysisEditorBean.saveProject(false)}" disabled="#{empty currentAnalysisEditorBean.project}"/> + <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-save" value=" #{localizedMessages.saveProject}" ajax="true" onstart="preSaveProject(false)" disabled="#{empty currentAnalysisEditorBean.project}"/> <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-saveAs" value=" #{localizedMessages.saveProjectAs}" update=":messages" ajax="true" disabled="#{true or empty currentAnalysisEditorBean.project}"/> <p:separator /> </c:if> diff --git a/Kieker.WebGUI/src/main/webapp/pages/CockpitEditorPage.xhtml b/Kieker.WebGUI/src/main/webapp/pages/CockpitEditorPage.xhtml index 69baecb4..99a38f3a 100644 --- a/Kieker.WebGUI/src/main/webapp/pages/CockpitEditorPage.xhtml +++ b/Kieker.WebGUI/src/main/webapp/pages/CockpitEditorPage.xhtml @@ -74,10 +74,10 @@ <p:dataTable value="#{currentCockpitEditorBean.project.views}" var="viewElem"> <p:column headerText="View"> <div align="center"> - <p:commandLink id="dynaButton" value="#{viewElem.name}"/> + <p:commandLink id="dynaButton" style="font-weight: #{currentCockpitEditorBean.activeView == viewElem ? 'bold' : 'normal'}" value="#{viewElem.name}"/> <p:menu overlay="true" trigger="dynaButton" my="left top" at="left bottom" style="width:210px"> - <p:menuitem icon="ui-icon-analysisEditor" value=" #{localizedCockpitEditorPageMessages.selectView}" action="#{currentCockpitEditorBean.setActiveView(viewElem)}" styleClass="element-with-whitespace" update=":messages :centerForm"/> + <p:menuitem icon="ui-icon-analysisEditor" value=" #{localizedCockpitEditorPageMessages.selectView}" action="#{currentCockpitEditorBean.setActiveView(viewElem)}" styleClass="element-with-whitespace" update=":messages :centerForm :availableViewsForm"/> <p:separator/> <p:menuitem icon="ui-icon-copy" styleClass="element-with-whitespace" value=" #{localizedCockpitEditorPageMessages.copyView}" /> <p:menuitem icon="ui-icon-edit" styleClass="element-with-whitespace" value=" #{localizedCockpitEditorPageMessages.renameView}"/> @@ -115,7 +115,7 @@ <h:form id="propertiesForm" > <p:dataTable editable="true" var="property" value="[1]" rowIndexVar="rowIndex" emptyMessage="#{localizedMessages.noPropertiesAvailable}" rendered="#{not empty currentCockpitEditorBean.selectedNode}"> <p:column headerText="#{localizedMessages.property}" style="width:125px"> - <h:outputText id="nameProperty" value="#{localizedCockpitEditorPageMessages.name}" rendered="#{rowIndex == 1}"/> + <h:outputText id="nameProperty" value="#{localizedCockpitEditorPageMessages.name}" rendered="#{rowIndex == 0}"/> </p:column> <p:column headerText="#{localizedMessages.value}" style="width:125px"> diff --git a/Kieker.WebGUI/src/main/webapp/templates/CommonTemplate.xhtml b/Kieker.WebGUI/src/main/webapp/templates/CommonTemplate.xhtml index cb3fcded..62d65875 100644 --- a/Kieker.WebGUI/src/main/webapp/templates/CommonTemplate.xhtml +++ b/Kieker.WebGUI/src/main/webapp/templates/CommonTemplate.xhtml @@ -8,7 +8,7 @@ xmlns:c="http://java.sun.com/jsp/jstl/core"> <c:set var="root" value="#{request.contextPath}"/> - + <f:loadBundle var="localizedMessages" basename="lang.Common"/> <ui:insert name="metaData"/> <ui:insert name="bundleIncludes"/> -- GitLab