/**
 * ELLECTRA-WeB
 * UML_2_JSF.0: Generate Web Pages for solution  - ePP Solution Specific
 * Authors: Thomas Dimakopoulos, Intrasoft
**/

import "..\\..\\ePPGUIGlobalProperties.m2t"
import "..\\..\\ePPGUIReadConfigurationModel.m2t"

texttransformation ePPVOCSelector (in uml:"http://www.eclipse.org/uml2/2.1.0/UML") {

  	uml.Model::generateSelector_VOC(pFilename:String,pGoto:String)
	{
	  file("WebContent/"+pFilename)
'<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@page import="org.ellectra.gui.utils.JSFUtils"%>
<%@page import="javax.faces.context.FacesContext"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%> 

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        <style>
            .body1 {
                
                height:300px;
                width:800px;
                overflow:auto;
                
            }
            
            .body2 {
                
                height:300px;
                width:300px;
                overflow:auto;
                
            }
            
            .body3 {
                
                height:350px;
                width:900px;
                overflow:auto;
                
            }
            
        </style>
        <link rel="stylesheet"  href="commission.css" type="text/css" >
    <link rel="stylesheet" href="ellectraweb.css" type="text/css" >
    </head>
    <body>
        <f:view>
            <h1><h:outputText value="VOC Code Selector" /></h1>
            <h:form>
                
                <h:panelGrid columns="2" styleClass="gridstyle" columnClasses="gridContent">
                    
                    <rich:panel bodyClass="body1">
                        <f:facet name="header">
                            VOC Codes
                        </f:facet>
                        <rich:tree style="width:200px" nodeSelectListener="#{vocTreeBean.processSelection}" 
                                   reRender="vocselectedNodelist"  ajaxSubmitSelection="true" switchType="ajax"
                                   value="#{vocTreeBean.treeNode}" var="item">
                        </rich:tree>
                    </rich:panel>

                    <rich:panel bodyClass="body2">
                        <h:panelGrid columns="1" styleClass="gridstyle" columnClasses="gridContent">
                        <f:facet name="header">
                            Selected VOC Codes
                        </f:facet>
                           <h:selectOneListbox style="width:200px" size="12" id="vocselectedNodelist" value="#{vocTreeBean.selectedoncecode}" onchange="submit();">
                                <f:selectItems value="#{vocTreeBean.cpvselectedcode1}"/>
                            </h:selectOneListbox>
                            <a4j:commandButton value="Remove From List" action="#{vocTreeBean.removeFromList}" reRender="vocselectedNodelist" />
                          
               
                        </h:panelGrid>
                    </rich:panel>
                  
                </h:panelGrid>
                   
                   
                  
                        
                <rich:panel bodyClass="body3"> 
                        
                            <f:facet name="header">
                                Search for VOC Codes
                            </f:facet>
                            
                            <h:panelGrid styleClass="gridstyle" columns="2" >
                                <h:inputText value="#{vocTreeBean.searchforcpvcodewithcpvcode}"  valueChangeListener="#{cpvTreeBean.searchforcodevcl}" />
                                <a4j:commandButton value="Search" action="#{vocTreeBean.search}" reRender="foundvoccodeslist" />
                            </h:panelGrid>
                        
                            <h:panelGrid styleClass="gridstyle" columns="1">
                                <h:selectOneListbox style="width:500px" size="12" id="foundvoccodeslist" value="#{vocTreeBean.selectedcodefromsearch}" onchange="submit();">
                                    <f:selectItems value="#{vocTreeBean.searchfoundcodes}"/>
                                </h:selectOneListbox>
                        
                                <a4j:commandButton value="Add on VOC List" action="#{vocTreeBean.addOnTheList}" reRender="vocselectedNodelist" />
                            </h:panelGrid>
                        
                </rich:panel>
            
          </h:form>
            <h:form>
                <h:commandButton value="Back" styleClass="buttonstyle" action="#{'pGoto'}"></h:commandButton>
            </h:form>
        </f:view>
    </body>
</html>
'
}
}