[richfaces-svn-commits] JBoss Rich Faces SVN: r4466 - in branches/3.1.x/ui: listShuttle/src/main/java/org/richfaces/component and 4 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Tue Dec 4 12:57:19 EST 2007


Author: sergeyhalipov
Date: 2007-12-04 12:57:19 -0500 (Tue, 04 Dec 2007)
New Revision: 4466

Modified:
   branches/3.1.x/ui/listShuttle/src/main/config/component/listShuttle.xml
   branches/3.1.x/ui/listShuttle/src/main/java/org/richfaces/component/UIListShuttle.java
   branches/3.1.x/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java
   branches/3.1.x/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java
   branches/3.1.x/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/css/listShuttle.xcss
   branches/3.1.x/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx
   branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java
Log:
List shuttle: caption fixed, some skinning.

Modified: branches/3.1.x/ui/listShuttle/src/main/config/component/listShuttle.xml
===================================================================
--- branches/3.1.x/ui/listShuttle/src/main/config/component/listShuttle.xml	2007-12-04 17:53:19 UTC (rev 4465)
+++ branches/3.1.x/ui/listShuttle/src/main/config/component/listShuttle.xml	2007-12-04 17:57:19 UTC (rev 4466)
@@ -165,6 +165,15 @@
         <property>
         	<name>removeAllControlLabel</name>
         	<classname>java.lang.String</classname>
+        </property>
+        
+        <property>
+        	<name>sourceCaptionLabel</name>
+        	<classname>java.lang.String</classname>
+        </property>
+        <property>
+        	<name>targetCaptionLabel</name>
+        	<classname>java.lang.String</classname>
         </property>
 	</component>
 </components>

Modified: branches/3.1.x/ui/listShuttle/src/main/java/org/richfaces/component/UIListShuttle.java
===================================================================
--- branches/3.1.x/ui/listShuttle/src/main/java/org/richfaces/component/UIListShuttle.java	2007-12-04 17:53:19 UTC (rev 4465)
+++ branches/3.1.x/ui/listShuttle/src/main/java/org/richfaces/component/UIListShuttle.java	2007-12-04 17:57:19 UTC (rev 4466)
@@ -653,5 +653,11 @@
 		this.targetSelection = collection;
 		this.targetSelectionSet = true;
 	}
+	
+	public abstract String getSourceCaptionLabel();
+	public abstract void setSourceCaptionLabel(String label);
+	
+	public abstract String getTargetCaptionLabel();
+	public abstract void setTargetCaptionLabel(String label);
 
 }

Modified: branches/3.1.x/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java
===================================================================
--- branches/3.1.x/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java	2007-12-04 17:53:19 UTC (rev 4465)
+++ branches/3.1.x/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java	2007-12-04 17:57:19 UTC (rev 4466)
@@ -41,8 +41,10 @@
 	
 	private final static String ATTRIBUTE_CE_ONREMOVEALLCLICK = "onremoveallclick";
 	
-	public final static String ATTRIBUTE_CAPTION_LABEL = "captionLabel";
+	public final static String ATTRIBUTE_SOURCE_CAPTION_LABEL = "sourceCaptionLabel";
 	
+	public final static String ATTRIBUTE_TARGET_CAPTION_LABEL = "targetCaptionLabel";
+	
 	private final static String ATTRIBUTE_CLASS_COPY_ALL_CONTROL = FACET_COPY_ALL + "Class";
 	
 	private final static String ATTRIBUTE_CLASS_REMOVE_ALL_CONTROL = FACET_REMOVE_ALL + "Class";

Modified: branches/3.1.x/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java
===================================================================
--- branches/3.1.x/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java	2007-12-04 17:53:19 UTC (rev 4465)
+++ branches/3.1.x/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java	2007-12-04 17:57:19 UTC (rev 4466)
@@ -66,11 +66,13 @@
 	}
 
 	public void encodeSLCaption(FacesContext context, UIOrderingBaseComponent shuttle) throws IOException {
-		encodeCaption(context, shuttle, FACET_SOURCE_CAPTION, "ol_label ol_out_label rich-ordering-list-caption");
+		encodeCaption(context, shuttle, FACET_SOURCE_CAPTION, "rich-shuttle-source-caption",
+				ListShuttleControlsHelper.ATTRIBUTE_SOURCE_CAPTION_LABEL);
 	}
 
 	public void encodeTLCaption(FacesContext context, UIComponent shuttle) throws IOException {
-		encodeCaption(context, shuttle, FACET_TARGET_CAPTION, "ol_label ol_out_label rich-ordering-list-caption");
+		encodeCaption(context, shuttle, FACET_TARGET_CAPTION, "rich-shuttle-target-caption",
+				ListShuttleControlsHelper.ATTRIBUTE_TARGET_CAPTION_LABEL);
 	}
 
 	public void encodeSLHeader(FacesContext context, UIOrderingBaseComponent shuttle) throws IOException {
@@ -311,4 +313,17 @@
         }
 	}
 	
+	public String getCaptionDisplay(FacesContext context, UIComponent component) {
+		UIListShuttle shuttle = (UIListShuttle)component;
+		if ((shuttle.getSourceCaptionLabel() != null && !"".equals(shuttle.getSourceCaptionLabel())) ||
+				(shuttle.getTargetCaptionLabel() != null && !"".equals(shuttle.getTargetCaptionLabel())) ||
+				(shuttle.getFacet("sourceCaption") != null && shuttle.getFacet("sourceCaption").isRendered()) ||
+				(shuttle.getFacet("targetCaption") != null && shuttle.getFacet("targetCaption").isRendered())) {
+			
+			return "";
+		}
+		
+		return "display: none;";
+	}
+	
 }

Modified: branches/3.1.x/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/css/listShuttle.xcss
===================================================================
--- branches/3.1.x/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/css/listShuttle.xcss	2007-12-04 17:53:19 UTC (rev 4465)
+++ branches/3.1.x/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/css/listShuttle.xcss	2007-12-04 17:57:19 UTC (rev 4466)
@@ -19,16 +19,8 @@
 .shuttle_center_button_col_valign{vertical-align : middle}
 .shuttle_right_button_col_valign{vertical-align : middle}
 
-.ol_caption {
-	height: 8px;
-}
-
 .ol_body{border : 0px solid #bfbfc0;}
 
-.ol_label{font-family : Arial; font-size :11px; font-weight : bold;}
-
-.ol_out_label{padding : 3px 3px 3px 8px}
-
 .ol_list{background : #FFFFFF; border : 1px solid #bfbfc0;}
 
 .ol_outputlist{ margin : 0px 8px 8px 8px;}
@@ -179,10 +171,6 @@
 
 <f:verbatim><![CDATA[
 
-.rich-list-shuttle {
-	-moz-user-select: -moz-none;
-}
-
 .rich-shuttle-control-disabled, .rich-shuttle-control-top, .rich-shuttle-control-bottom, .rich-shuttle-control-up, .rich-shuttle-control-down,
 .rich-shuttle-control-copyall, .rich-shuttle-control-copy, .rich-shuttle-control-remove, .rich-shuttle-control-removeall {
 	border : 1px solid;
@@ -230,11 +218,18 @@
 	vertical-align: middle;
 }
 
-.rich-ordering-list-caption {
-	height: 8px;
-	padding : 3px 3px 3px 8px
+.rich-list-shuttle-caption {
+	padding : 1px;
 }
 
+.rich-shuttle-source-caption {
+	padding: 3px 3px 3px 8px;
+}
+
+.rich-shuttle-target-caption {
+	padding: 3px 3px 3px 0px;
+}
+
 .rich-ordering-list-body {
 	border : 0px solid;
 }
@@ -329,6 +324,14 @@
 }
 ]]>
 </f:verbatim>
+
+	<u:selector name=".rich-list-shuttle">
+		<u:style name="background-color" skin="additionalBackgroundColor" />
+		<u:style name="border-color" skin="tableBorderColor" />
+		<u:style name="border-width" skin="tableBorderWidth" />
+		<u:style name="border-style" value="solid" />
+		<u:style name="-moz-user-select" value="-moz-none" />
+	</u:selector>
 
 <u:selector name=".ol_internal_header_tab_cell">
 		<u:style name="background-image">
@@ -345,7 +348,7 @@
 		<u:style name="border-right-color" skin="tableBorderColor" />
 		<u:style name="border-left-color" skin="panelBorderColor" />
 </u:selector>
-	
+	
 <u:selector name=".rich-list-shuttle-button">
 	<u:style name="background-image">
 		<f:resource f:key="org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient" />
@@ -458,7 +461,7 @@
 		<u:style name="font-size" skin="headerSizeFont" />
 	</u:selector>
 	
-	<u:selector name=".rich-ordering-list-caption">
+	<u:selector name=".rich-shuttle-source-caption, .rich-shuttle-target-caption">
 		<u:style name="font-family" skin="headerFamilyFont" />
 		<u:style name="font-size" skin="headerSizeFont" />
 		<u:style name="font-weight" skin="headerWeightFont" />

Modified: branches/3.1.x/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx
===================================================================
--- branches/3.1.x/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx	2007-12-04 17:53:19 UTC (rev 4465)
+++ branches/3.1.x/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx	2007-12-04 17:57:19 UTC (rev 4466)
@@ -45,7 +45,15 @@
 				variables.setVariable("switchByClick", switchByClick);
 			]]>
 		</jsp:scriptlet>
-		<table id="#{clientId}" class="rich-list-shuttle">
+		<table id="#{clientId}" class="rich-list-shuttle">
+			<tr style="#{this:getCaptionDisplay(context, component)}" >
+				<td class="rich-list-shuttle-caption" colspan="2">
+					<f:call name="encodeSLCaption"/>
+				</td>
+				<td class="rich-list-shuttle-caption" colspan="2">
+					<f:call name="encodeTLCaption"/>
+				</td>
+			</tr>
 			<tr>
 				<td>
 				    <div>
@@ -54,11 +62,6 @@
 						<table id="#{clientId}table" cellpadding="0" cellspacing="0" class="ol_body">
 							<tbody>
 								<tr>
-									<td align="left" class="ol_caption">
-										<f:call name="encodeSLCaption"/>
-									</td>
-								</tr>
-								<tr>
 									<td>
 										<div id="#{clientId}headerBox" class="ol_list ol_outputlist">
 											<jsp:scriptlet>
@@ -119,11 +122,6 @@
 						<table id="#{clientId}tlTable" cellpadding="0" cellspacing="0" class="ol_body">
 							<tbody>
 								<tr>
-									<td colspan="2" class="ol_caption">
-										<f:call name="encodeTLCaption"/>
-									</td>
-								</tr>
-								<tr>
 									<td>
 										<div id="#{clientId}tlHeaderBox" class="ol_list ol_outputlist">
 											<jsp:scriptlet>

Modified: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java	2007-12-04 17:53:19 UTC (rev 4465)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java	2007-12-04 17:57:19 UTC (rev 4466)
@@ -196,12 +196,12 @@
 			"rich-ordering-list-caption");
 	}
 	
-	protected void encodeCaption(FacesContext context, UIComponent component, String facetCaption, String captionStyle) 
-		throws IOException {
+	protected void encodeCaption(FacesContext context, UIComponent component, 
+			String facetCaption, String captionStyle, String attributeName) throws IOException{
 		ResponseWriter writer = context.getResponseWriter();
 		UIComponent facetEl = component.getFacet(facetCaption);
 		boolean renderFacet = ((facetEl != null) && facetEl.isRendered());
-		String captionAttr = (String) component.getAttributes().get(OrderingComponentControlsHelper.ATTRIBUTE_CAPTION_LABEL);
+		String captionAttr = (String) component.getAttributes().get(attributeName);
 
 		if (renderFacet || (captionAttr != null)) {
 			writer.startElement(HTML.DIV_ELEM, component);
@@ -213,8 +213,12 @@
 			}
 			writer.endElement(HTML.DIV_ELEM);
 		}
-		
 	}
+	
+	protected void encodeCaption(FacesContext context, UIComponent component, String facetCaption, String captionStyle) 
+			throws IOException {
+		encodeCaption(context, component, facetCaption, captionStyle, OrderingComponentControlsHelper.ATTRIBUTE_CAPTION_LABEL);
+	}
 
 	public void encodeHeader(FacesContext context, UIOrderingBaseComponent component) 
 	throws IOException {




More information about the richfaces-svn-commits mailing list