[elvystrac] r1903 - * modified list of permitted type for company

  • From: elvys@xxxxxxxxxxxxxxxxxxxxxx
  • To: elvystrac@xxxxxxxxxxxxx
  • Date: Fri, 26 Feb 2010 16:28:26 +0100

Author: JirkaM
Date: 2010-02-26 16:28:26 +0100 (Fri, 26 Feb 2010)
New Revision: 1903

Modified:
   
trunk/server/webServer2/JavaSource/cz/elvys/webServer/beans/companyrel/CompanyPermittedTypesBean.java
   
trunk/server/webServer2/JavaSource/cz/elvys/webServer/messages/labels_cs.properties
   
trunk/server/webServer2/WebContent/secured/companyrel/selectPermittedTypeForm.xhtml
   trunk/server/webServer2/WebContent/styles/category/catDefAssignStep1.css
   trunk/server/webServer2/WebContent/styles/elvys-template.css
Log:
* modified list of permitted type for company
modified   
JavaSource/cz/elvys/webServer/beans/companyrel/CompanyPermittedTypesBean.java
modified   JavaSource/cz/elvys/webServer/messages/labels_cs.properties
modified   WebContent/secured/companyrel/selectPermittedTypeForm.xhtml
modified   WebContent/styles/category/catDefAssignStep1.css
modified   WebContent/styles/elvys-template.css


Modified: 
trunk/server/webServer2/JavaSource/cz/elvys/webServer/beans/companyrel/CompanyPermittedTypesBean.java
===================================================================
--- 
trunk/server/webServer2/JavaSource/cz/elvys/webServer/beans/companyrel/CompanyPermittedTypesBean.java
       2010-02-26 14:34:27 UTC (rev 1902)
+++ 
trunk/server/webServer2/JavaSource/cz/elvys/webServer/beans/companyrel/CompanyPermittedTypesBean.java
       2010-02-26 15:28:26 UTC (rev 1903)
@@ -1,5 +1,6 @@
 package cz.elvys.webServer.beans.companyrel;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import javax.faces.event.AbortProcessingException;
@@ -10,11 +11,20 @@
 import org.hibernate.Hibernate;
 
 import cz.elvys.commons.utils.CommonUtils;
+import cz.elvys.webServer.HIBgen.Category;
 import cz.elvys.webServer.HIBgen.Company;
 import cz.elvys.webServer.HIBgen.ContentType;
+import cz.elvys.webServer.HIBgen.Elvys;
+import cz.elvys.webServer.HIBgen.LayoutPosition;
+import cz.elvys.webServer.HIBgen.Timeline;
+import cz.elvys.webServer.beans.ElvysesCompanyBean.ElvysRecord;
+import cz.elvys.webServer.beans.user.UserLoginBean;
+import cz.elvys.webServer.toSpring.exception.ExecuteException;
 import cz.elvys.webServer.utils.faces.BeanManager;
+import elvys.server.bl.Fact;
 import elvys.server.bl.Factory;
 import elvys.server.bl.permTypesRel.PermittedSchedulingBL;
+import elvys.server.bl.planning.PlanningBL;
 
 public class CompanyPermittedTypesBean {
 
@@ -22,34 +32,20 @@
        private static Logger log = null;
        
        // fields
-       private List<ContentType> permittedTypes = null;
-       private List<ContentType> notPermittedTypes = null;
+       private List<CompanyPermittedRecord> permittedTypesRecords = null;
+       private List<CompanyPermittedRecord> notPermittedTypesRecords = null;
        private Integer fullPositionCount = -1;
        /*set from view*/ private Company selectedComp = null;
-       /*set from view*/ private ContentType selectedCt = null;
+       /*set from view*/ private CompanyPermittedRecord selectedCt = null;
        
        // messages
        private static final String COMPANY_NOT_SET = "Company object not set 
to the bean!!";
        private static final String CONTENT_TYPE_NOT_SET = "ContentType object 
not set to the bean!!";
        private static final String CANNOT_ADD_TYPE = "Cannot permit the 
company to use selected type..";
        private static final String CANNOT_REMOVE_TYPE = "Couldn't remove 
permitted type from the company..";
+       private static final String CANNOT_COMPLETE_RECORDS = "Couldn't load 
all attribute for company content types.";
 
-       public List<ContentType> getPermittedTypes() {
-               return permittedTypes;
-       }
 
-       public void setPermittedTypes(List<ContentType> permittedTypes) {
-               this.permittedTypes = permittedTypes;
-       }
-
-       public List<ContentType> getNotPermittedTypes() {
-               return notPermittedTypes;
-       }
-
-       public void setNotPermittedTypes(List<ContentType> notPermittedTypes) {
-               this.notPermittedTypes = notPermittedTypes;
-       }
-
        public Integer getFullPositionCount() {
                return fullPositionCount;
        }
@@ -67,16 +63,6 @@
        }
 
 
-       public ContentType getSelectedCt() {
-               return selectedCt;
-       }
-
-
-       public void setSelectedCt(ContentType selectedCt) {
-               this.selectedCt = selectedCt;
-       }
-
-
        static {
                log = Logger.getLogger(CompanyPermittedTypesBean.class);
        }
@@ -90,8 +76,13 @@
                }
                Integer compId = selectedComp.getId();
                PermittedSchedulingBL bl = Factory.getPermittedSchedulingBL();
-               permittedTypes = bl.getCompanyPermittedTypesMakeSession(compId);
-               notPermittedTypes = bl.getCompanyNotPermittedTypes(compId);
+               
+               List<ContentType> permittedTypes = 
bl.getCompanyPermittedTypesMakeSession(compId);
+               permittedTypesRecords = prepareList(permittedTypes);
+               
+               List<ContentType> notPermittedTypes = 
bl.getCompanyNotPermittedTypes(compId);
+               notPermittedTypesRecords = prepareList(notPermittedTypes);
+               
                fullPositionCount = 
bl.getListOfFullyPermittedLayoutPositions(compId, permittedTypes.size()).size();
                return "showSelectPermittedTypeForm";
        }
@@ -114,7 +105,7 @@
                
                
                Integer compId = selectedComp.getId();
-               Integer contId = selectedCt.getId();
+               Integer contId = selectedCt.getType().getId();
                PermittedSchedulingBL bl = Factory.getPermittedSchedulingBL();
                try {
                        bl.addCompanyPermittedType(compId, contId);
@@ -142,7 +133,7 @@
                }
                
                Integer compId = selectedComp.getId();
-               Integer contId = selectedCt.getId();
+               Integer contId = selectedCt.getType().getId();
                PermittedSchedulingBL bl = Factory.getPermittedSchedulingBL();
                try {
                        bl.removeCompanyPermittedType(compId, contId);
@@ -198,9 +189,99 @@
                        }
                        
                }
+                               
+       }
                
+       private List<CompanyPermittedRecord> prepareList(List<ContentType> 
contentTypeList) {
+               List<CompanyPermittedRecord> cprl = new 
ArrayList<CompanyPermittedRecord>();
                
+               PlanningBL bl = Fact.getPlanningBL();
+               
+               try {
+                       for(ContentType ct: contentTypeList) {
+                               CompanyPermittedRecord record = new 
CompanyPermittedRecord();
+                               
+                               List<Timeline> timelines = 
bl.listTimelinesOfTypeForCompanyMakeSession(selectedComp.getId(), ct.getId());
+                               if(timelines != null){
+                                       
record.setPlanningCount(timelines.size());
+                               }else{
+                                       record.setPlanningCount(0);
+                               }
+                               
+                               PermittedSchedulingBL blps = 
Factory.getPermittedSchedulingBL();
+                               List<LayoutPosition> positions;
+                               
+                               positions = 
blps.getListOfPositionsHavingContentTypeMakeSession(selectedComp.getId(), 
ct.getId());                              
+                               
+                               if(positions != null){
+                                       
record.setPositionCount(positions.size());
+                               }else{
+                                       record.setPositionCount(0);
+                               }
+                               
+                               record.setType(ct);
+                                                               
+                               cprl.add(record);
+                       }       
+                       
+               } catch (ExecuteException e) {
+                       String mes = 
CommonUtils.prepareErrorMessage(CANNOT_REMOVE_TYPE, 
+                                       "companyId", selectedComp.getId());
+                       log.error(mes,e);
+                       throw new RuntimeException(mes,e);
+               }
+               return cprl;
        }
        
        
