Skip to content
Snippets Groups Projects
Commit dad45b5f authored by Nils Christian Ehmke's avatar Nils Christian Ehmke
Browse files

Minor corrections and experiments with JointJS.

parent 40e56f62
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,7 @@ package kieker.webgui.beans.application; ...@@ -22,6 +22,7 @@ package kieker.webgui.beans.application;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ApplicationScoped; import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
...@@ -37,7 +38,9 @@ import org.primefaces.model.DefaultTreeNode; ...@@ -37,7 +38,9 @@ import org.primefaces.model.DefaultTreeNode;
import org.primefaces.model.TreeNode; import org.primefaces.model.TreeNode;
/** /**
* This bean can be used to handle all available projects within the program. * This bean can be used to handle all available projects within the program. It is like a blackboard for all other components when it comes to the actual projects
* <b>stored</b> on the file system. The properties of the projects, like the adding of dependencies the an actual existing project, can be done otherwise, but the
* storage is done via this bean.
* *
* @author Nils Christian Ehmke * @author Nils Christian Ehmke
* @version 1.0 * @version 1.0
...@@ -59,32 +62,33 @@ public class AvailableProjectsBean { ...@@ -59,32 +62,33 @@ public class AvailableProjectsBean {
* Creates a new instance of this class. * Creates a new instance of this class.
*/ */
public AvailableProjectsBean() { public AvailableProjectsBean() {
/* Load all projects from the file system. */
this.projects = FileManager.getInstance().loadAllProjects(); this.projects = FileManager.getInstance().loadAllProjects();
this.factory = new MAnalysisMetaModelFactory(); this.factory = new MAnalysisMetaModelFactory();
} }
/** /**
* Uses the given name to create a new project. If a project with the * Uses the given name to create a new project. If a project with the
* same name does already exist, nothing happens. * same name does already exist, nothing happens, but a message will inform the user.
* *
* @param projectName * @param projectName
* The name of the new project. * The name of the new project.
*/ */
public final void addProject(final String projectName) { public final void addProject(final String projectName) {
synchronized (this) { /*
/* * Create a new project.
* Create a new project. */
*/ final MIProject project = this.factory.createProject();
final MIProject project = this.factory.createProject(); project.setName(projectName);
project.setName(projectName);
/* The check for an existing project and the potential storage within our list has to be done atomically. */
synchronized (this) {
/* /*
* Try to save the project. * Try to save the project. If this fails, the project exists already.
*/ */
if (FileManager.getInstance().saveNewProject(project)) { if (FileManager.getInstance().saveNewProject(project)) {
/* /*
* Set the new project as the main project, if the current * Set the new project as the main project, if the current user doesn't have one.
* user doesn't have one.
*/ */
final FacesContext context = FacesContext.getCurrentInstance(); final FacesContext context = FacesContext.getCurrentInstance();
final SelectedProjectBean bean = context.getApplication().evaluateExpressionGet(context, "#{selectedProjectBean}", final SelectedProjectBean bean = context.getApplication().evaluateExpressionGet(context, "#{selectedProjectBean}",
...@@ -94,6 +98,9 @@ public class AvailableProjectsBean { ...@@ -94,6 +98,9 @@ public class AvailableProjectsBean {
} }
this.projects.add(project); this.projects.add(project);
} else {
/* Inform the user about the fail. */
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "", "A project with this name exists already."));
} }
} }
} }
...@@ -168,4 +175,5 @@ public class AvailableProjectsBean { ...@@ -168,4 +175,5 @@ public class AvailableProjectsBean {
} }
} }
} }
} }
...@@ -10,10 +10,9 @@ ...@@ -10,10 +10,9 @@
<h:head> <h:head>
<title>Kieker.WebGUI</title> <title>Kieker.WebGUI</title>
<link rel="stylesheet" type="text/css" href="../main.css" /> <link rel="stylesheet" type="text/css" href="../main.css" />
<script src="../main/joint.all.min.js" type="text/javascript"></script>
</h:head> </h:head>
<h:body> <h:body onload="initPageObjects();">
<!-- This is the layout for the whole page. --> <!-- This is the layout for the whole page. -->
<p:layout id="layout" fullPage="true"> <p:layout id="layout" fullPage="true">
...@@ -102,12 +101,6 @@ ...@@ -102,12 +101,6 @@
<!-- ******************************************************************************** --> <!-- ******************************************************************************** -->
<!-- The following layout unit is within the center and used for the graph. --> <!-- The following layout unit is within the center and used for the graph. -->
<p:layoutUnit position="center"> <p:layoutUnit position="center">
<div style="width: fill-available; height: 100%" id="myfsa" >
</div>
<script type="text/javascript">
</script>
</p:layoutUnit> </p:layoutUnit>
<!-- ******************************************************************************** --> <!-- ******************************************************************************** -->
...@@ -159,7 +152,7 @@ ...@@ -159,7 +152,7 @@
</p:treeNode> </p:treeNode>
<p:treeNode type="reader" icon="ui-icon-folder-open"> <p:treeNode type="reader" icon="ui-icon-folder-open">
<h:form> <h:form>
<p:commandLink> <p:commandLink ajax="true">
<h:outputText value="#{node}"> <h:outputText value="#{node}">
<f:converter converterId="kieker.webgui.converter.ClassToStringConverter"/> <f:converter converterId="kieker.webgui.converter.ClassToStringConverter"/>
</h:outputText> </h:outputText>
...@@ -182,7 +175,7 @@ ...@@ -182,7 +175,7 @@
<!-- ******************************************************************************** --> <!-- ******************************************************************************** -->
</p:layout> </p:layout>
<p:growl id="messages" showDetail="true" autoUpdate="true" sticky="false"/> <p:growl id="messages" showDetail="true" autoUpdate="true" sticky="false"/>
<!-- Include the dialogs for creating/deleting projects etc. --> <!-- Include the dialogs for creating/deleting projects etc. -->
<ui:include src="main\projectDialogs.xhtml" /> <ui:include src="main\projectDialogs.xhtml" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment