From 3a83e63d5cf59ee60a5fa9d9da6aa81d045878ff Mon Sep 17 00:00:00 2001
From: Nils Christian Ehmke <nie@informatik.uni-kiel.de>
Date: Thu, 2 Aug 2012 17:18:27 +0200
Subject: [PATCH] Advanced the tooltips

---
 .../beans/view/CurrentAnalysisEditorBean.java | 61 +++++++++++++-
 .../src/main/webapp/AnalysisEditor.xhtml      | 83 +++++++++++--------
 2 files changed, 106 insertions(+), 38 deletions(-)

diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorBean.java
index f9a217b0..8690ebb0 100644
--- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorBean.java
+++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorBean.java
@@ -22,6 +22,7 @@ package kieker.webgui.beans.view;
 
 import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.net.MalformedURLException;
 import java.util.ArrayList;
@@ -51,7 +52,10 @@ import kieker.analysis.model.analysisMetaModel.MIRepository;
 import kieker.analysis.model.analysisMetaModel.MIRepositoryConnector;
 import kieker.analysis.model.analysisMetaModel.impl.MAnalysisMetaModelFactory;
 import kieker.analysis.plugin.AbstractPlugin;
+import kieker.analysis.plugin.annotation.InputPort;
+import kieker.analysis.plugin.annotation.OutputPort;
 import kieker.analysis.plugin.annotation.Plugin;
+import kieker.analysis.plugin.annotation.RepositoryPort;
 import kieker.analysis.plugin.filter.AbstractFilterPlugin;
 import kieker.analysis.plugin.reader.AbstractReaderPlugin;
 import kieker.analysis.repository.AbstractRepository;
@@ -469,6 +473,53 @@ public final class CurrentAnalysisEditorBean {
 		}
 	}
 