+       public static class CompanyPermittedRecord {
+               private ContentType type;
+               private Integer positionCount;
+               private Integer planningCount;
+               public ContentType getType() {
+                       return type;
+               }
+               public void setType(ContentType type) {
+                       this.type = type;
+               }
+               public Integer getPositionCount() {
+                       return positionCount;
+               }
+               public void setPositionCount(Integer positionCount) {
+                       this.positionCount = positionCount;
+               }
+               public Integer getPlanningCount() {
+                       return planningCount;
+               }
+               public void setPlanningCount(Integer planningCount) {
+                       this.planningCount = planningCount;
+               }
+                               
+       }
+
+       public CompanyPermittedRecord getSelectedCt() {
+               return selectedCt;
+       }
+
+       public void setSelectedCt(CompanyPermittedRecord selectedCt) {
+               this.selectedCt = selectedCt;
+       }
+
+       public List<CompanyPermittedRecord> getPermittedTypesRecords() {
+               return permittedTypesRecords;
+       }
+
+       public void setPermittedTypesRecords(List<CompanyPermittedRecord> 
permittedTypesRecords) {
+               this.permittedTypesRecords = permittedTypesRecords;
+       }
+
+       public List<CompanyPermittedRecord> getNotPermittedTypesRecords() {
+               return notPermittedTypesRecords;
+       }
+
+       public void setNotPermittedTypesRecords(List<CompanyPermittedRecord> 
notPermittedTypesRecords) {
+               this.notPermittedTypesRecords = notPermittedTypesRecords;
+       }
+       
+       
 }

Modified: 
trunk/server/webServer2/JavaSource/cz/elvys/webServer/messages/labels_cs.properties
===================================================================
--- 
trunk/server/webServer2/JavaSource/cz/elvys/webServer/messages/labels_cs.properties
 2010-02-26 14:34:27 UTC (rev 1902)
+++ 
trunk/server/webServer2/JavaSource/cz/elvys/webServer/messages/labels_cs.properties
 2010-02-26 15:28:26 UTC (rev 1903)
@@ -117,6 +117,11 @@
 company.permtypes.form.permit.tooltip=Povolit spole\u010Dnosti 
pou\u017E\u00EDvat dan\u00FD typ pl\u00E1nov\u00E1n\u00ED
 company.permtypes.form.revoke.tooltip Odebrat spol\u010Dnosti mo\u017Enost 
pou\u017E\u00EDvat dan\u00FD typ pl\u00E1nov\u00E1n\u00ED
 company.permtypes.form.backtolistofcompanies=Zp\u011Bt na seznam 
spole\u010Dnost\u00ED
+company.permtypes.form.yes=Ano
+company.permtypes.form.no=Ne
+company.permtypes.form.name=N\u00E1zev
+company.permtypes.form.positions=# pozic
+company.permtypes.form.planning=# pl\u00E1nov\u00E1n\u00ED
 
 user.list.title=Seznam u\u017Eivatel\u016F
 user.list.body.title=Seznam u\u017Eivatel\u016F

Modified: 
trunk/server/webServer2/WebContent/secured/companyrel/selectPermittedTypeForm.xhtml
===================================================================
--- 
trunk/server/webServer2/WebContent/secured/companyrel/selectPermittedTypeForm.xhtml
 2010-02-26 14:34:27 UTC (rev 1902)
+++ 
trunk/server/webServer2/WebContent/secured/companyrel/selectPermittedTypeForm.xhtml
 2010-02-26 15:28:26 UTC (rev 1903)
@@ -26,46 +26,104 @@
                        
                        <!-- PANEL WITH PERMITTED TYPES -->
                        <h:panelGrid id="PermittedTypesPanel">
