diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/request/NewUserBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/request/NewUserBean.java index d54fc22cdf671474ae61547102e96f78cc6ca7b3..5827eddca9dd446849c8aa932184aa789afc0d09 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/request/NewUserBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/request/NewUserBean.java @@ -31,9 +31,10 @@ import kieker.webgui.domain.User.Role; @Scope("request") public class NewUserBean { - private final Role role; + private Role role; private String username; private String password; + private boolean active; /** * Creates a new instance of this bean and initializes it with empty fields. <b>Do not use this constructor. This bean is Spring managed.</b> @@ -42,6 +43,7 @@ public class NewUserBean { this.role = Role.ROLE_GUEST; this.username = ""; this.password = ""; + this.active = false; } /** @@ -53,6 +55,16 @@ public class NewUserBean { return this.role; } + /** + * Setter for the property {@link NewUserBean#role}. + * + * @param role + * The new value for the property. + */ + public void setRole(final Role role) { + this.role = role; + } + /** * Delivers the current value of the property {@link NewUserBean#username}. * @@ -91,4 +103,23 @@ public class NewUserBean { this.password = password; } + /** + * Delivers the current value of the property {@link NewUserBean#isActive}. + * + * @return The current value of the property. + */ + public boolean isActive() { + return this.active; + } + + /** + * Setter for the property {@link NewUserBean#isActive}. + * + * @param active + * The new value for the property. + */ + public void setActive(final boolean active) { + this.active = active; + } + } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitBean.java index 7ca9a1dcb3b93408b72bb0735ed08e77b788aeed..7fbcc0684f8018f0e15fa1d53568771b5851f530 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitBean.java @@ -17,14 +17,18 @@ package kieker.webgui.web.beans.view; import java.io.IOException; +import java.util.List; +import javax.faces.application.Application; import javax.faces.application.FacesMessage; +import javax.faces.component.html.HtmlOutputText; import javax.faces.context.FacesContext; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; +import kieker.analysis.model.analysisMetaModel.MIDisplayConnector; import kieker.analysis.model.analysisMetaModel.MIProject; import kieker.analysis.model.analysisMetaModel.MIView; import kieker.common.logging.Log; @@ -36,6 +40,13 @@ import kieker.webgui.service.IProjectService; import kieker.webgui.web.beans.application.GlobalPropertiesBean; import kieker.webgui.web.beans.application.ProjectsBean; +import org.primefaces.component.dashboard.Dashboard; +import org.primefaces.component.panel.Panel; +import org.primefaces.model.DashboardColumn; +import org.primefaces.model.DashboardModel; +import org.primefaces.model.DefaultDashboardColumn; +import org.primefaces.model.DefaultDashboardModel; + /** * The {@link CurrentCockpitBean} contains the necessary data behind an instance of the cockpit. It provides methods to read the state of the currently selected * project.<br> @@ -48,6 +59,7 @@ import kieker.webgui.web.beans.application.ProjectsBean; @Scope("view") public final class CurrentCockpitBean { + private static final int NUMBER_COLUMNS = 2; private static final Log LOG = LogFactory.getLog(CurrentCockpitBean.class); @Autowired private IProjectService projectService; @@ -55,6 +67,8 @@ public final class CurrentCockpitBean { private MIProject project; private MIView activeView; private ClassAndMethodContainer classAndMethodContainer; + private Dashboard dashboard; + private DashboardModel dashboardModel; @Autowired private ProjectsBean projectsBean; @@ -62,7 +76,74 @@ public final class CurrentCockpitBean { * Creates a new instance of this class. <b>Do not call this constructor manually. It will only be accessed by Spring.</b> */ public CurrentCockpitBean() { - // No code necessary + this.createDashboard(); + } + + /** + * Creates the initial dashboard object. + */ + private synchronized void createDashboard() { + final FacesContext fc = FacesContext.getCurrentInstance(); + final Application application = fc.getApplication(); + + // Create the primefaces dashboard + this.dashboard = (Dashboard) application.createComponent(fc, "org.primefaces.component.Dashboard", "org.primefaces.component.DashboardRenderer"); + this.dashboard.setId("dashboard"); + + // Create the model and add the columns + this.dashboardModel = new DefaultDashboardModel(); + for (int i = 0; i < CurrentCockpitBean.NUMBER_COLUMNS; i++) { + final DashboardColumn column = new DefaultDashboardColumn(); + this.dashboardModel.addColumn(column); + } + this.dashboard.setModel(this.dashboardModel); + } + + /** + * Fills the initial dashboard object. + */ + private synchronized void fillDashboard() { + // Dump the old entries + this.clearDashboard(); + + // Now add the entries from the current view + if (this.activeView != null) { + final FacesContext fc = FacesContext.getCurrentInstance(); + final Application application = fc.getApplication(); + + // Add a panel for every display connector we have + final List<MIDisplayConnector> connectors = this.activeView.getDisplayConnectors(); + long currId = 0; + for (final MIDisplayConnector connector : connectors) { + final Panel panel = (Panel) application.createComponent(fc, "org.primefaces.component.Panel", "org.primefaces.component.PanelRenderer"); + panel.setId("displayConnectorPanel_" + currId); + panel.setHeader(connector.getName()); + panel.setClosable(false); + panel.setToggleable(false); + + this.getDashboard().getChildren().add(panel); + final DashboardColumn column = this.dashboard.getModel().getColumn(0); + column.addWidget(panel.getId()); + final HtmlOutputText text = new HtmlOutputText(); + text.setValue("N/A"); + + panel.getChildren().add(text); + currId++; + } + } + } + + /** + * Clears the dashboard and removes all children within it. + */ + private synchronized void clearDashboard() { + // Run through all columns of the dashboard and remove the items + final List<DashboardColumn> columns = this.dashboard.getModel().getColumns(); + for (final DashboardColumn column : columns) { + column.getWidgets().clear(); + } + // Now run through the dashboard itself and remove the items as well + this.dashboard.getChildren().clear(); } /** @@ -100,6 +181,7 @@ public final class CurrentCockpitBean { if (this.project != null) { final ClassLoader classLoader = this.projectService.getClassLoader(this.projectName, this); // NOPMD (ClassLoader) this.classAndMethodContainer = new ClassAndMethodContainer(classLoader); + this.fillDashboard(); } } } catch (final ProjectNotExistingException ex) { @@ -181,5 +263,27 @@ public final class CurrentCockpitBean { */ public synchronized void setActiveView(final MIView activeView) { this.activeView = activeView; + + this.fillDashboard(); + } + + /** + * Getter for the property {@link CurrentCockpitEditorBean#dashboard}. + * + * @return The current value of the property. + */ + public synchronized Dashboard getDashboard() { + return this.dashboard; + } + + /** + * Setter for the property {@link CurrentCockpitEditorBean#dashboard}. + * + * @param dashboard + * The new value for the property. + */ + public synchronized void setDashboard(final Dashboard dashboard) { + this.dashboard = dashboard; + this.dashboard.setModel(this.dashboardModel); } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitEditorBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitEditorBean.java index 18bc12e33fceb13f08c72f2040178299e7c709bd..41a019cc0d434b5d7c64326170389dffa5104491 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitEditorBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitEditorBean.java @@ -21,7 +21,6 @@ import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; -import java.util.UUID; import javax.faces.application.Application; import javax.faces.application.FacesMessage; @@ -80,6 +79,7 @@ public final class CurrentCockpitEditorBean { private IProjectService projectService; private ClassAndMethodContainer classAndMethodContainer; + private long currId; private long timeStamp; private String projectName; private MIProject project; @@ -133,22 +133,22 @@ public final class CurrentCockpitEditorBean { // Add a panel for every display connector we have final List<MIDisplayConnector> connectors = this.activeView.getDisplayConnectors(); - int i = 0; + this.currId = 0; for (final MIDisplayConnector connector : connectors) { final Panel panel = (Panel) application.createComponent(fc, "org.primefaces.component.Panel", "org.primefaces.component.PanelRenderer"); - panel.setId("displayConnectorPanel_" + i); + panel.setId("displayConnectorPanel_" + this.currId); panel.setHeader(connector.getName()); panel.setClosable(true); panel.setToggleable(false); this.getDashboard().getChildren().add(panel); - final DashboardColumn column = this.dashboard.getModel().getColumn(i % CurrentCockpitEditorBean.NUMBER_COLUMNS); + final DashboardColumn column = this.dashboard.getModel().getColumn(0); column.addWidget(panel.getId()); final HtmlOutputText text = new HtmlOutputText(); text.setValue("N/A"); panel.getChildren().add(text); - i++; + this.currId++; } } } @@ -388,7 +388,7 @@ public final class CurrentCockpitEditorBean { if (this.activeView != null) { final MIDisplayConnector connector = this.factory.createDisplayConnector(); connector.setDisplay(display); - connector.setName(UUID.randomUUID().toString()); + connector.setName("Display " + this.currId); this.activeView.getDisplayConnectors().add(connector); // Now add it to the dashboard as well @@ -396,18 +396,19 @@ public final class CurrentCockpitEditorBean { final Application application = fc.getApplication(); final Panel panel = (Panel) application.createComponent(fc, "org.primefaces.component.Panel", "org.primefaces.component.PanelRenderer"); - panel.setId("displayConnectorPanel_" + (this.dashboard.getChildCount() + 1)); + panel.setId("displayConnectorPanel_" + this.currId); panel.setHeader(connector.getName()); panel.setClosable(true); panel.setToggleable(false); this.getDashboard().getChildren().add(panel); - final DashboardColumn column = this.dashboardModel.getColumn(CurrentCockpitEditorBean.NUMBER_COLUMNS - 1); + final DashboardColumn column = this.dashboardModel.getColumn(0); column.addWidget(panel.getId()); final HtmlOutputText text = new HtmlOutputText(); - text.setValue("N/A"); + text.setValue(display.getName()); panel.getChildren().add(text); + this.currId++; } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentUserManagementBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentUserManagementBean.java index 64422baff8f1aa778acd8009d296eadc008658f5..a87f46a0b05ca09119e6ea22948d2a36cad81c2a 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentUserManagementBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentUserManagementBean.java @@ -73,7 +73,6 @@ public final class CurrentUserManagementBean { */ public void addUser(final String username, final String password, final Role role, final boolean isEnabled) { final User user = new User(username, password, role, isEnabled); - try { this.userService.addUser(user); this.availableUses.add(user); @@ -95,7 +94,7 @@ public final class CurrentUserManagementBean { this.availableUses.remove(user); GlobalPropertiesBean.showMessage(FacesMessage.SEVERITY_INFO, "Deleted user from the database."); } catch (final DataAccessException ex) { - GlobalPropertiesBean.showMessage(FacesMessage.SEVERITY_ERROR, "Could not deleted the user from the database."); + GlobalPropertiesBean.showMessage(FacesMessage.SEVERITY_ERROR, "Could not delete the user from the database."); } } @@ -110,7 +109,7 @@ public final class CurrentUserManagementBean { this.userService.editUser(user); GlobalPropertiesBean.showMessage(FacesMessage.SEVERITY_INFO, "Modified user within the database."); } catch (final DataAccessException ex) { - GlobalPropertiesBean.showMessage(FacesMessage.SEVERITY_ERROR, "Could not modified the user within the database."); + GlobalPropertiesBean.showMessage(FacesMessage.SEVERITY_ERROR, "Could not modify the user within the database."); } } diff --git a/Kieker.WebGUI/src/main/resources/lang/Common_de.properties b/Kieker.WebGUI/src/main/resources/lang/Common_de.properties index edcc9c75283fec1aef6321d29e138e5f9f84d515..418ca5572f452013af3021a12780aa22e4b6740a 100644 --- a/Kieker.WebGUI/src/main/resources/lang/Common_de.properties +++ b/Kieker.WebGUI/src/main/resources/lang/Common_de.properties @@ -6,6 +6,7 @@ #------------------------------------------------------------------------------ yes = Ja +no = Nein ok = Ok cancel = Abbrechen diff --git a/Kieker.WebGUI/src/main/resources/lang/Common_en.properties b/Kieker.WebGUI/src/main/resources/lang/Common_en.properties index 8e8211b5f25902b85034ff113c125684fa1947f7..db7a6787e6088f3820a395cd76387bdfa7d2e0e9 100644 --- a/Kieker.WebGUI/src/main/resources/lang/Common_en.properties +++ b/Kieker.WebGUI/src/main/resources/lang/Common_en.properties @@ -6,6 +6,7 @@ #------------------------------------------------------------------------------ yes = Yes +no = No ok = Ok cancel = Cancel diff --git a/Kieker.WebGUI/src/main/webapp/css/CockpitEditorPage.css b/Kieker.WebGUI/src/main/webapp/css/CockpitEditorPage.css index b8ba3d1698a06a5114ce925c26849a33760815c8..62e66bd9e0a61104fd383ef39cafa72eeb71c3d5 100644 --- a/Kieker.WebGUI/src/main/webapp/css/CockpitEditorPage.css +++ b/Kieker.WebGUI/src/main/webapp/css/CockpitEditorPage.css @@ -3,4 +3,13 @@ /* This is necessary to remove the border from the datalist */ .ui-datalist * { border : 0px !important; +} + +.ui-dashboard-column { + width: 50% !important; + column-width: 50% !important; +} + +.ui-panel { + cursor: pointer; } \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/css/CockpitPage.css b/Kieker.WebGUI/src/main/webapp/css/CockpitPage.css index f76427d5f35cb64de7850e8f43df2255b9d2f0f4..d7f586460e805e13c715fce9ac522ff2ff5f9e0b 100644 --- a/Kieker.WebGUI/src/main/webapp/css/CockpitPage.css +++ b/Kieker.WebGUI/src/main/webapp/css/CockpitPage.css @@ -4,6 +4,11 @@ ui-dashboard-column { width: 50% } +.ui-dashboard-column { + width: 50% !important; + column-width: 50% !important; +} + /* This is necessary to remove the border from the datalist */ .ui-datalist * { border : 0px !important; diff --git a/Kieker.WebGUI/src/main/webapp/dialogs/UserManagementDialogs.xhtml b/Kieker.WebGUI/src/main/webapp/dialogs/UserManagementDialogs.xhtml index 00a2a4282a9abd797e3e333dd4c8c4880e57cbc6..fb9e94bcfa8b312d8f65e87519b8169807ab3bd2 100644 --- a/Kieker.WebGUI/src/main/webapp/dialogs/UserManagementDialogs.xhtml +++ b/Kieker.WebGUI/src/main/webapp/dialogs/UserManagementDialogs.xhtml @@ -14,8 +14,7 @@ <p:inputText value="#{newUserBean.username}" style="width: 100%" /> <h:outputText value="Passwort: " /> - <p:inputText value="#{newUserBean.password}" style="width: 100%" /> - + <p:password feedback="true" value="#{newUserBean.password}" style="width: 100%" /> <h:outputText value="Benutzerrolle: " /> <p:selectOneRadio value="#{newUserBean.role}" converter="roleStringConverter"> @@ -25,7 +24,7 @@ </p:selectOneRadio> <h:outputText value="Status: " /> - <p:selectOneRadio> + <p:selectOneRadio value="#{newUserBean.active}"> <f:selectItem itemLabel="Aktiviert" itemValue="#{true}" /> <f:selectItem itemLabel="Deaktiviert" itemValue="#{false}" /> </p:selectOneRadio> @@ -33,7 +32,7 @@ <hr/> <div style="text-align: right"> - <p:commandButton value="#{localizedMessages.ok}" action="#{currentUserManagementBean.addUser(newUserBean.username, newUserBean.password, newUserBean.role, true)}" oncomplete="newUserDlg.hide()" update=":usersListForm"/> + <p:commandButton value="#{localizedMessages.ok}" action="#{currentUserManagementBean.addUser(newUserBean.username, newUserBean.password, newUserBean.role, newUserBean.active)}" oncomplete="newUserDlg.hide()" ajax="true" update=":messages :usersListForm"/> </div> </h:form> </p:dialog> diff --git a/Kieker.WebGUI/src/main/webapp/pages/CockpitEditorPage.xhtml b/Kieker.WebGUI/src/main/webapp/pages/CockpitEditorPage.xhtml index cda5721a49cd93928a414b473f4b998404453dea..a8b1cbfc44e0831b193d3e7b98ef76b5bbba1deb 100644 --- a/Kieker.WebGUI/src/main/webapp/pages/CockpitEditorPage.xhtml +++ b/Kieker.WebGUI/src/main/webapp/pages/CockpitEditorPage.xhtml @@ -31,7 +31,6 @@ <link rel="stylesheet" type="text/css" href="${root}/css/CockpitEditorPage.css" /> </ui:define> - <!-- Those are the menu bar entries left from the help-submenu. --> <ui:define name="furtherMenuBarEntries"> <p:submenu label="#{localizedMessages.file}"> @@ -98,7 +97,7 @@ <h:form id="propertiesForm" > <p:dataTable editable="true" var="property" rowIndexVar="rowIndex" emptyMessage="#{localizedMessages.noPropertiesAvailable}"> <p:column headerText="#{localizedMessages.property}" style="width:125px"> - </p:column> + </p:column> <p:column headerText="#{localizedMessages.value}" style="width:125px"> </p:column> diff --git a/Kieker.WebGUI/src/main/webapp/pages/CockpitPage.xhtml b/Kieker.WebGUI/src/main/webapp/pages/CockpitPage.xhtml index f54465a40997b534ff9373fb854d03cabfe95053..95c894071d4c7112ed813391989297a8e48d9cbe 100644 --- a/Kieker.WebGUI/src/main/webapp/pages/CockpitPage.xhtml +++ b/Kieker.WebGUI/src/main/webapp/pages/CockpitPage.xhtml @@ -44,11 +44,7 @@ <ui:define name="centerContent"> <h:form id="centerForm"> - <ui:repeat value="#{currentCockpitBean.activeView.displayConnectors}" var="dispConnector"> - <p:panel header="#{dispConnector.name}"> - <h:outputText value="#{currentCockpitBean.updatePlainTextDisplay(dispConnector.name)}"/> - </p:panel> - </ui:repeat> + <p:dashboard disabled="true" id="dynamicDashboard" binding="#{currentCockpitBean.dashboard}"/> </h:form> </ui:define> diff --git a/Kieker.WebGUI/src/main/webapp/pages/ProjectOverviewPage.xhtml b/Kieker.WebGUI/src/main/webapp/pages/ProjectOverviewPage.xhtml index dec28c8943ccb6b3509bb8df7d5b8ec7b41ab9cf..4c60dc7a1e0ac7b187b73f2831bfd6ab462351a1 100644 --- a/Kieker.WebGUI/src/main/webapp/pages/ProjectOverviewPage.xhtml +++ b/Kieker.WebGUI/src/main/webapp/pages/ProjectOverviewPage.xhtml @@ -68,9 +68,9 @@ </p:menuitem> <c:if test="#{sec:areAnyGranted('User, Administrator')}"> <p:separator/> - <p:menuitem id="copyButton" icon="ui-icon-copy" styleClass="element-with-whitespace" value=" #{localizedProjectOverviewMessages.copyProject}" action="#{currentProjectOverviewBean.setProjectName(project)}" onclick="copyProjectDialog.show()"/> - <p:menuitem id="renameButton" icon="ui-icon-edit" styleClass="element-with-whitespace" value=" #{localizedProjectOverviewMessages.renameProject}" action="#{currentProjectOverviewBean.setProjectName(project)}" onclick="renameProjectDialog.show()" disabled="true"/> - <p:menuitem id="deleteButton" icon="ui-icon-delete" styleClass="element-with-whitespace" value=" #{localizedProjectOverviewMessages.deleteProject}" action="#{currentProjectOverviewBean.setProjectName(project)}" onclick="deleteProjectDialog.show()" disabled="true"/> + <p:menuitem id="copyButton" icon="ui-icon-copy" styleClass="element-with-whitespace" value=" #{localizedProjectOverviewMessages.copyProject}" action="#{currentProjectOverviewBean.setProjectName(project)}" onclick="copyProjectDialog.show()" update=":messages"/> + <p:menuitem id="renameButton" icon="ui-icon-edit" styleClass="element-with-whitespace" value=" #{localizedProjectOverviewMessages.renameProject}" action="#{currentProjectOverviewBean.setProjectName(project)}" onclick="renameProjectDialog.show()" disabled="true" update=":messages"/> + <p:menuitem id="deleteButton" icon="ui-icon-delete" styleClass="element-with-whitespace" value=" #{localizedProjectOverviewMessages.deleteProject}" action="#{currentProjectOverviewBean.setProjectName(project)}" onclick="deleteProjectDialog.show()" disabled="true" update=":messages"/> </c:if> </p:menu> </p:column> diff --git a/Kieker.WebGUI/src/main/webapp/pages/admin/UserManagementPage.xhtml b/Kieker.WebGUI/src/main/webapp/pages/admin/UserManagementPage.xhtml index 249419492bf20f530dd95a666857a8f2e6b8f33e..0a341ca0090ca3c810c8378c2a3f50e3d7d9069e 100644 --- a/Kieker.WebGUI/src/main/webapp/pages/admin/UserManagementPage.xhtml +++ b/Kieker.WebGUI/src/main/webapp/pages/admin/UserManagementPage.xhtml @@ -26,7 +26,7 @@ <!-- Those are the menu bar entries left from the help-submenu. --> <ui:define name="furtherMenuBarEntries"> <p:submenu label="#{localizedMessages.file}"> - <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-newProject" value=" #{localizedUserManagementMessages.newUser}" onclick="newUserDlg.show()" ajax="true"/> + <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-newProject" value=" #{localizedUserManagementMessages.newUser}" onclick="newUserDlg.show();" ajax="true"/> <p:separator/> <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-reload" value=" #{localizedUserManagementMessages.updateUserList}" update=":usersListForm" action="#{currentUserManagementBean.updateList()}" ajax="true"/> <p:separator/> diff --git a/Kieker.WebGUI/src/main/webapp/templates/CommonTemplate.xhtml b/Kieker.WebGUI/src/main/webapp/templates/CommonTemplate.xhtml index 45bad11dbf3740bc1d03678892ca6e29acdf6c5c..efced5aff96222231ab8f2ba9080009ef492544b 100644 --- a/Kieker.WebGUI/src/main/webapp/templates/CommonTemplate.xhtml +++ b/Kieker.WebGUI/src/main/webapp/templates/CommonTemplate.xhtml @@ -35,7 +35,7 @@ <h:body onload="bodyLoaded();"> <ui:insert name="content"/> - <p:growl id="messages" life="1500" showDetail="true" autoUpdate="true" sticky="true" widgetVar="msgs"/> + <p:growl id="messages" life="1500" showDetail="true" sticky="true" widgetVar="msgs"/> </h:body> </html>