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

Visible components within the WorkSpace; Plugins can now be selected and partially be modified.

parent 0c9c78a8
No related branches found
No related tags found
No related merge requests found
......@@ -113,6 +113,8 @@ public final class CurrentWorkSpaceProjectBean {
*/
private final List<Class<AbstractReaderPlugin>> availableReaders = Collections.synchronizedList(new ArrayList<Class<AbstractReaderPlugin>>());
private MIPlugin selectedPlugin;
/**
* Creates a new instance of this class.
*/
......@@ -269,6 +271,7 @@ public final class CurrentWorkSpaceProjectBean {
this.project = null;
this.projectName = null;
this.classLoader = null;
this.selectedPlugin = null;
this.timeStamp = 0;
return CurrentWorkSpaceProjectBean.PAGE_PROJECT_OVERVIEW;
......@@ -542,6 +545,43 @@ public final class CurrentWorkSpaceProjectBean {
this.project.getPlugins().add(plugin);
}
/**
* This method removes the given plugin from the project. If it is also the currently selected plugin, it will be deselected.
*
* @param plugin
* The plugin to be removed from the project.
*/
public void removePlugin(final MIPlugin plugin) {
this.project.getPlugins().remove(plugin);
if (this.selectedPlugin == plugin) {
this.selectedPlugin = null;
}
}
public MIPlugin getSelectedPlugin() {
return this.selectedPlugin;
}
public void setSelectedPlugin(final MIPlugin selectedPlugin) {
this.selectedPlugin = selectedPlugin;
}
/**
* This method delivers the properties of the currently selected plugin, but it adds also the name-property as a string to the list.
*
* @return A list with all properties of the plugin plus the name-property. If no plugin is selected, an empty list will be returned.
*/
public List<Object> getAdvancedPluginProperties() {
final List<Object> result = new ArrayList<Object>();
// Add the name-property as a string
result.add("Name");
// Get the original properties of the plugin
result.addAll(this.selectedPlugin.getProperties());
return result;
}
/**
* This method shows the current user a message by using the growl-component of PrimeFaces.
*
......@@ -553,4 +593,5 @@ public final class CurrentWorkSpaceProjectBean {
private static void showMessage(final Severity severity, final String msg) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(severity, "", msg));
}
}
......@@ -13,9 +13,17 @@
<link rel="stylesheet" type="text/css" href="../css/ProjectWorkSpace.css" />
<script type="text/javascript" src="../js/js-graph-it.js"/>
<link rel="stylesheet" type="text/css" href="../css/js-graph-it.css"/>
<style>
.block {
position: absolute;
}
.connector {
background-color: #FF9900;
}
</style>
</h:head>
<h:body>
<h:body onload="initPageObjects();">
<p:layout id="layout" fullPage="true">
<p:layoutUnit position="north" collapsible="false" header="Kieker.WebGUI">
......@@ -49,14 +57,51 @@
<p:layoutUnit position="center" id="centerLayout">
<h:form id="centerForm" style="height: 100%">
<h:form id="centerForm" style="height: 100%" rendered="#{not empty currentWorkSpaceProjectBean.project}">
<div class="canvas" id="mainCanvas" style="width : 500px;height: 500px">
<ui:repeat value="#{currentWorkSpaceProjectBean.project.plugins}" var="plugin" varStatus="counter">
<p:remoteCommand name="setPlugin#{counter.index}" action="#{currentWorkSpaceProjectBean.setSelectedPlugin(plugin)}" update=":propertiesForm"/>
<!-- Netbeans reports an error here, but the code does still work though... -->
<div onclick="setPlugin#{counter.index}();" 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="Connections" update=":connectionDialogForm" onclick="connectionDialog.show();"/>
<br/>
<p:commandLink ajax="true" value="Remove" action="#{currentWorkSpaceProjectBean.removePlugin(plugin)}" update=":propertiesForm :centerForm"/>
</div>
</ui:repeat>
</div>
</h:form>
</p:layoutUnit>
</p:layoutUnit>
<p:layoutUnit position="south" size="150" header="Properties" resizable="true" collapsible="true">
<h:form id="propertiesForm">
<h:form id="propertiesForm" >
<p:dataTable value="#{currentWorkSpaceProjectBean.advancedPluginProperties}" var="property" emptyMessage="No properties available" rendered="#{not empty currentWorkSpaceProjectBean.selectedPlugin}">
<p:column headerText="Key" style="width:125px">
<h:outputText value="#{property.name}" rendered="#{not stringBean.checkString(property)}"/>
<h:outputText value="Name" rendered="#{stringBean.checkString(property)}"/>
</p:column>
<p:column headerText="Value" style="width:125px">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{property.value}" rendered="#{not stringBean.checkString(property)}"/>
<h:outputText value="#{selectedPluginBean.plugin.name}" rendered="#{stringBean.checkString(property)}"/>
</f:facet>
<f:facet name="input">
<h:inputText value="#{property.value}" rendered="#{not stringBean.checkString(property)}"/>
<h:inputText value="#{selectedPluginBean.plugin.name}" rendered="#{stringBean.checkString(property)}"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Options" style="width:50px">
<p:rowEditor />
</p:column>
<p:ajax event="rowEdit" update=":centerForm" />
</p:dataTable>
</h:form>
</p:layoutUnit>
......@@ -66,19 +111,19 @@
<p:accordionPanel multiple="true" activeIndex="">
<p:tab title="Reader">
<ui:repeat value="#{currentWorkSpaceProjectBean.availableReaders}" var="reader">
<p:commandLink id="readerLink" value="#{reader.simpleName}" action="#{currentWorkSpaceProjectBean.addPlugin(reader)}" update=":centerForm" /><br/>
<p:commandLink id="readerLink" value="#{reader.simpleName}" action="#{currentWorkSpaceProjectBean.addPlugin(reader)}" update=":centerForm :messages" /><br/>
<p:tooltip style="font-size: 15px" for="readerLink" value="#{currentWorkSpaceProjectBean.getDescription(reader)}"/>
</ui:repeat>
</p:tab>
<p:tab title="Filter">
<ui:repeat value="#{currentWorkSpaceProjectBean.availableFilters}" var="filter">
<p:commandLink id="filterLink" value="#{filter.simpleName}" action="#{currentWorkSpaceProjectBean.addPlugin(filter)}" update=":centerForm"/><br/>
<p:commandLink id="filterLink" value="#{filter.simpleName}" action="#{currentWorkSpaceProjectBean.addPlugin(filter)}" update=":centerForm :messages"/><br/>
<p:tooltip style="font-size: 15px" for="filterLink" value="#{currentWorkSpaceProjectBean.getDescription(filter)}"/>
</ui:repeat>
</p:tab>
<p:tab title="Repositories">
<ui:repeat value="#{currentWorkSpaceProjectBean.availableRepositories}" var="repository">
<p:commandLink id="repositoryLink" value="#{repository.simpleName}" action="#{currentWorkSpaceProjectBean.addRepository(repository)}" update=":centerForm"/><br/>
<p:commandLink id="repositoryLink" value="#{repository.simpleName}" action="#{currentWorkSpaceProjectBean.addRepository(repository)}" update=":centerForm :messages"/><br/>
<p:tooltip style="font-size: 15px" for="repositoryLink" value="#{currentWorkSpaceProjectBean.getDescription(repository)}"/>
</ui:repeat>
</p:tab>
......
......@@ -7,7 +7,7 @@
xmlns:c="http://java.sun.com/jsp/jstl/core">
<p:dialog id="connectionDialog" header="Manage Connections" resizable="false" modal="true" widgetVar="connectionDialog">
<h:form id="connectionDialogForm" rendered="#{not empty selectedMainProjectBean.mainProject}">
<h:form id="connectionDialogForm" rendered="#{not empty currentWorkSpaceProjectBean.project}">
</h:form>
</p:dialog>
......
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