-                               <h:outputText 
value="#{lbl['company.permtypes.form.permittedlist']}"/>
-                               <rich:dataList
-                                       id="ListOfPermittedTypes"
-                                       var="type" 
value="#{companyPermittedTypesBean.permittedTypes}" rows="0">
-                                       <a4j:commandLink 
-                                       id="RevokePermittedType"
-                               value="#{type.type}" 
-                                               immediate="true"
-                                               
reRender="SetPermittedTypesForm">
-                                               <f:setPropertyActionListener 
value="#{type}" target="#{companyPermittedTypesBean.selectedCt}" />
-                                               <f:actionListener 
type="cz.elvys.webServer.beans.companyrel.CompanyPermittedTypesBean$RemovePermittedTypeActionListener"/>
-                                       </a4j:commandLink>
-                           
-                           <rich:toolTip for="RevokePermittedType">
-                                               <h:outputText 
value="#{lbl['company.permtypes.form.revoke.tooltip']}"/>
-                                       </rich:toolTip>
-                               </rich:dataList>
+                               <rich:dataTable 
+                                       id="TableOfPermittedTypes"
+                                       
value="#{companyPermittedTypesBean.permittedTypesRecords}" 
+                                       var="type"
+                                       width="400"
+                                       rows="10">
+                                       
+                                       <f:facet name="caption">
+                               <h:outputText
+                                       
value="#{lbl['company.permtypes.form.permittedlist']}" />
+                               </f:facet>
+                                       
+                                       <rich:column>
+                                               <f:facet 
name="header">#{lbl['company.permtypes.form.name']}</f:facet>
+                                               <h:outputText 
value="#{type.type.type}"/>
+                                       </rich:column>
+                                       
+                                       <rich:column>
+                                               <f:facet 
name="header">#{lbl['company.permtypes.form.positions']}</f:facet>
+                                               <h:outputText 
value="#{type.positionCount}"/>
+                                       </rich:column>
+                                       
+                                       <rich:column>
+                                               <f:facet 
name="header">#{lbl['company.permtypes.form.planning']}</f:facet>
+                                               <h:outputText 
value="#{type.planningCount}"/>
+                                       </rich:column>
+                                       
+                                       <h:column>
+                                               <div 
class="list-operations-main">                                              
+                                                       <div 
class="list-operations-item">                                                   
   
+                                                               
<a4j:commandButton id="RevokePermittedType"
+                                                                               
        reRender="SetPermittedTypesForm, RevokePermittedModalContent" 
+                                                                               
        oncomplete="Richfaces.showModalPanel('RevokePermittedModal')"
+                                                                               
        ajaxSingle="true"
+                                                                               
        immediate="true"
+                                                                               
        image="/images/icons/delete.gif">
+                                                                       
<f:setPropertyActionListener value="#{type}" 
target="#{companyPermittedTypesBean.selectedCt}" />
+                                                               
</a4j:commandButton>
+                                                               <rich:toolTip 
for="RevokePermittedType">
+                                                                       
<h:outputText value="#{lbl['company.permtypes.form.revoke.tooltip']}"/>
+                                                               </rich:toolTip>
+                                                       </div>
+                                               </div>
+                                       </h:column>
+                               
+                               </rich:dataTable>
+                       
+                               
                        </h:panelGrid>
                        
                        
                        <!-- PANEL WITH NOT PERMITTED TYPES -->
+
+                       <!-- PANEL WITH NOT PERMITTED TYPES -->
                        <h:panelGrid id="NotPermittedTypesPanel">
-                               <h:outputText 
value="#{lbl['company.permtypes.form.notpermittedlist']}"/>
-                               <rich:dataList
+                               <rich:dataTable 
                                        id="ListOfNotPermittedTypes"
-                                       var="type" 
value="#{companyPermittedTypesBean.notPermittedTypes}" rows="0">
-                           <a4j:commandLink 
-                                       id="PermitNewType"
-                               value="#{type.type}" 
-                                               immediate="true"
-                                               
reRender="SetPermittedTypesForm">
-                                               <f:setPropertyActionListener 
value="#{type}" target="#{companyPermittedTypesBean.selectedCt}" />
+                                       
value="#{companyPermittedTypesBean.notPermittedTypesRecords}" 
+                                       var="type"
+                                       width="400"
+                                       rows="10">
+                                       
+                                       <f:facet name="caption">
+                               <h:outputText
+                                       
value="#{lbl['company.permtypes.form.notpermittedlist']}" />
+                               </f:facet>
+                                       
+                                       <h:column>
+                                               <f:facet 
name="header">#{lbl['company.permtypes.form.name']}</f:facet>
+                                               <h:outputText 
value="#{type.type.type}"/>
+                                       </h:column>
+                                       
+                                       
+                                       <h:column>
+                                               <div 
class="list-operations-main">                                              
+                                                       <div 
class="list-operations-item">                              
+                                                               
<a4j:commandButton id="PermitNewType"
+                                                                               
reRender="SetPermittedTypesForm, RevokePermittedModalContent"
+                                                                               
image="/images/icons/select.png"
+                                                                               
immediate="true"                                                                
+
+               
+                                                                               
>
+                                                                       
<f:setPropertyActionListener value="#{type}" 
target="#{companyPermittedTypesBean.selectedCt}" />
                                                <f:actionListener 
