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

Continued with the cockpit editor.

parent c826c849
No related branches found
No related tags found
No related merge requests found
...@@ -19,6 +19,7 @@ package kieker.webgui.web.beans.view; ...@@ -19,6 +19,7 @@ package kieker.webgui.web.beans.view;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.faces.application.Application; import javax.faces.application.Application;
import javax.faces.application.FacesMessage; import javax.faces.application.FacesMessage;
...@@ -39,6 +40,7 @@ import kieker.analysis.model.analysisMetaModel.MIView; ...@@ -39,6 +40,7 @@ import kieker.analysis.model.analysisMetaModel.MIView;
import kieker.analysis.model.analysisMetaModel.impl.MAnalysisMetaModelFactory; import kieker.analysis.model.analysisMetaModel.impl.MAnalysisMetaModelFactory;
import kieker.common.logging.Log; import kieker.common.logging.Log;
import kieker.common.logging.LogFactory; import kieker.common.logging.LogFactory;
import kieker.monitoring.core.registry.Registry;
import kieker.webgui.common.exception.NewerProjectException; import kieker.webgui.common.exception.NewerProjectException;
import kieker.webgui.common.exception.ProjectLoadException; import kieker.webgui.common.exception.ProjectLoadException;
import kieker.webgui.common.exception.ProjectNotExistingException; import kieker.webgui.common.exception.ProjectNotExistingException;
...@@ -89,6 +91,9 @@ public final class CurrentCockpitEditorBean { ...@@ -89,6 +91,9 @@ public final class CurrentCockpitEditorBean {
@Autowired @Autowired
private GlobalPropertiesBean globalPropertiesBean; private GlobalPropertiesBean globalPropertiesBean;
private final Registry<MIDisplayConnector> connectors = new Registry<MIDisplayConnector>();
private MIDisplayConnector selectedNode = null;
/** /**
* Creates a new instance of this class. <b>Do not call this constructor manually. It will only be accessed by Spring.</b> * Creates a new instance of this class. <b>Do not call this constructor manually. It will only be accessed by Spring.</b>
*/ */
...@@ -98,6 +103,10 @@ public final class CurrentCockpitEditorBean { ...@@ -98,6 +103,10 @@ public final class CurrentCockpitEditorBean {
this.createDashboard(); this.createDashboard();
} }
public MIDisplayConnector getSelectedNode() {
return this.selectedNode;
}
/** /**
* Creates the initial dashboard object. * Creates the initial dashboard object.
*/ */
...@@ -135,7 +144,7 @@ public final class CurrentCockpitEditorBean { ...@@ -135,7 +144,7 @@ public final class CurrentCockpitEditorBean {
this.currId = 0; this.currId = 0;
for (final MIDisplayConnector connector : connectors) { for (final MIDisplayConnector connector : connectors) {
final Panel panel = (Panel) application.createComponent(fc, "org.primefaces.component.Panel", "org.primefaces.component.PanelRenderer"); final Panel panel = (Panel) application.createComponent(fc, "org.primefaces.component.Panel", "org.primefaces.component.PanelRenderer");
panel.setId("displayConnectorPanel_" + this.currId); panel.setId("displayConnector_" + Integer.toString(this.connectors.get(connector)));
panel.setHeader(connector.getName()); panel.setHeader(connector.getName());
panel.setClosable(true); panel.setClosable(true);
panel.setToggleable(false); panel.setToggleable(false);
...@@ -350,7 +359,7 @@ public final class CurrentCockpitEditorBean { ...@@ -350,7 +359,7 @@ public final class CurrentCockpitEditorBean {
final Application application = fc.getApplication(); final Application application = fc.getApplication();
final Panel panel = (Panel) application.createComponent(fc, "org.primefaces.component.Panel", "org.primefaces.component.PanelRenderer"); final Panel panel = (Panel) application.createComponent(fc, "org.primefaces.component.Panel", "org.primefaces.component.PanelRenderer");
panel.setId("displayConnectorPanel_" + this.currId); panel.setId("displayConnector_" + Integer.toString(this.connectors.get(connector)));
panel.setHeader(connector.getName()); panel.setHeader(connector.getName());
panel.setClosable(true); panel.setClosable(true);
panel.setToggleable(false); panel.setToggleable(false);
...@@ -372,12 +381,24 @@ public final class CurrentCockpitEditorBean { ...@@ -372,12 +381,24 @@ public final class CurrentCockpitEditorBean {
* @param event * @param event
* The onChange-event. * The onChange-event.
*/ */
public void onChange(final TabChangeEvent event) { public synchronized void onChange(final TabChangeEvent event) {
if (event.getData() instanceof MIView) { if (event.getData() instanceof MIView) {
this.setActiveView((MIView) event.getData()); this.setActiveView((MIView) event.getData());
} }
} }
public synchronized void nodeSelected() {
final Map<String, String> paramMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
final String fullID = paramMap.get("id");
final String shortID = fullID.substring(fullID.indexOf(':') + "displayConnector_".length() + 1);
final MIDisplayConnector connector = this.connectors.get(Integer.parseInt(shortID));
if (connector != null) {
this.selectedNode = connector;
}
}
/** /**
* This method checks whether a display connector with the given name exists already. * This method checks whether a display connector with the given name exists already.
* *
......
...@@ -8,4 +8,6 @@ ...@@ -8,4 +8,6 @@
selectView = Ansicht Selektieren selectView = Ansicht Selektieren
copyView = Ansicht Kopieren copyView = Ansicht Kopieren
renameView = Ansicht Umbenennen renameView = Ansicht Umbenennen
deleteView = Ansicht Löschen deleteView = Ansicht Löschen
\ No newline at end of file
name = Name
\ No newline at end of file
...@@ -8,4 +8,6 @@ ...@@ -8,4 +8,6 @@
selectView = Select View selectView = Select View
copyView = Copy View copyView = Copy View
renameView = Rename View renameView = Rename View
deleteView = Delete View deleteView = Delete View
\ No newline at end of file
name = Name
\ No newline at end of file
...@@ -31,6 +31,12 @@ ...@@ -31,6 +31,12 @@
<link rel="stylesheet" type="text/css" href="${root}/css/CockpitEditorPage.css" /> <link rel="stylesheet" type="text/css" href="${root}/css/CockpitEditorPage.css" />
</ui:define> </ui:define>
<ui:define name="furtherForms">
<h:form id="hidden" style="display:none">
<p:remoteCommand autoRun="false" name="nodeSelected" action="#{currentCockpitEditorBean.nodeSelected()}" update=":propertiesForm" />
</h:form>
</ui:define>
<!-- Those are the menu bar entries left from the help-submenu. --> <!-- Those are the menu bar entries left from the help-submenu. -->
<ui:define name="furtherMenuBarEntries"> <ui:define name="furtherMenuBarEntries">
<p:submenu label="#{localizedMessages.file}"> <p:submenu label="#{localizedMessages.file}">
...@@ -51,6 +57,12 @@ ...@@ -51,6 +57,12 @@
<ui:define name="centerContent"> <ui:define name="centerContent">
<h:form id="centerForm"> <h:form id="centerForm">
<ui:fragment rendered="#{not empty currentCockpitEditorBean.activeView}"> <ui:fragment rendered="#{not empty currentCockpitEditorBean.activeView}">
<!-- The following is a workaround necessary due to a bug in Primefaces. -->
<script type="text/javascript">
$('.ui-panel').click(function(event) {
nodeSelected([{name : 'id', value : event.currentTarget.id}]);
});
</script>
<h:outputText value="Description: "/> <h:outputText value="Description: "/>
<p:inplace id="basic" editor="true"> <p:inplace id="basic" editor="true">
<p:inputText value="#{currentCockpitEditorBean.activeView.description}" /> <p:inputText value="#{currentCockpitEditorBean.activeView.description}" />
...@@ -95,11 +107,13 @@ ...@@ -95,11 +107,13 @@
<!-- This is the component presenting the available properties. --> <!-- This is the component presenting the available properties. -->
<p:layoutUnit style="font-size: 12px" position="south" size="150" header="#{localizedMessages.properties}" resizable="true" collapsible="true"> <p:layoutUnit style="font-size: 12px" position="south" size="150" header="#{localizedMessages.properties}" resizable="true" collapsible="true">
<h:form id="propertiesForm" > <h:form id="propertiesForm" >
<p:dataTable editable="true" var="property" rowIndexVar="rowIndex" emptyMessage="#{localizedMessages.noPropertiesAvailable}"> <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"> <p:column headerText="#{localizedMessages.property}" style="width:125px">
<h:outputText id="nameProperty" value="#{localizedCockpitEditorPageMessages.name}" rendered="#{rowIndex == 1}"/>
</p:column> </p:column>
<p:column headerText="#{localizedMessages.value}" style="width:125px"> <p:column headerText="#{localizedMessages.value}" style="width:125px">
<h:outputText value="#{currentCockpitEditorBean.selectedNode.name}" />
</p:column> </p:column>
</p:dataTable> </p:dataTable>
</h:form> </h:form>
......
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