Skip to content
Snippets Groups Projects
CockpitEditorPage.xhtml 11.5 KiB
Newer Older
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
        <ui:composition template="/templates/PagesTemplate.xhtml">
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
            <ui:param name="unsavedModifications" value="#{currentCockpitEditorBean.unsavedModification}"/>
            <ui:param name="projectName" value="#{currentCockpitEditorBean.projectName}"/>
            <ui:param name="pagename" value="cockpitEditor"/>
            <ui:param name="showProjectName" value="true"/>

            <ui:define name="metaData">
                <f:metadata>
                    <f:viewParam name="projectName" value="#{currentCockpitEditorBean.projectName}"/>
                    <f:event type="preRenderView" listener="#{currentCockpitEditorBean.initalize()}"  />
                </f:metadata>
            </ui:define>

            <ui:define name="bundleIncludes">
                <f:loadBundle var="localizedCockpitEditorPageMessages" basename="lang.CockpitEditorPage"/>
            </ui:define>

            <ui:define name="cssIncludes">
                <link rel="stylesheet" type="text/css" href="${root}/css/CockpitEditorPage.css" />
            </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>
            <ui:define name="js">
                <!-- This javascript code will be executed in the onload-part of the body and shows a localized message via the growl-component. -->
                <script>        
                    bodyLoaded = function() {
                        msgs.renderMessage({summary : '#{localizedCockpitEditorPageMessages.msgCockpitEditorWelcomeShort}', detail : '#{localizedCockpitEditorPageMessages.msgCockpitEditorWelcome}', severity: 'info'});
                    }
                </script>
            </ui:define>
            <!-- 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="  Neues View" update=":messages" ajax="true" onclick="newViewDialog.show();" disabled="#{empty currentCockpitEditorBean.project}"/>
                    <p:separator />
                    <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-save" value="  #{localizedMessages.saveProject}" update=":messages" ajax="true" action="#{currentCockpitEditorBean.saveProject(false)}" disabled="#{empty currentCockpitEditorBean.project}"/>
                    <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-saveAs" value="  #{localizedMessages.saveProjectAs}" update=":messages" ajax="true" disabled="#{true or empty currentCockpitEditorBean.project}"/>
                    <p:separator />
                    <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-reload" value="  #{localizedMessages.reloadProject}" ajax="false" url="cockpitEditor?projectName=#{currentCockpitEditorBean.projectName}" disabled="#{empty currentCockpitEditorBean.project}" />
                    <p:separator/>
                    <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-settings" value="  #{localizedMessages.settings}" onclick="settingsDlg.show()" ajax="true"/>
                    <p:separator />
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
                    <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-close" value="  #{localizedMessages.closeProject}" onclick="closeConfirmation.show()" ajax="true" rendered="#{currentCockpitEditorBean.unsavedModification}"/>
                    <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-close" value="  #{localizedMessages.closeProject}" action="ProjectOverviewPage.xhtml?faces-redirect=true" ajax="false" rendered="#{not currentCockpitEditorBean.unsavedModification}"/>
                <h:form id="centerForm">
                    <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>
                        <p:dashboard id="dynamicDashboard" binding="#{currentCockpitEditorBean.dashboard}">
                            <p:ajax event="reorder" listener="#{currentCockpitEditorBean.handleReorder}"/>
                        </p:dashboard>
                <p:layoutUnit position="west" resizable="true" maxSize="350" collapsible="true">
                        <p:dataTable value="#{currentCockpitEditorBean.project.views}" var="viewElem">
                            <p:column headerText="View">
                                <div align="center">
                                    <p:commandLink id="dynaButton" style="font-weight: #{currentCockpitEditorBean.activeView == viewElem ? 'bold' : 'normal'}" value="#{viewElem.name}"/>
                                    <p:menu overlay="true" trigger="dynaButton" my="left top" at="left bottom" style="width:210px">        
                                        <p:menuitem icon="ui-icon-analysisEditor" value="  #{localizedCockpitEditorPageMessages.selectView}" action="#{currentCockpitEditorBean.setActiveView(viewElem)}" styleClass="element-with-whitespace" update=":messages :centerForm :availableViewsForm"/>
                                        <p:separator/>
                                        <p:menuitem  icon="ui-icon-copy"  styleClass="element-with-whitespace" value="  #{localizedCockpitEditorPageMessages.copyView}" />
                                        <p:menuitem  icon="ui-icon-edit"  styleClass="element-with-whitespace" value="  #{localizedCockpitEditorPageMessages.renameView}"/>
                                        <p:menuitem  icon="ui-icon-delete"  styleClass="element-with-whitespace" value="  #{localizedCockpitEditorPageMessages.deleteView}" action="#{currentCockpitEditorBean.deleteView(viewElem)}"/> 
                                    </p:menu>
                                </div>
                            </p:column>
                            <p:column headerText="# Elements"><div align="center">#{viewElem.displayConnectors.size()}</div></p:column>
                            <p:column headerText="Description" width="50">
                                    <p:inplace id="normalEditor" editor="true" >  
                                        <p:inputText value="#{viewElem.description}" />
                                    </p:inplace>  
                                </div>
                            </p:column>  
                        </p:dataTable>
                    </h:form>
                </p:layoutUnit>

                <p:layoutUnit position="east" resizable="true" size="300" collapsible="true" header="Available Displays">
                    <h:form  rendered="#{not empty currentCockpitEditorBean.project}">
                        <p:accordionPanel value="#{currentCockpitEditorBean.project.plugins}" multiple="true" activeIndex="" var="plugin">
                            <p:tab title="#{plugin.name}" titletip="#{plugin.classname}">
                                <h:outputText value="No Displays Available" rendered="#{empty plugin.displays}"/>
                                <ui:repeat value="#{plugin.displays}" var="display">             
                                    <p:commandLink id="displayLink" value="#{display.name}" action="#{currentCockpitEditorBean.addDisplayToView(display)}" update=":availableViewsForm :centerForm"/><br/>
                                    <p:tooltip for="displayLink" value="#{currentCockpitEditorBean.getDescription(display)}"/>
                                </ui:repeat>
                            </p:tab>
                        </p:accordionPanel>
                    </h:form>
                </p:layoutUnit>
                <!-- 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">
                    <h:form id="propertiesForm" >
                        <p:dataTable editable="true" var="property" value="#{currentCockpitEditorBean.properties}" rowIndexVar="rowIndex" emptyMessage="#{localizedMessages.noPropertiesAvailable}" rendered="#{not empty currentCockpitEditorBean.selectedNode}">
                            <p:column headerText="#{localizedMessages.property}" style="width:125px"> 
                                <h:outputText value="Plugin-Name" rendered="#{rowIndex == 0}"/>
                                <h:outputText value="Display-Name" rendered="#{rowIndex == 1}"/>
                                <h:outputText value="#{localizedCockpitEditorPageMessages.name}" rendered="#{rowIndex == 2}"/>

                            <p:column headerText="#{localizedMessages.value}" style="width:125px">
                                <h:outputText value="#{currentCockpitEditorBean.selectedNode.display.parent.name}" rendered="#{rowIndex == 0}" />
                                <h:outputText value="#{currentCockpitEditorBean.selectedNode.display.name}" rendered="#{rowIndex == 1}" />
                                <p:inplace editor="true"  rendered="#{rowIndex == 2}">
                                    <p:inputText value="#{currentCockpitEditorBean.selectedNode.name}"/>
                                </p:inplace>
                            </p:column>                       
                        </p:dataTable>
                    </h:form>
                </p:layoutUnit>
            </ui:define>

            <ui:define name="furtherDialogIncludes">
                <p:confirmDialog id="confirmDialog" message="You have unsaved changed on your page. Do you really want to continue?" header="Unsaved Changes" severity="alert" widgetVar="closeConfirmation" >  
Nils Christian Ehmke's avatar
Nils Christian Ehmke committed
                    <h:form>
                        <p:commandButton id="confirm" value="#{localizedMessages.yes}" ajax="false" oncomplete="closeConfirmation.hide()" action="ProjectOverviewPage.xhtml?faces-redirect=true" />  
                        <p:commandButton id="decline" value="#{localizedMessages.cancel}" onclick="closeConfirmation.hide()" type="button" />   
                    </h:form>
                </p:confirmDialog>  
                <!-- Include the dialogs for the views. -->
                <ui:include src="../dialogs/CockpitEditorPageDialogs.xhtml" />
            </ui:define>

        </ui:composition>