type="cz.elvys.webServer.beans.companyrel.CompanyPermittedTypesBean$AddPermittedTypeActionListener"/>
-                                       </a4j:commandLink>
-                           
-                           <rich:toolTip for="PermitNewType">
-                                               <h:outputText 
value="#{lbl['company.permtypes.form.permit.tooltip']}"/>
-                                       </rich:toolTip>
-                       </rich:dataList>
+                                                               
</a4j:commandButton>
+                                                               
+                                                               <rich:toolTip 
for="PermitNewType">
+                                                                       
<h:outputText value="#{lbl['company.permtypes.form.permit.tooltip']}"/>
+                                                               </rich:toolTip>
+                                                       </div>
+                                               </div>
+                                       </h:column>
+                               
+                               </rich:dataTable>
                        </h:panelGrid>
+
+
                        
                        <!-- BACK TO LIST OF COMPANIES -->
                        <h:commandLink 
@@ -75,6 +133,35 @@
                        />
                </h:form>
        </rich:panel>
+       
+       
+       <rich:modalPanel id="RevokePermittedModal" minHeight="100" 
minWidth="200" autosized="true" zindex="2000">
+               <center>
+               <h:form id="RevokePermittedModalContent">
+                       
<b><h:outputText>#{lbl['company.list.body.delete.tooltip.question']}</h:outputText></b>
 
+                       <br/>
+                       <h:outputText 
value="#{companyPermittedTypesBean.selectedCt.type.type}:"/>
+                       <br/>
+                       <h:panelGrid columns="2">                               
+                               <a4j:commandButton 
value="#{lbl['company.permtypes.form.yes']}" 
+                                       
onclick="Richfaces.hideModalPanel('RevokePermittedModal')"
+                                       immediate="true"
+                                       bypassUpdates="true"
+                                       ajaxSingle="true"
+                                       reRender="SetPermittedTypesMainPanel">
+                                       <f:actionListener 
type="cz.elvys.webServer.beans.companyrel.CompanyPermittedTypesBean$RemovePermittedTypeActionListener"/>
                              
+                               </a4j:commandButton>
+                               <a4j:commandButton 
value="#{lbl['company.permtypes.form.no']}"
+                                       
onclick="Richfaces.hideModalPanel('RevokePermittedModal')"
+                                       immediate="true"
+                                       bypassUpdates="true"
+                                       ajaxSingle="true"
+                                       reRender="SetPermittedTypesMainPanel"/>
+                       </h:panelGrid>
+               </h:form>
+               </center>
+       </rich:modalPanel>
+       
 </ui:define>
 
 

Modified: 
trunk/server/webServer2/WebContent/styles/category/catDefAssignStep1.css
===================================================================
--- trunk/server/webServer2/WebContent/styles/category/catDefAssignStep1.css    
2010-02-26 14:34:27 UTC (rev 1902)
+++ trunk/server/webServer2/WebContent/styles/category/catDefAssignStep1.css    
2010-02-26 15:28:26 UTC (rev 1903)
@@ -8,14 +8,4 @@
        display: block;
        overflow: auto;
        padding-left: 7px;
-}
-
-
-
-.rich-table-caption {
-       text-align: left;
-       padding-left: 5px;
-       font-family:Tahoma,Arial,Verdana,sans-serif;
-       font-size:12px;
-       font-weight:bold;
 }
\ No newline at end of file

Modified: trunk/server/webServer2/WebContent/styles/elvys-template.css
===================================================================
--- trunk/server/webServer2/WebContent/styles/elvys-template.css        
2010-02-26 14:34:27 UTC (rev 1902)
+++ trunk/server/webServer2/WebContent/styles/elvys-template.css        
2010-02-26 15:28:26 UTC (rev 1903)
@@ -181,4 +181,14 @@
        color: red;
        font-size: 14px;
        padding-left: 10px;
+}
+
+
+.rich-table-caption {
+       text-align: left;
+       padding-left: 5px;
+       font-family:Tahoma,Arial,Verdana,sans-serif;
+       font-size:12px;
+       font-weight:bold;
+       padding-bottom:2px;
 }
\ No newline at end of file


Other related posts:

  • » [elvystrac] r1903 - * modified list of permitted type for company - elvys