+	public List<InputPort> getInputPorts(final Class<?> clazz) {
+		final ArrayList<InputPort> result = new ArrayList<InputPort>();
+
+		for (final Method method : clazz.getMethods()) {
+			// Get the potential annotation
+			final InputPort annotationPort = method.getAnnotation(InputPort.class);
+			// Now check whether it is available
+			if (annotationPort != null) {
+				result.add(annotationPort);
+			}
+		}
+
+		return result;
+	}
+
+	public List<OutputPort> getOutputPorts(final Class<?> clazz) {
+		final ArrayList<OutputPort> result = new ArrayList<OutputPort>();
+
+		// Get the potential annotation
+		final Plugin annotationPlugin = clazz.getAnnotation(Plugin.class);
+
+		// Now check whether it is available
+		if (annotationPlugin != null) {
+			for (final OutputPort oPort : annotationPlugin.outputPorts()) {
+				result.add(oPort);
+			}
+		}
+
+		return result;
+	}
+
+	public List<RepositoryPort> getRepositoryPorts(final Class<?> clazz) {
+		final ArrayList<RepositoryPort> result = new ArrayList<RepositoryPort>();
+
+		// Get the potential annotation
+		final Plugin annotationPlugin = clazz.getAnnotation(Plugin.class);
+
+		// Now check whether it is available
+		if (annotationPlugin != null) {
+			for (final RepositoryPort rPort : annotationPlugin.repositoryPorts()) {
+				result.add(rPort);
+			}
+		}
+
+		return result;
+	}
+
 	/**
 	 * This method is the handler for the file upload. It tries to upload the given file and informs the user via the growl-component.
 	 * 
@@ -1010,16 +1061,20 @@ public final class CurrentAnalysisEditorBean {
 	}
 
 	/**
-	 * This method delivers the properties of the currently selected plugin, but it adds also the name-property as a string to the list.
+	 * This method delivers the properties of the currently selected plugin, but it adds also the name- and the class-properties as a string to the list. The first
+	 * element is always the classname, the second one is always the pluginname.
 	 * 
-	 * @return A list with all properties of the plugin plus the name-property. If no plugin is selected, an empty list will be returned.
+	 * @return A list with all properties of the plugin plus the name- and class-properties. If no plugin is selected, the list of the selected repository is
+	 *         delivered.
 	 */
 	public List<Object> getAdvancedPluginProperties() {
 		synchronized (this) {
 			final List<Object> result = new ArrayList<Object>();
 
-			// Add the name-property as a string
+			// Add the properties as strings
 			result.add("Name");
+			result.add("ClassName");
+
 			// Get the original properties of the plugin
 			if (this.selectedPlugin != null) {
 				result.addAll(this.selectedPlugin.getProperties());
diff --git a/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml b/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml
index e868bde9..85c77e30 100644
--- a/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml
+++ b/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml
@@ -25,6 +25,9 @@
             .connector {
                 background-color: #FF9900;
             }
+            .ui-datalist * {
+                border : 0px !important;
+            }
         </style>
     </h:head>
 
@@ -124,20 +127,22 @@
 
             <p:layoutUnit style="font-size: 12px" position="south" size="150" header="Properties" resizable="true" collapsible="true">
                 <h:form id="propertiesForm" >
-                    <p:dataTable editable="true" value="#{currentAnalysisEditorBean.advancedPluginProperties}" var="property" emptyMessage="No properties available" rendered="#{not empty currentAnalysisEditorBean.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:dataTable editable="true" value="#{currentAnalysisEditorBean.advancedPluginProperties}" var="property" rowIndexVar="rowIndex" emptyMessage="No properties available" rendered="#{not empty currentAnalysisEditorBean.selectedPlugin}">
+                        <p:column headerText="Property" style="width:125px">
+                            <h:outputText value="#{property.name}" rendered="#{rowIndex > 1}"/>
+                            <h:outputText value="Name" rendered="#{rowIndex == 1}"/>
+                            <h:outputText value="ClassName" rendered="#{rowIndex == 0}"/>
                         </p:column>
 
                         <p:column headerText="Value" style="width:125px">
-                            <p:inplace editor="true" rendered="#{not stringBean.checkString(property)}">  
+                            <p:inplace editor="true" rendered="#{rowIndex > 1}">  
                                 <p:inputText value="#{property.value}" />
                             </p:inplace>  
-                            <p:inplace editor="true" rendered="#{stringBean.checkString(property)}" >  
+                            <p:inplace editor="true" rendered="#{rowIndex == 1}" >  
                                 <p:inputText value="#{currentAnalysisEditorBean.selectedPlugin.name}" />
                                 <p:ajax event="save" update=":centerForm" />
                             </p:inplace>  
+                            <h:outputText value="#{currentAnalysisEditorBean.selectedPlugin.classname}" rendered="#{rowIndex == 0}"/>
                         </p:column>                       
                     </p:dataTable>
                 </h:form>
@@ -152,48 +157,56 @@
                         <p:tab title="Reader">
                             <ui:repeat value="#{currentAnalysisEditorBean.availableReaders}" var="reader">
                                 <p:commandLink id="readerLink" value="#{reader.simpleName}" action="#{currentAnalysisEditorBean.addPlugin(reader)}" update=":centerForm :messages" /><br/>
-                                <p:tooltip style="font-size: 15px" for="readerLink" value="#{currentAnalysisEditorBean.getDescription(reader)}"/>
+                                <p:tooltip style="font-size: 15px" for="readerLink">
+                                    <b><h:outputText value="#{reader.simpleName} (#{reader.name})"/></b>
+                                    <br/>
+                                    <h:outputText value="#{currentAnalysisEditorBean.getDescription(reader)}"/>
+                                    <br/><br/>
+                                    <b><h:outputText value="Output Ports:"/></b>
+                                    <p:dataList value="#{currentAnalysisEditorBean.getOutputPorts(reader)}" var="port">
+                                        #{port.name()}
+                                    </p:dataList>
+                                    <b><h:outputText value="Repository Ports:"/></b>
+                                    <p:dataList value="#{currentAnalysisEditorBean.getRepositoryPorts(reader)}" var="port">
+                                        #{port.name()}
+                                    </p:dataList>
+                                </p:tooltip>
                             </ui:repeat>
                         </p:tab>
                         <p:tab title="Filter">
                             <ui:repeat value="#{currentAnalysisEditorBean.availableFilters}" var="filter">
                                 <p:commandLink id="filterLink" value="#{filter.simpleName}" action="#{currentAnalysisEditorBean.addPlugin(filter)}" update=":centerForm :messages"/><br/>
-                                <p:tooltip style="font-size: 15px" for="filterLink" value="#{currentAnalysisEditorBean.getDescription(filter)}"/>
+                                <p:tooltip style="font-size: 15px" for="filterLink">
+                                    <b><h:outputText value="#{filter.simpleName} (#{filter.name})"/></b>
+                                    <br/>
+                                    <h:outputText value="#{currentAnalysisEditorBean.getDescription(filter)}"/>
+                                    <br/><br/>
+                                    <b><h:outputText value="Input Ports:"/></b>
+                                    <p:dataList value="#{currentAnalysisEditorBean.getInputPorts(filter)}" var="port">
+                                        #{port.name()}
+                                    </p:dataList>
+                                    <b><h:outputText value="Output Ports:"/></b>
+                                    <p:dataList value="#{currentAnalysisEditorBean.getOutputPorts(filter)}" var="port">
+                                        #{port.name()}
+                                    </p:dataList>
+                                    <b><h:outputText value="Repository Ports:"/></b>
+                                    <p:dataList value="#{currentAnalysisEditorBean.getRepositoryPorts(filter)}" var="port">
+                                        #{port.name()}
+                                    </p:dataList>
+                                </p:tooltip>                                
                             </ui:repeat>
                         </p:tab>
                         <p:tab title="Repositories">
                             <ui:repeat value="#{currentAnalysisEditorBean.availableRepositories}" var="repository">
                                 <p:commandLink id="repositoryLink" value="#{repository.simpleName}" action="#{currentAnalysisEditorBean.addRepository(repository)}" update=":centerForm :messages"/><br/>
-                                <p:tooltip style="font-size: 15px" for="repositoryLink" value="#{currentAnalysisEditorBean.getDescription(repository)}"/>
+                                <p:tooltip style="font-size: 15px" for="repositoryLink">
+                                    <b><h:outputText value="#{repository.simpleName} repositoryfilter.name})"/></b>
+                                    <br/>
+                                    <h:outputText value="#{currentAnalysisEditorBean.getDescription(repository)}"/>
+                                </p:tooltip>  
                             </ui:repeat>
                         </p:tab>
                     </p:accordionPanel>
-                    <p:tree id="docTree" value="#{currentAnalysisEditorBean.availableComponentsAsRoot}" var="elem">
-                        <p:treeNode type="default">
-                            <h:outputText value="#{elem}" />
-                        </p:treeNode>
-
-                        <p:treeNode type="filterLeaf">
-                            <h:form>
-                                <p:commandLink id="filterLink" value="#{elem.simpleName}" action="#{currentAnalysisEditorBean.addPlugin(elem)}" update=":centerForm :messages"/><br/>
-                                <p:tooltip style="font-size: 15px" for="filterLink" value="#{currentAnalysisEditorBean.getDescription(elem)}"/>
-                            </h:form>
-                        </p:treeNode>
-
-                        <p:treeNode type="readerLeaf">
-                            <h:form>
-                                <p:commandLink id="readerLink1" value="#{elem.simpleName}" action="#{currentAnalysisEditorBean.addPlugin(elem)}" update=":centerForm :messages"/><br/>
-                                <p:tooltip style="font-size: 15px" for="readerLink1" value="#{currentAnalysisEditorBean.getDescription(elem)}"/>
-                            </h:form>
-                        </p:treeNode>
-
-                        <p:treeNode type="repositoryLeaf">
-                            <h:form>
-                                <p:commandLink id="repositoryLink" value="#{elem.simpleName}" action="#{currentAnalysisEditorBean.addRepository(elem)}" update=":centerForm :messages"/><br/>
-                                <p:tooltip style="font-size: 15px" for="repositoryLink" value="#{currentAnalysisEditorBean.getDescription(elem)}"/>
-                            </h:form>
-                        </p:treeNode>
-                    </p:tree>
                 </h:form>
             </p:layoutUnit>
             <!-- ******************************************************************************** -->
-- 
GitLab