JBoss Rich Faces SVN: r1077 - trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2007-06-07 10:06:39 -0400 (Thu, 07 Jun 2007)
New Revision: 1077
Modified:
trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages/scrollable-grid.xhtml
Log:
put data model 2
Modified: trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages/scrollable-grid.xhtml
===================================================================
--- trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages/scrollable-grid.xhtml 2007-06-07 14:05:05 UTC (rev 1076)
+++ trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages/scrollable-grid.xhtml 2007-06-07 14:06:39 UTC (rev 1077)
@@ -36,7 +36,7 @@
<f:view>
<h:form>
- <sg:scrollable-grid value="#{dataModel}"
+ <sg:scrollable-grid value="#{dataModel2}"
var="issues"
frozenColCount="3"
first="0"
17 years, 7 months
JBoss Rich Faces SVN: r1076 - in trunk/richfaces: suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-06-07 10:05:05 -0400 (Thu, 07 Jun 2007)
New Revision: 1076
Modified:
trunk/richfaces/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/simple-draggable.js
trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/scriptaculo.js
trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
Log:
Prevent lower case when checking 'tagName' in JS.
Modified: trunk/richfaces/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/simple-draggable.js
===================================================================
--- trunk/richfaces/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/simple-draggable.js 2007-06-07 13:25:06 UTC (rev 1075)
+++ trunk/richfaces/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/simple-draggable.js 2007-06-07 14:05:05 UTC (rev 1076)
@@ -53,11 +53,12 @@
if(Event.isLeftClick(event)) {
var src = Event.element(event);
if(src.tagName && (
- src.tagName=='INPUT' ||
- src.tagName=='SELECT' ||
- src.tagName=='OPTION' ||
- src.tagName=='BUTTON' ||
- src.tagName=='TEXTAREA')) return;
+ src.tagName.toUpperCase() == 'INPUT' ||
+ src.tagName.toUpperCase() == 'SELECT' ||
+ src.tagName.toUpperCase() == 'OPTION' ||
+ src.tagName.toUpperCase() == 'BUTTON' ||
+ src.tagName.toUpperCase() == 'TEXTAREA'))
+ return;
Event.stop(event);
Modified: trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/scriptaculo.js
===================================================================
--- trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/scriptaculo.js 2007-06-07 13:25:06 UTC (rev 1075)
+++ trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/scriptaculo.js 2007-06-07 14:05:05 UTC (rev 1076)
@@ -298,10 +298,11 @@
// abort on form elements, fixes a Firefox issue
var src = Event.element(event);
if (src.tagName && (
- src.tagName == 'INPUT' ||
- src.tagName == 'SELECT' ||
- src.tagName == 'BUTTON' ||
- src.tagName == 'TEXTAREA')) return;
+ src.tagName.toUpperCase() == 'INPUT' ||
+ src.tagName.toUpperCase() == 'SELECT' ||
+ src.tagName.toUpperCase() == 'BUTTON' ||
+ src.tagName.toUpperCase() == 'TEXTAREA'))
+ return;
if (this.element._revert) {
this.element._revert.cancel();
@@ -551,10 +552,11 @@
// abort on form elements, fixes a Firefox issue
var src = Event.element(event);
if (src.tagName && (
- src.tagName == 'INPUT' ||
- src.tagName == 'SELECT' ||
- src.tagName == 'BUTTON' ||
- src.tagName == 'TEXTAREA')) return;
+ src.tagName.toUpperCase() == 'INPUT' ||
+ src.tagName.toUpperCase() == 'SELECT' ||
+ src.tagName.toUpperCase() == 'BUTTON' ||
+ src.tagName.toUpperCase() == 'TEXTAREA'))
+ return;
if (this.element._revert) {
this.element._revert.cancel();
Modified: trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
===================================================================
--- trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js 2007-06-07 13:25:06 UTC (rev 1075)
+++ trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js 2007-06-07 14:05:05 UTC (rev 1076)
@@ -349,7 +349,7 @@
var realOffset = 0;
while (item && (item != scroll)) {
// Avoid bug in Safari. Details: http://jacob.peargrove.com/blog/2006/technical/table-row-offsettop-bug-in...
- if ("SAFARI" == RichFaces.navigatorType() && "TR" == item.tagName) {
+ if ("SAFARI" == RichFaces.navigatorType() && "TR" == item.tagName.toUpperCase()) {
realOffset += document.getElementsByClassName("dr-sb-cell-padding", item)[0].offsetTop;
}
else
17 years, 7 months
JBoss Rich Faces SVN: r1075 - trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-06-07 09:25:06 -0400 (Thu, 07 Jun 2007)
New Revision: 1075
Modified:
trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js
Log:
http://jira.jboss.com/jira/browse/RF-155
Modified: trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js
===================================================================
--- trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js 2007-06-07 13:20:36 UTC (rev 1074)
+++ trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js 2007-06-07 13:25:06 UTC (rev 1075)
@@ -235,12 +235,13 @@
if (e && e.type == "mousedown" /* can be keydown */) {
if(Event.isLeftClick(e)) {
var src = Event.element(e);
- if(src.tagName && (
- src.tagName=='INPUT' ||
- src.tagName=='SELECT' ||
- src.tagName=='OPTION' ||
- src.tagName=='BUTTON' ||
- src.tagName=='TEXTAREA')) return;
+ if(src.tagName && (
+ src.tagName.toUpperCase() == 'INPUT' ||
+ src.tagName.toUpperCase() == 'SELECT' ||
+ src.tagName.toUpperCase() == 'OPTION' ||
+ src.tagName.toUpperCase() == 'BUTTON' ||
+ src.tagName.toUpperCase() == 'TEXTAREA'))
+ return;
Event.stop(e);
} else {
17 years, 7 months
JBoss Rich Faces SVN: r1074 - in trunk/sandbox/scrollable-grid/src: main/java/org/richfaces/renderkit/html and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2007-06-07 09:20:36 -0400 (Thu, 07 Jun 2007)
New Revision: 1074
Added:
trunk/sandbox/scrollable-grid/src/test/java/org/richfaces/model/selection/ClientSelectionTest.java
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/model/selection/ClientSelection.java
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/model/selection/SelectionRange.java
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/SelectionRendererContributor.java
Log:
selection contributor integration
Modified: trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/model/selection/ClientSelection.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/model/selection/ClientSelection.java 2007-06-07 12:56:29 UTC (rev 1073)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/model/selection/ClientSelection.java 2007-06-07 13:20:36 UTC (rev 1074)
@@ -39,7 +39,56 @@
return ranges;
}
- public void addIndex(int i) {
+ public void addIndex(int j) {
+ if(this.isSelected(j)) return;
+
+
+ SelectionRange firstRange = null;
+
+ int s = ranges.size();
+
+ int insertPosition = 0;
+
+ for(int i = 0; i < s && insertPosition >= 0 ; i++) {
+
+ firstRange = (SelectionRange) ranges.get(i);
+
+ if (firstRange.getStartIndex() == j + 1) {
+
+ firstRange.setStartIndex(j);
+ insertPosition = -1;
+
+ } else if (firstRange.getEndIndex() == j - 1) {
+
+ firstRange.setEndIndex(j);
+
+ if (i + 1 < s) {
+ SelectionRange range2 = (SelectionRange) ranges.get(i + 1);
+
+ if (range2.getStartIndex() == j || range2.getStartIndex() == j + 1) {
+
+ ranges.remove(i + 1);
+
+ firstRange.setEndIndex(range2.getEndIndex());
+ }
+ }
+
+ insertPosition = -1;
+
+ } else if (firstRange.getStartIndex() > j) {
+ insertPosition = i;
+ }
+
+ }
+
+ if (insertPosition >= 0) {
+ firstRange = new SelectionRange(j,j);
+ ranges.add(insertPosition, firstRange);
+
+ return;
+ }
+
+
}
}
Modified: trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/model/selection/SelectionRange.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/model/selection/SelectionRange.java 2007-06-07 12:56:29 UTC (rev 1073)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/model/selection/SelectionRange.java 2007-06-07 13:20:36 UTC (rev 1074)
@@ -36,5 +36,29 @@
public boolean within(int index) {
return startIndex <= index && endIndex >= index;
}
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + endIndex;
+ result = prime * result + startIndex;
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final SelectionRange other = (SelectionRange) obj;
+ if (endIndex != other.endIndex)
+ return false;
+ if (startIndex != other.startIndex)
+ return false;
+ return true;
+ }
+
}
Modified: trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-07 12:56:29 UTC (rev 1073)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-07 13:20:36 UTC (rev 1074)
@@ -1,17 +1,14 @@
package org.richfaces.renderkit.html;
import java.io.IOException;
-import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
-import javax.faces.application.Application;
import javax.faces.component.UIComponent;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import javax.faces.convert.Converter;
import org.ajax4jsf.ajax.repeat.DataVisitor;
import org.ajax4jsf.framework.ajax.AjaxContext;
@@ -29,9 +26,6 @@
import org.richfaces.component.UIScrollableGrid;
import org.richfaces.component.UIScrollableGridColumn;
import org.richfaces.event.sort.SortEvent;
-import org.richfaces.model.selection.ClientSelection;
-import org.richfaces.model.selection.Selection;
-import org.richfaces.model.selection.SimpleSelection;
import org.richfaces.renderkit.CompositeRenderer;
import org.richfaces.renderkit.RendererContributor;
import org.richfaces.renderkit.ScriptOptions;
@@ -64,8 +58,6 @@
private RendererBase footerCellTemplate = null;
- private static final String CLIENT_SELECTION = "clientSelection";
-
private final Log log = LogFactory.getLog(ScrollableGridBaseRenderer.class);
private final ColumnVisitor columnsWidthCounter = new ColumnVisitor(){
@@ -343,6 +335,8 @@
options.addOption("onSortAjaxUpdate", functionDefinition);
+ mergeScriptOptions(options, context, grid);
+
return function.toScript();
}
@@ -536,126 +530,6 @@
}
- private void decodeSelection(FacesContext context, UIScrollableGrid grid)
- throws IOException{
-
- String clientId = grid.getClientId(context);
- String id = clientId + "_selection";
- ExternalContext externalContext = context.getExternalContext();
- Map requestParamMap = externalContext.getRequestParameterMap();
- Application application = context.getApplication();
-
- String value = (String) requestParamMap.get(id);
-
- Converter converter = application.createConverter(ClientSelection.class);
-
- ClientSelection _oldClientSelection =
- (ClientSelection) grid.getAttributes().get(CLIENT_SELECTION);
-
- final ClientSelection oldClientSelection =
- _oldClientSelection == null ?
- new ClientSelection() :
- _oldClientSelection;
-
- final ClientSelection clientSelection =
- (ClientSelection) converter.getAsObject(context, grid, value);
-
-
-
- //FIXME: Obscure code. Hope Anton will make it more clear
- final GridRendererState state = GridRendererState.createState(context, grid);
-
- final SimpleSelection simpleSelection = new SimpleSelection();
-
- grid.walk(context,
- new DataVisitor() {
- public void process(FacesContext context, Object rowKey,
- Object argument) throws IOException {
-
- int i = state.getRowIndex();
-
- if (shouldAddToSelection(i, oldClientSelection, clientSelection)) {
-
- simpleSelection.addKey((Serializable)rowKey);
-
- } else if (shouldRemoveFromSelection(i, oldClientSelection, clientSelection)){
-
- simpleSelection.removeKey((Serializable) rowKey);
-
- }
-
- }
- },
- state);
-
-
- GridRendererState.restoreState(context);
-
- //FIXME:
-
-
- }
-
- //Decide whether to add new row to selection based on comparison with old one
- private boolean shouldAddToSelection(int i, ClientSelection oldSelection, ClientSelection newSelection) {
- return false;
- }
-
- //Decide whether to remove new row to selection based on comparison with old one
- private boolean shouldRemoveFromSelection(int i, ClientSelection oldSelection, ClientSelection newSelection) {
- return false;
- }
-
-
- private void encodeSelection(FacesContext context, UIScrollableGrid grid) throws IOException {
- final GridRendererState state = GridRendererState.createState(context, grid);
-
- final Selection gridSelection = new SimpleSelection();
- final ClientSelection clientSelection = new ClientSelection();
-
- grid.walk(context,
- new DataVisitor() {
- public void process(FacesContext context, Object rowKey,
- Object argument) throws IOException {
-
- if (gridSelection.isSelected((Serializable) rowKey)) {
-
- int i = state.getRowIndex();
-
- clientSelection.addIndex(i);
- }
-
-
-
-
- }
- },
- state);
-
-
- GridRendererState.restoreState(context);
-
- grid.getAttributes().put(CLIENT_SELECTION, clientSelection);
- }
-
- public void writeSelection(FacesContext context, UIScrollableGrid grid)
- throws IOException {
-
- Application application = context.getApplication();
-
- Converter converter =
- application.createConverter(ClientSelection.class);
-
- String string =
- converter.getAsString(context, grid, grid.getAttributes().get(CLIENT_SELECTION));
-
- if (string == null) {
- string = "";
- }
-
- }
-
-
private void decodeScrolling(String submitedState, UIScrollableGrid grid){
boolean isEmpty = true;
Modified: trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/SelectionRendererContributor.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/SelectionRendererContributor.java 2007-06-07 12:56:29 UTC (rev 1073)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/SelectionRendererContributor.java 2007-06-07 13:20:36 UTC (rev 1074)
@@ -147,7 +147,7 @@
ScriptOptions scriptOptions = new ScriptOptions(component);
scriptOptions.addOption("selectionInput", getSelectionInputName(
context, (UIScrollableGrid) component));
- return null;
+ return scriptOptions;
}
Added: trunk/sandbox/scrollable-grid/src/test/java/org/richfaces/model/selection/ClientSelectionTest.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/test/java/org/richfaces/model/selection/ClientSelectionTest.java (rev 0)
+++ trunk/sandbox/scrollable-grid/src/test/java/org/richfaces/model/selection/ClientSelectionTest.java 2007-06-07 13:20:36 UTC (rev 1074)
@@ -0,0 +1,73 @@
+package org.richfaces.model.selection;
+
+import junit.framework.TestCase;
+
+public class ClientSelectionTest extends TestCase {
+
+
+ private ClientSelection clientSelection;
+
+ public ClientSelectionTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ clientSelection = new ClientSelection();
+ }
+
+ protected void tearDown() throws Exception {
+ clientSelection = null;
+ super.tearDown();
+ }
+
+ public void testAddRange() {
+ SelectionRange range = new SelectionRange(10, 20);
+ clientSelection.addRange(range);
+ assertTrue(clientSelection.isSelected(10));
+ assertTrue(clientSelection.isSelected(11));
+ assertTrue(clientSelection.isSelected(15));
+ assertTrue(clientSelection.isSelected(20));
+ assertFalse(clientSelection.isSelected(0));
+ assertFalse(clientSelection.isSelected(30));
+ }
+
+ public void testIsSelected() {
+ SelectionRange range = new SelectionRange(10, 20);
+ clientSelection.addRange(range);
+ assertTrue(clientSelection.isSelected(10));
+ assertTrue(clientSelection.isSelected(11));
+ assertTrue(clientSelection.isSelected(15));
+ assertTrue(clientSelection.isSelected(20));
+ assertFalse(clientSelection.isSelected(0));
+ assertFalse(clientSelection.isSelected(30));
+ }
+
+ public void testGetRanges() {
+ SelectionRange range = new SelectionRange(10, 20);
+ clientSelection.addRange(range);
+ range = new SelectionRange(30, 40);
+ clientSelection.addRange(range);
+
+ assertNotNull(clientSelection.getRanges());
+ assertEquals(2, clientSelection.getRanges().size());
+ }
+
+ public void testAddIndex() {
+ clientSelection.addRange(new SelectionRange(10, 20));
+ clientSelection.addIndex(21);
+ assertEquals(1, clientSelection.getRanges().size());
+ assertTrue(clientSelection.isSelected(21));
+ clientSelection.addRange(new SelectionRange(23, 30));
+ assertEquals(2, clientSelection.getRanges().size());
+ assertFalse(clientSelection.isSelected(22));
+ assertTrue(clientSelection.isSelected(23));
+
+ clientSelection.addIndex(22);
+ assertTrue(clientSelection.isSelected(22));
+ assertEquals(1, clientSelection.getRanges().size());
+
+
+ }
+
+}
17 years, 7 months
JBoss Rich Faces SVN: r1073 - in trunk: sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-06-07 08:56:29 -0400 (Thu, 07 Jun 2007)
New Revision: 1073
Added:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
Modified:
trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages/scrollable-grid.xhtml
trunk/sandbox/scrollable-grid/generatescript.xml
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Selection.js
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx
Log:
fix sorting and scrolling. Move javascript from renderer template to the ScrollableGrid.js
Modified: trunk/sandbox/scrollable-grid/generatescript.xml
===================================================================
--- trunk/sandbox/scrollable-grid/generatescript.xml 2007-06-07 12:49:22 UTC (rev 1072)
+++ trunk/sandbox/scrollable-grid/generatescript.xml 2007-06-07 12:56:29 UTC (rev 1073)
@@ -44,6 +44,7 @@
<file name="/ClientUI/controls/grid/GridFooter.js"/>
<file name="/ClientUI/controls/grid/Grid.js"/>
<file name="/ClientUI/controls/grid/Selection.js"/>
+ <file name="/ClientUI/controls/grid/ScrollableGrid.js"/>
</filelist>
</concat>
</target>
Modified: trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-07 12:49:22 UTC (rev 1072)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-07 12:56:29 UTC (rev 1073)
@@ -1,14 +1,17 @@
package org.richfaces.renderkit.html;
import java.io.IOException;
+import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
+import javax.faces.application.Application;
import javax.faces.component.UIComponent;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
+import javax.faces.convert.Converter;
import org.ajax4jsf.ajax.repeat.DataVisitor;
import org.ajax4jsf.framework.ajax.AjaxContext;
@@ -19,14 +22,19 @@
import org.ajax4jsf.framework.renderer.RendererBase;
import org.ajax4jsf.framework.renderer.RendererUtils.HTML;
import org.ajax4jsf.framework.util.javascript.JSFunction;
+import org.ajax4jsf.framework.util.javascript.JSFunctionDefinition;
import org.ajax4jsf.framework.util.javascript.JSReference;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.richfaces.component.UIScrollableGrid;
import org.richfaces.component.UIScrollableGridColumn;
import org.richfaces.event.sort.SortEvent;
+import org.richfaces.model.selection.ClientSelection;
+import org.richfaces.model.selection.Selection;
+import org.richfaces.model.selection.SimpleSelection;
import org.richfaces.renderkit.CompositeRenderer;
import org.richfaces.renderkit.RendererContributor;
+import org.richfaces.renderkit.ScriptOptions;
import org.richfaces.renderkit.html.response.GridScrollSettings;
import org.richfaces.utils.TemplateLoader;
@@ -55,6 +63,8 @@
private RendererBase headerCellTemplate = null;
private RendererBase footerCellTemplate = null;
+
+ private static final String CLIENT_SELECTION = "clientSelection";
private final Log log = LogFactory.getLog(ScrollableGridBaseRenderer.class);
@@ -304,6 +314,38 @@
return "Richfaces_ScrollableGrid_" + id.replaceAll("[^A-Za-z0-9_]", "_");
}
+ public String createClientScrollableGrid(FacesContext context, UIScrollableGrid grid) {
+
+ String id = grid.getBaseClientId(context);
+
+ ScriptOptions options = new ScriptOptions(grid);
+ options.addOption("client_id", id);
+
+ if(grid.getFacets().containsKey("splash")){
+ UIComponent splash = grid.getFacet("splash");
+ String splash_id = splash.getClientId(context);
+ options.addOption("splash_id", splash_id);
+ }
+
+ int columnCount = grid.getChildCount();
+
+ options.addOption("columnsCount", new Integer(columnCount));
+ options.addOption("rowsCount", new Integer(grid.getDefaultRows()));
+
+ JSFunction function = new JSFunction("new ClientUI.controls.grid.ScrollableGrid");
+ function.addParameter(options);
+
+ JSFunctionDefinition functionDefinition = new JSFunctionDefinition();
+
+ JSReference sortEvent = new JSReference("event");
+ functionDefinition.addParameter(sortEvent);
+ functionDefinition.addToBody(onSortAjaxUpdate(context, grid));
+
+ options.addOption("onSortAjaxUpdate", functionDefinition);
+
+ return function.toScript();
+ }
+
protected String getScriptContributions(FacesContext context, UIScrollableGrid grid) {
return super.getScriptContributions(getJavaScriptVarName(context, grid), context, grid);
}
@@ -416,10 +458,10 @@
public String onSortAjaxUpdate(FacesContext context, UIScrollableGrid grid){
- JSReference sortColumn = new JSReference("sortEvent.column");
- JSReference sortOrder = new JSReference("sortEvent.order");
- JSReference sortStartRow = new JSReference("sortEvent.startRow");
- JSReference sortIndex = new JSReference("sortEvent.index");
+ JSReference sortColumn = new JSReference("event.column");
+ JSReference sortOrder = new JSReference("event.order");
+ JSReference sortStartRow = new JSReference("event.startRow");
+ JSReference sortIndex = new JSReference("event.index");
Map options = AjaxRendererUtils.buildEventOptions(context, grid);
@@ -494,6 +536,126 @@
}
+ private void decodeSelection(FacesContext context, UIScrollableGrid grid)
+ throws IOException{
+
+ String clientId = grid.getClientId(context);
+ String id = clientId + "_selection";
+ ExternalContext externalContext = context.getExternalContext();
+ Map requestParamMap = externalContext.getRequestParameterMap();
+ Application application = context.getApplication();
+
+ String value = (String) requestParamMap.get(id);
+
+ Converter converter = application.createConverter(ClientSelection.class);
+
+ ClientSelection _oldClientSelection =
+ (ClientSelection) grid.getAttributes().get(CLIENT_SELECTION);
+
+ final ClientSelection oldClientSelection =
+ _oldClientSelection == null ?
+ new ClientSelection() :
+ _oldClientSelection;
+
+ final ClientSelection clientSelection =
+ (ClientSelection) converter.getAsObject(context, grid, value);
+
+
+
+ //FIXME: Obscure code. Hope Anton will make it more clear
+ final GridRendererState state = GridRendererState.createState(context, grid);
+
+ final SimpleSelection simpleSelection = new SimpleSelection();
+
+ grid.walk(context,
+ new DataVisitor() {
+ public void process(FacesContext context, Object rowKey,
+ Object argument) throws IOException {
+
+ int i = state.getRowIndex();
+
+ if (shouldAddToSelection(i, oldClientSelection, clientSelection)) {
+
+ simpleSelection.addKey((Serializable)rowKey);
+
+ } else if (shouldRemoveFromSelection(i, oldClientSelection, clientSelection)){
+
+ simpleSelection.removeKey((Serializable) rowKey);
+
+ }
+
+ }
+ },
+ state);
+
+
+ GridRendererState.restoreState(context);
+
+ //FIXME:
+
+
+ }
+
+ //Decide whether to add new row to selection based on comparison with old one
+ private boolean shouldAddToSelection(int i, ClientSelection oldSelection, ClientSelection newSelection) {
+ return false;
+ }
+
+ //Decide whether to remove new row to selection based on comparison with old one
+ private boolean shouldRemoveFromSelection(int i, ClientSelection oldSelection, ClientSelection newSelection) {
+ return false;
+ }
+
+
+ private void encodeSelection(FacesContext context, UIScrollableGrid grid) throws IOException {
+ final GridRendererState state = GridRendererState.createState(context, grid);
+
+ final Selection gridSelection = new SimpleSelection();
+ final ClientSelection clientSelection = new ClientSelection();
+
+ grid.walk(context,
+ new DataVisitor() {
+ public void process(FacesContext context, Object rowKey,
+ Object argument) throws IOException {
+
+ if (gridSelection.isSelected((Serializable) rowKey)) {
+
+ int i = state.getRowIndex();
+
+ clientSelection.addIndex(i);
+ }
+
+
+
+
+ }
+ },
+ state);
+
+
+ GridRendererState.restoreState(context);
+
+ grid.getAttributes().put(CLIENT_SELECTION, clientSelection);
+ }
+
+ public void writeSelection(FacesContext context, UIScrollableGrid grid)
+ throws IOException {
+
+ Application application = context.getApplication();
+
+ Converter converter =
+ application.createConverter(ClientSelection.class);
+
+ String string =
+ converter.getAsString(context, grid, grid.getAttributes().get(CLIENT_SELECTION));
+
+ if (string == null) {
+ string = "";
+ }
+
+ }
+
+
private void decodeScrolling(String submitedState, UIScrollableGrid grid){
boolean isEmpty = true;
Added: trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js (rev 0)
+++ trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2007-06-07 12:56:29 UTC (rev 1073)
@@ -0,0 +1,67 @@
+ClientUILib.declarePackage("ClientUI.controls.grid.ScrollableGrid");
+
+ClientUI.controls.grid.ScrollableGrid = Class.create({
+ CLASSDEF: {
+ name: 'ClientUI.controls.grid.ScrollableGrid'
+ }
+});
+
+Object.extend(ClientUI.controls.grid.ScrollableGrid.prototype, {
+
+ initialize: function(options) {
+
+ this.options = options;
+ this.client_id = this.options.client_id;
+
+ this.columns_count = this.options.columnsCount;
+ this.splash_id = this.options.splash_id;
+ this.rows_count = $(this.client_id + "_rows_input").value;
+ this.init2 = this.init.bindAsEventListener(this);
+ },
+
+ init: function(){
+
+ this.dataModel = new ClientUI.controls.grid.FakeArrayDataModel(this.rows_count, this.columns_count, this.client_id);
+
+ var templates = [
+ {pane: GridLayout_Enum.HEADER, ref: this.client_id +"_" + "GridHeaderTemplate"},
+ {pane: GridLayout_Enum.BODY, ref: this.client_id +"_" + "GridBodyTemplate"},
+ {pane: GridLayout_Enum.FOOTER, ref: this.client_id +"_" + "GridFooterTemplate"}
+ ];
+
+ // create the Grid
+ this.grid = new ClientUI.controls.grid.Grid(this.client_id, this.dataModel, templates,
+ {
+ showIndexColumn: false,
+ indexColumnWidth: 40
+ }
+ );
+
+ var progress = new ClientUI.common.box.SplashBox(this.splash_id, null, 300, true);
+
+ this.grid.setProgressCtrl(progress);
+ Event.observe(this.grid.eventOnSort, "on sort", this.onSorted.bindAsEventListener(this));
+ },
+
+ onSortComplete : function(request, event, data){
+ var options = request.getJSON("options");
+ AjaxUpdater.updateRows(options,request, this.grid, this.client_id);
+ },
+
+ onScrollComplete : function(request, event, data){
+ var options = this.dataModel.getCurrentOptions();
+ AjaxUpdater.updateRows(options,request,this.grid,this.client_id);
+ },
+
+ onSorted: function(sortEvent) {
+ this.options.onSortAjaxUpdate(sortEvent);
+ }
+});
+
+
+
+
+
+
+
+
Modified: trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Selection.js
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Selection.js 2007-06-07 12:49:22 UTC (rev 1072)
+++ trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Selection.js 2007-06-07 12:56:29 UTC (rev 1073)
@@ -425,4 +425,4 @@
nElement.style.color = "#0000AA";
this.activeRow = rowIndex;
}
-});
\ No newline at end of file
+});
Modified: trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx 2007-06-07 12:49:22 UTC (rev 1072)
+++ trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx 2007-06-07 12:56:29 UTC (rev 1073)
@@ -187,70 +187,11 @@
<script id="#{clientId}_grid_create_scripts" type="text/javascript">
//<![CDATA[
-
- var #{this:getJavaScriptVarName(context, component)} = function() {
+ var #{this:getJavaScriptVarName(context, component)} = #{this:createClientScrollableGrid(context, component)};
+ #{this:getScriptContributions(context, component)};
- return {
- init : function() {
- var currTime = (new Date()).getTime();
- // ClientUILib.log(ClientUILogger.WARNING, "Document loaded over " + (currTime - ClientUILib.startTime) + " miliseconds.");
- var clientId = '#{clientId}';
- var rows_count = $(clientId + "_rows_input").value;
- var columns_count = '#{columns_count}';
-
- function onSorted(sortEvent) {
- // alert("onSorted column: " + sortEvent.column + " by order: " + sortEvent.order + ", row:" + sortEvent.startRow + ", index:" + sortEvent.index);
- var event = null;
- #{this:onSortAjaxUpdate(context,component)}
- }
-
- dataModel = new ClientUI.controls.grid.FakeArrayDataModel(rows_count, columns_count, clientId);
-
- var templates = [
- {pane: GridLayout_Enum.HEADER, ref: clientId +"_" + "GridHeaderTemplate"},
- {pane: GridLayout_Enum.BODY, ref: clientId +"_" + "GridBodyTemplate"},
- {pane: GridLayout_Enum.FOOTER, ref: clientId +"_" + "GridFooterTemplate"}
- ];
+ Event.observe(window, 'load', #{this:getJavaScriptVarName(context, component)}.init2);
- // ClientUILib.log(ClientUILogger.WARNING, "DataModel created over " + ((new Date()).getTime() - currTime) + " miliseconds.");
- // currTime = (new Date()).getTime();
-
- // create the Grid
- grid = new ClientUI.controls.grid.Grid(clientId, dataModel, templates,
- {
- showIndexColumn: false,
- indexColumnWidth: 40
- }
- );
-
- var splash_id = '#{splash_id}';
-
- var progress = new ClientUI.common.box.SplashBox(splash_id, null, 300, true);
- grid.setProgressCtrl(progress);
-
- Event.observe(grid.eventOnSort, "on sort", onSorted);
- },
-
- onSortComplete : function(request, event, data){
- var options = request.getJSON("options");
- var clientid = '#{clientId}';
- AjaxUpdater.updateRows(options,request,grid, clientid);
-
- },
-
- onScrollComplete : function(request, event, data,clientid){
- var options = dataModel.getCurrentOptions();
- var clientid = '#{clientId}';
- AjaxUpdater.updateRows(options,request,grid,clientid);
- }
- }
-
- }();
-
-
- #{this:getScriptContributions(context, component)};
- Event.observe(window, 'load', #{this:getJavaScriptVarName(context, component)}.init);
-
// ]]>
</script>
</f:root>
Modified: trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages/scrollable-grid.xhtml
===================================================================
--- trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages/scrollable-grid.xhtml 2007-06-07 12:49:22 UTC (rev 1072)
+++ trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages/scrollable-grid.xhtml 2007-06-07 12:56:29 UTC (rev 1073)
@@ -36,8 +36,7 @@
<f:view>
<h:form>
- <sg:scrollable-grid id="grid"
- value="#{dataModel}"
+ <sg:scrollable-grid value="#{dataModel}"
var="issues"
frozenColCount="3"
first="0"
17 years, 7 months
JBoss Rich Faces SVN: r1072 - in trunk/sandbox/panelmenu/src/main: java/org/richfaces/renderkit and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: dbiatenia
Date: 2007-06-07 08:49:22 -0400 (Thu, 07 Jun 2007)
New Revision: 1072
Modified:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/panelmenu/UIPanelMenu.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/panelmenu/UIPanelMenuGroup.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/panelmenu/UIPanelMenuItem.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRenderer.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java
trunk/sandbox/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js
trunk/sandbox/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx
Log:
code review bugfix
Modified: trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/panelmenu/UIPanelMenu.java
===================================================================
--- trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/panelmenu/UIPanelMenu.java 2007-06-07 11:50:51 UTC (rev 1071)
+++ trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/panelmenu/UIPanelMenu.java 2007-06-07 12:49:22 UTC (rev 1072)
@@ -1,8 +1,8 @@
package org.richfaces.component.panelmenu;
-import org.richfaces.component.UISwitchablePanel;
+import javax.faces.component.UIComponentBase;
-public abstract class UIPanelMenu extends UISwitchablePanel{
+public abstract class UIPanelMenu extends UIComponentBase{
public static final String COMPONENT_TYPE = "org.richfaces.panelMenu";
Modified: trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/panelmenu/UIPanelMenuGroup.java
===================================================================
--- trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/panelmenu/UIPanelMenuGroup.java 2007-06-07 11:50:51 UTC (rev 1071)
+++ trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/panelmenu/UIPanelMenuGroup.java 2007-06-07 12:49:22 UTC (rev 1072)
@@ -55,8 +55,6 @@
public abstract void setIconDisabled(String iconDisabled);
public abstract boolean isDisabled();
public abstract void setDisabled(boolean disabled);
-// public abstract Object getValue();
-// public abstract void setValue(Object value);
public abstract String getTarget();
public abstract void setTarget(String target);
public abstract String getHoverClass();
@@ -88,18 +86,6 @@
setConverter(new UIPanelMenuGroupValueConverter());
}
- public boolean isTopLevel(){
- UIComponent parent = getParent();
- while( !(parent instanceof UIPanelMenu) && !(parent instanceof UIPanelMenuGroup)) {
- parent = parent.getParent();
- }
- if(parent instanceof UIPanelMenu){
- return true;
- } else {
- return false;
- }
- }
-
public void addActionListener(ActionListener listener) {
addFacesListener(listener);
}
Modified: trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/panelmenu/UIPanelMenuItem.java
===================================================================
--- trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/panelmenu/UIPanelMenuItem.java 2007-06-07 11:50:51 UTC (rev 1071)
+++ trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/panelmenu/UIPanelMenuItem.java 2007-06-07 12:49:22 UTC (rev 1072)
@@ -57,16 +57,4 @@
public abstract String getTarget();
public abstract void setTarget(String target);
- public boolean isTopLevel(){
- UIComponent parent = getParent();
- while( !(parent instanceof UIPanelMenu) && !(parent instanceof UIPanelMenuGroup)) {
- parent = parent.getParent();
- }
- if(parent instanceof UIPanelMenu){
- return true;
- } else {
- return false;
- }
- }
-
}
Modified: trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java
===================================================================
--- trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java 2007-06-07 11:50:51 UTC (rev 1071)
+++ trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java 2007-06-07 12:49:22 UTC (rev 1072)
@@ -53,18 +53,12 @@
Object property = requestMap.get("panelMenuState"+clientId);
if (property.equals("opened")) {
group.setSubmittedValue("true");
- //group.setSubmittedValue(new Boolean(true));
- //group.setExpanded(true);
} else if (property.equals("closed")) {
group.setSubmittedValue("false");
- //group.setSubmittedValue(new Boolean(false));
- //group.setExpanded(false);
}
}
if(isSubmitted(context, component)){
- //new SwitchablePanelSwitchEvent(findMenu(component), null, component).queue();
- //new ValueChangeEvent(group, group.getValue(), group.getSubmittedValue()).queue();
new ActionEvent(component).queue();
if (UISwitchablePanel.AJAX_METHOD.equals(getItemMode(component))) {
new AjaxEvent(component).queue();
@@ -79,7 +73,7 @@
String align = "";
UIPanelMenu panelMenu = findMenu(component);
- boolean isTopLevel = ((UIPanelMenuGroup)component).isTopLevel();
+ boolean isTopLevel = isTopLevel(component);
if (isTopLevel){
align = panelMenu.getIconItemTopPosition();
@@ -103,8 +97,8 @@
return;
}
UIPanelMenuGroup panelMenuGroup = (UIPanelMenuGroup)component;
- boolean isTopLevel = panelMenuGroup.isTopLevel();
- //TODO by nick - dima - component value should be used here
+ boolean isTopLevel = isTopLevel(panelMenuGroup);
+
boolean isOpened = isOpened(context,component);
String source = "";
@@ -113,7 +107,7 @@
Object iconCollapsed = panelMenuGroup.getIconCollapsed();
Object iconExpanded = panelMenuGroup.getIconExpanded();
String icon = (isOpened ? iconExpanded : iconCollapsed).toString();
- if (icon.equals("")){
+ if ("".equals(icon)){
source = getIconByType("custom", isTopLevel,context, component);
} else {
if (iconNode.equals("none")){
@@ -167,29 +161,6 @@
return styleBuffer.toString();
}
-// public String getHideStyle(FacesContext context, UIComponent component) {
-// if (!(component.getParent() instanceof UIPanelMenu)) {
-// CSSFormat format = new CSSFormat();
-// format.add("display", "none");
-// if(component.getParent() instanceof UIPanelMenuGroup) {
-// UIPanelMenuGroup parent = (UIPanelMenuGroup)component.getParent();
-// //TODO by nick - dima - take opened value from component itself
-// PanelMenuGroupRenderer renderer = (PanelMenuGroupRenderer) context.getRenderKit().getRenderer(parent.getFamily(), parent.getRendererType());
-// try {
-// if ( renderer.isOpened(context, parent).equals("opened") ){
-// return "";
-// } else
-// return format.toString();
-// } catch (IOException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// }
-// } else return format.toString();
-// }
-// return "";
-//
-// }
-
public void insertLabel(FacesContext context, UIComponent component) throws IOException {
Object label = component.getAttributes().get("label");
if (label!=null){
@@ -233,22 +204,4 @@
}
return false;
}
-/*
- protected boolean isChildrenExpanded(UIComponent component){
- if (component.getChildren() != null){
- Iterator itr = component.getChildren().iterator();
- while(itr.hasNext()){
- UIComponent child = (UIComponent)itr.next();
- if(child instanceof UIPanelMenuGroup){
- if( ((UIPanelMenuGroup)child).isExpanded() ){
- return true;
- } else {
- return isChildrenExpanded(child);
- }
- }
- }
- }
- return false;
- }
-*/
}
Modified: trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java
===================================================================
--- trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java 2007-06-07 11:50:51 UTC (rev 1071)
+++ trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java 2007-06-07 12:49:22 UTC (rev 1072)
@@ -36,7 +36,6 @@
public class PanelMenuItemRenderer extends PanelMenuRendererBase {
protected Class getComponentClass() {
- //TODO by nick - dima - add concrete component class
return UIPanelMenuItem.class;
}
@@ -45,10 +44,11 @@
}
protected void doDecode(FacesContext context, UIComponent component) {
if(isSubmitted(context, component)) {
- new SwitchablePanelSwitchEvent(findMenu(component), null, component).queue();
- new ActionEvent(component).queue();
+ new ActionEvent(component).queue();
if (UISwitchablePanel.AJAX_METHOD.equals(getItemMode(component))) {
new AjaxEvent(component).queue();
+ } else {
+
}
}
}
@@ -57,11 +57,12 @@
}
+ /*
public String getOnClick(FacesContext context, UIComponent component) {
String clientId = component.getClientId(context);
return ";PanelMenuStorage['" + clientId + "'].trigger(event);";
}
-
+ */
public void insertImage(FacesContext context, UIComponent component, Object data) throws IOException {
String from = (String)data;
UIPanelMenu panelMenu = findMenu(component);
@@ -70,7 +71,7 @@
}
String align = "";
UIPanelMenuItem panelMenuItem = (UIPanelMenuItem)component;
- boolean isTopLevel = panelMenuItem.isTopLevel();
+ boolean isTopLevel = isTopLevel(panelMenuItem);
if (isTopLevel){
align = panelMenu.getIconItemTopPosition();
@@ -96,7 +97,7 @@
ResponseWriter writer = context.getResponseWriter();
String iconItemTopLevel = panelMenu.getIconTopItem();
String iconItem = panelMenu.getIconItem();
- boolean isTopLevel = component.getParent() instanceof UIPanelMenu;
+ boolean isTopLevel = isTopLevel(component);
String source = "";
String iconType = "";
Object customIcon = ((UIPanelMenuItem)component).getIcon();
@@ -161,29 +162,4 @@
return styleBuffer.toString();
}
-
- //TODO by nick - dima - looks like duplicate code methods. can we add it to super class?
-// public String getHideStyle(FacesContext context, UIComponent component) {
-// // TODO Auto-generated method stub
-// if (!(component.getParent() instanceof UIPanelMenu)) {
-// CSSFormat format = new CSSFormat();
-// format.add("display", "none");
-// if(component.getParent() instanceof UIPanelMenuGroup) {
-// UIPanelMenuGroup parent = (UIPanelMenuGroup)component.getParent();
-// PanelMenuGroupRenderer renderer = (PanelMenuGroupRenderer) context.getRenderKit().getRenderer(parent.getFamily(), parent.getRendererType());
-// try {
-// if ( renderer.isOpened(context, parent).equals("opened") ){
-// return "";
-// } else
-// return format.toString();
-// } catch (IOException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// }
-// } else return format.toString();
-// }
-// return "";
-// }
-
-
}
Modified: trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRenderer.java
===================================================================
--- trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRenderer.java 2007-06-07 11:50:51 UTC (rev 1071)
+++ trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRenderer.java 2007-06-07 12:49:22 UTC (rev 1072)
@@ -47,7 +47,6 @@
* @see org.ajax4jsf.framework.renderer.RendererBase#getComponentClass()
*/
protected Class getComponentClass() {
- //TODO by nick - dima - add concrete component class
return UIComponent.class;
}
@@ -129,8 +128,7 @@
.append("',parentId:'")
.append((String) child.getParent().getClientId(context))
.append("'},{type:" + (child instanceof UIPanelMenuItem ? "\"item\"":"\"node\""))
- //TODO by nick - dima - use "".equals(onopen)
- .append(",onopen:"+(onopen.equals("") ? "\"\"" : "\"" + onopen + "\"")+",onclose:"+(onclose.equals("") ? "\"\"" : "\"" + onclose + "\""))
+ .append(",onopen:"+("".equals(onopen) ? "\"\"" : "\"" + onopen + "\"")+",onclose:"+("".equals(onclose) ? "\"\"" : "\"" + onclose + "\""))
.append(",event:\"" + event + "\"")
.append(",mode:\"" + mode + "\"")
.append(",target:\"" + targetString + "\"")
@@ -177,8 +175,6 @@
addImages(buffer,context,child,component.getClientId(context).toString());
-
-
buffer.append(");\n");
}
} else {
@@ -214,7 +210,7 @@
}
private void switchOnImagesIfNeeded(FacesContext context, UIComponent child, StringBuffer buffer)throws IOException {
- boolean isToplevel = child.getParent() instanceof UIPanelMenu;
+ boolean isToplevel = isTopLevel(child);
String customIconOpened = "";
String customIconClosed = "";
@@ -285,31 +281,6 @@
buffer.append(",").append(String.valueOf(isNodeOpened));
}
}
-/*
- String value = "";
- try {
- value = context.getExternalContext().getRequestParameterMap().get("panelMenuState"+child.getClientId(context)).toString();
- } catch (Exception e) {
- value = "";
- }
- if (!value.equals("")){
- if (value.equals("opened")) {
- buffer.append(",true");
- } else {
- buffer.append(",false");
- }
- } else {
- Object property = child.getAttributes().get("expanded");
- if (property!=null && property.toString().equals("true")){
- buffer.append(",true");
- } else {
-
- //return isChildrenExpanded(component) ? "opened" : "closed";
- buffer.append(isChildrenExpanded(child) ? ",true" : ",false");
- //buffer.append(",false");
- }
- }
-*/
}
private void addImages(StringBuffer buffer,FacesContext context,UIComponent component,String id){
Modified: trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java
===================================================================
--- trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java 2007-06-07 11:50:51 UTC (rev 1071)
+++ trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java 2007-06-07 12:49:22 UTC (rev 1072)
@@ -28,9 +28,7 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-
import org.ajax4jsf.framework.renderer.HeaderResourcesRendererBase;
-import org.ajax4jsf.framework.renderer.RendererUtils;
import org.ajax4jsf.framework.renderer.compiler.TemplateContext;
import org.ajax4jsf.framework.skin.Skin;
import org.ajax4jsf.framework.util.style.CSSFormat;
@@ -61,8 +59,6 @@
String src = getIconByType("custom",false,context,component);
int w = 16; //width(context);
- RendererUtils utils = getUtils();
-
for (int i=0;i<level;i++){
writer.startElement(HTML.td_ELEM, component);
writer.startElement("img", component);
@@ -75,9 +71,7 @@
writer.writeAttribute("style", "display:block; ", null);
writer.endElement("img");
writer.endElement(HTML.td_ELEM);
- //buffer.append("<td><img src=\"" + src + "\" alt=\"\" hspace=\"0\" vspace=\"0\" height=\""+w+"\" width=\""+w+"\" style=\"display:block;\" /></td>\n");
}
- //writer.write(buffer.toString());
}
protected int calculateLevel (UIComponent component){
@@ -290,4 +284,21 @@
return mode;
}
+ /**
+ *
+ * @param component
+ * @return
+ */
+ public boolean isTopLevel(UIComponent component){
+ UIComponent parent = component.getParent();
+ while( !(parent instanceof UIPanelMenu) && !(parent instanceof UIPanelMenuGroup)) {
+ parent = parent.getParent();
+ }
+ if(parent instanceof UIPanelMenu){
+ return true;
+ } else {
+ return false;
+ }
+ }
+
}
Modified: trunk/sandbox/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js
===================================================================
--- trunk/sandbox/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js 2007-06-07 11:50:51 UTC (rev 1071)
+++ trunk/sandbox/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js 2007-06-07 12:49:22 UTC (rev 1072)
@@ -60,6 +60,7 @@
this.obj = $(ids.myId);
this.content = this._getDirectChildrenByTag(this.obj,"TD")[level+1];
this.iconAlign = iconAlign;
+ /*
if (level == 0){
this.tdhider.style.display = "";
this.tablehider.style.display = "";
@@ -67,6 +68,7 @@
this.tdhider.style.display = "";
this.tablehider.style.display = "";
}
+ */
this.iconCollapsed = iconCollapsed;
this.iconExpanded = iconExpanded;
this.iconSpacer = iconSpacer;
@@ -180,20 +182,17 @@
this.inputAction.setAttribute('value', this.obj.id);
},
+ postTrigger: function(e){
+ this.inputAction.setAttribute('value', '');
+ },
+
+
trigger: function(e){
if ("none" == this.mode)
return;
if (this.action !="panelMenuItemAction"){
this.preTrigger(e);
var form = Event.findElement(e, "form");
- //TODO by nick - dima - no need to create form
- if(!form || typeof(form) == 'undefined' || !form.tagName || form.tagName.toLowerCase() != 'form'){
- form = document.createElement('form');
- form.setAttribute('method', 'post');
- form.setAttribute('enctype', 'application/x-www-form-urlencoded');
- form.action = action;
- document.body.appendChild(form);
- }
if ("server" == this.mode) {
if (this.target)
form.target = this.target;
@@ -203,6 +202,7 @@
var event = e;
eval(this.ajaxSubmit);
}
+ this.postTrigger(e);
}
},
Modified: trunk/sandbox/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx
===================================================================
--- trunk/sandbox/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx 2007-06-07 11:50:51 UTC (rev 1071)
+++ trunk/sandbox/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx 2007-06-07 12:49:22 UTC (rev 1072)
@@ -12,7 +12,8 @@
>
<f:clientid var="clientId"/>
- <tr id="tdhide#{clientId}" style="#{this:getHideStyle(context, component)}" >
+ <tr id="tdhide#{clientId}" style="#{this:getHideStyle(context, component)}" >
+ <!-- "#{this:getHideStyle(context, component)}" -->
<td>
<jsp:scriptlet>
<![CDATA[
17 years, 7 months
JBoss Rich Faces SVN: r1071 - in trunk/sandbox/scrollable-grid/src: main/java/org/richfaces/model/selection and 8 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2007-06-07 07:50:51 -0400 (Thu, 07 Jun 2007)
New Revision: 1071
Added:
trunk/sandbox/scrollable-grid/src/test/java/org/richfaces/component/renderkit/
trunk/sandbox/scrollable-grid/src/test/java/org/richfaces/component/renderkit/html/
trunk/sandbox/scrollable-grid/src/test/java/org/richfaces/component/renderkit/html/SelectionRendererContributorTest.java
trunk/sandbox/scrollable-grid/src/test/java/org/richfaces/model/
trunk/sandbox/scrollable-grid/src/test/java/org/richfaces/model/selection/
trunk/sandbox/scrollable-grid/src/test/java/org/richfaces/model/selection/ClientSelectionConverterTest.java
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/model/selection/ClientSelectionConverter.java
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/SelectionRendererContributor.java
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx
Log:
added contributor to renderer
Modified: trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java 2007-06-07 11:14:02 UTC (rev 1070)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java 2007-06-07 11:50:51 UTC (rev 1071)
@@ -43,6 +43,7 @@
public abstract class UIScrollableGrid extends UIRepeat implements AjaxComponent, Sortable, Selectable{
+ public static final String COMPONENT_TYPE = "org.richfaces.component.ScrollableGrid";
private transient Collection partialUpdateChildren;
Modified: trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/model/selection/ClientSelectionConverter.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/model/selection/ClientSelectionConverter.java 2007-06-07 11:14:02 UTC (rev 1070)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/model/selection/ClientSelectionConverter.java 2007-06-07 11:50:51 UTC (rev 1071)
@@ -12,7 +12,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.richfaces.component.UIScrollableGrid;
/**
* @author Maksim Kaszynski
@@ -27,11 +26,15 @@
LogFactory.getLog(ClientSelectionConverter.class);
public Object getAsObject(FacesContext context, UIComponent component, String value) {
- return getAsSelection(context, (UIScrollableGrid) component, value);
+ return getAsSelection(context, component, value == null ? "" : value);
}
public String getAsString(FacesContext context, UIComponent component, Object value) {
+ if (log.isDebugEnabled()) {
+ log.debug("Converting to string " + value);
+ }
+
StringBuffer buffer = new StringBuffer();
Iterator iterator = ((ClientSelection) value).getRanges().iterator();
@@ -50,8 +53,12 @@
return buffer.toString();
}
- private ClientSelection getAsSelection(FacesContext context, UIScrollableGrid grid, String stringSelection) {
+ private ClientSelection getAsSelection(FacesContext context, UIComponent grid, String stringSelection) {
+ if (log.isDebugEnabled()) {
+ log.debug("parsing " + stringSelection);
+ }
+
final ClientSelection clientSelection = new ClientSelection();
String [] selections = stringSelection.split(";");
@@ -80,7 +87,6 @@
}
}
-
return clientSelection;
}
Modified: trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-07 11:14:02 UTC (rev 1070)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-07 11:50:51 UTC (rev 1071)
@@ -38,6 +38,7 @@
*/
public abstract class ScrollableGridBaseRenderer extends CompositeRenderer {
+
private final String FOOTER_PART = "footer";
@@ -293,7 +294,11 @@
state.nextRow();
}
};
-
+
+ public ScrollableGridBaseRenderer() {
+ addContributor(new SelectionRendererContributor());
+ }
+
public String getJavaScriptVarName(FacesContext context, UIScrollableGrid grid) {
String id = grid.getBaseClientId(context);
return "Richfaces_ScrollableGrid_" + id.replaceAll("[^A-Za-z0-9_]", "_");
@@ -544,11 +549,21 @@
writer.endElement("tbody");
writer.endElement("table");
+ GridRendererState.restoreState(context);
+ grid.setRowKey(null);
+
ajaxContext.setResponseData(grid.getResponseData());
ajaxContext.getAjaxRenderedAreas().remove(grid.getClientId(context));
GridScrollSettings options = createOptions(grid);
ajaxContext.getResponseDataMap().put("options", options);
grid.setRows(grid.getDefaultRows());
+
+
+ //Then call contributors to write additional HTML content
+ contributorsEncodeHere(context, grid);
+
+
+
}
private GridScrollSettings createOptions(UIScrollableGrid grid){
Modified: trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/SelectionRendererContributor.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/SelectionRendererContributor.java 2007-06-07 11:14:02 UTC (rev 1070)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/SelectionRendererContributor.java 2007-06-07 11:50:51 UTC (rev 1071)
@@ -29,7 +29,7 @@
* @author Maksim Kaszynski
*
*/
-public class SelectionRendererContributor implements RendererContributor {
+public class SelectionRendererContributor implements RendererContributor, HTMLEncodingContributor {
public static final String CLIENT_SELECTION = "clientSelection";
@@ -69,6 +69,7 @@
+
final GridRendererState state =
GridRendererState.createState(context, grid);
@@ -149,6 +150,17 @@
return null;
}
+
+ public void encode(FacesContext context, UIComponent component)
+ throws IOException {
+
+ UIScrollableGrid grid = (UIScrollableGrid) component;
+
+ encodeSelection(context, grid);
+ writeSelection(context, grid);
+ }
+
+
//Decide whether to add new row to selection based on comparison with old one
private boolean shouldAddToSelection(int i, ClientSelection oldSelection, ClientSelection newSelection) {
return false;
Modified: trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx 2007-06-07 11:14:02 UTC (rev 1070)
+++ trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx 2007-06-07 11:50:51 UTC (rev 1071)
@@ -167,6 +167,9 @@
<input type="hidden" name="#{clientId}_options_input" id="#{clientId}_options_input"/>
<input type="hidden" name="#{clienId}_rows_input" id="#{clientId}_rows_input" value="#{rows_count}"/>
<input type="button" name="#{clientId}_submit_input" id="#{clientId}_submit_input" onclick="#{this:getRowsAjaxUpdate(context,component)}" style="display:none"/>
+
+ <f:call name="contributorsEncodeHere"/>
+
</div>
<f:call name="tearDownState"/>
Added: trunk/sandbox/scrollable-grid/src/test/java/org/richfaces/component/renderkit/html/SelectionRendererContributorTest.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/test/java/org/richfaces/component/renderkit/html/SelectionRendererContributorTest.java (rev 0)
+++ trunk/sandbox/scrollable-grid/src/test/java/org/richfaces/component/renderkit/html/SelectionRendererContributorTest.java 2007-06-07 11:50:51 UTC (rev 1071)
@@ -0,0 +1,75 @@
+/**
+ *
+ */
+package org.richfaces.component.renderkit.html;
+
+import java.util.ArrayList;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.ExternalContext;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.apache.shale.test.mock.MockExternalContext;
+import org.richfaces.component.UIScrollableGrid;
+import org.richfaces.model.selection.ClientSelection;
+import org.richfaces.renderkit.html.ScrollableGridBaseRenderer;
+import org.richfaces.renderkit.html.SelectionRendererContributor;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class SelectionRendererContributorTest extends AbstractAjax4JsfTestCase {
+
+ private UIScrollableGrid component;
+ private SelectionRendererContributor contributor;
+ private ScrollableGridBaseRenderer renderer;
+
+ public SelectionRendererContributorTest(String name) {
+ super(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ component = (UIScrollableGrid) application.createComponent(UIScrollableGrid.COMPONENT_TYPE);
+ component.setValue(new ArrayList());
+ facesContext.getViewRoot().getChildren().add(component);
+ contributor = new SelectionRendererContributor();
+ renderer = new ScrollableGridBaseRenderer(){
+ protected Class getComponentClass() {
+ return UIScrollableGrid.class;
+ }};
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ this.component = null;
+ this.contributor = null;
+ }
+
+ /**
+ * Test method for {@link org.richfaces.renderkit.html.SelectionRendererContributor#decode(javax.faces.context.FacesContext, javax.faces.component.UIComponent, org.richfaces.renderkit.CompositeRenderer)}.
+ */
+ public void testDecode() {
+ MockExternalContext mockExternalContext =
+ (MockExternalContext) facesContext.getExternalContext();
+ String name =
+ SelectionRendererContributor.getSelectionInputName(facesContext, (UIScrollableGrid) component);
+
+ String value = "";
+
+ mockExternalContext.addRequestParameterMap(name, value);
+
+ contributor.decode(facesContext, component, renderer);
+
+ Object selection = component.getSelection();
+
+ }
+
+}
Added: trunk/sandbox/scrollable-grid/src/test/java/org/richfaces/model/selection/ClientSelectionConverterTest.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/test/java/org/richfaces/model/selection/ClientSelectionConverterTest.java (rev 0)
+++ trunk/sandbox/scrollable-grid/src/test/java/org/richfaces/model/selection/ClientSelectionConverterTest.java 2007-06-07 11:50:51 UTC (rev 1071)
@@ -0,0 +1,66 @@
+/**
+ *
+ */
+package org.richfaces.model.selection;
+
+import javax.faces.convert.Converter;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class ClientSelectionConverterTest extends AbstractAjax4JsfTestCase {
+
+ private Converter converter;
+
+ /**
+ * @param name
+ */
+ public ClientSelectionConverterTest(String name) {
+ super(name);
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ converter = application.createConverter(ClientSelection.class);
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ converter = null;
+ super.tearDown();
+ }
+
+ /**
+ * Test method for {@link org.richfaces.model.selection.ClientSelectionConverter#getAsObject(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.String)}.
+ */
+ public void testGetAsObject() {
+ fail("Not yet implemented"); // TODO
+ }
+
+ /**
+ * Test method for {@link org.richfaces.model.selection.ClientSelectionConverter#getAsString(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.Object)}.
+ */
+ public void testGetAsString() {
+
+ ClientSelection clientSelection = new ClientSelection();
+ clientSelection.addRange(new SelectionRange(2,3));
+ clientSelection.addRange(new SelectionRange(5,22));
+
+ String value = converter.getAsString(facesContext, null, clientSelection);
+
+ assertNotNull(value);
+ assertTrue(value.length() > 0);
+ assertEquals("2,3;5,22;", value);
+
+
+ }
+
+}
17 years, 7 months
JBoss Rich Faces SVN: r1070 - trunk/richfaces-samples/tree-demo/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-06-07 07:14:02 -0400 (Thu, 07 Jun 2007)
New Revision: 1070
Modified:
trunk/richfaces-samples/tree-demo/src/main/webapp/pages/index.jsp
Log:
http://jira.jboss.com/jira/browse/RF-93
Modified: trunk/richfaces-samples/tree-demo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/richfaces-samples/tree-demo/src/main/webapp/pages/index.jsp 2007-06-07 11:13:40 UTC (rev 1069)
+++ trunk/richfaces-samples/tree-demo/src/main/webapp/pages/index.jsp 2007-06-07 11:14:02 UTC (rev 1070)
@@ -20,7 +20,10 @@
.colored {
background-color: #FEFEDE;
}
-
+ .dr-tree-h-ic-img{
+ width : 32px;
+ height : 32px;
+ }
</style>
</head>
<body>
17 years, 7 months
JBoss Rich Faces SVN: r1069 - in trunk/richfaces/tree/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-06-07 07:13:40 -0400 (Thu, 07 Jun 2007)
New Revision: 1069
Modified:
trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/css/tree.xcss
trunk/richfaces/tree/src/main/templates/htmlTreeNode.jspx
Log:
http://jira.jboss.com/jira/browse/RF-93
Modified: trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/css/tree.xcss
===================================================================
--- trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/css/tree.xcss 2007-06-07 10:38:23 UTC (rev 1068)
+++ trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/css/tree.xcss 2007-06-07 11:13:40 UTC (rev 1069)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<f:template xmlns:f='http:/jsf.exadel.com/template'
- xmlns:u='http:/jsf.exadel.com/template/util'
+ xmlns:u='http:/jsf.exadel.com/template/util'
xmlns="http://www.w3.org/1999/xhtml" >
<f:verbatim><![CDATA[
@@ -16,9 +16,12 @@
padding : 1px
}
-.dr-tree-h-ic-img{
+.dr-tree-h-ic-img-md{
margin: 0px;
display: block;
+}
+
+.dr-tree-h-ic-img{
width : 16px;
height : 16px;
}
Modified: trunk/richfaces/tree/src/main/templates/htmlTreeNode.jspx
===================================================================
--- trunk/richfaces/tree/src/main/templates/htmlTreeNode.jspx 2007-06-07 10:38:23 UTC (rev 1068)
+++ trunk/richfaces/tree/src/main/templates/htmlTreeNode.jspx 2007-06-07 11:13:40 UTC (rev 1069)
@@ -33,66 +33,66 @@
<tr id="#{clientId}:mainRow" onclick="#{this:getToggleScript(context, component, 'mainRow')} return false;" >
<f:call name="encodeAttributeParameters" />
- <td class="dr-tree-h-ic #{line}">
+ <td class="dr-tree-h-ic #{line}">
<div>
<jsp:scriptlet>
<![CDATA[
if (org.richfaces.component.UITree.SWITCH_CLIENT.equals(component.getUITree().getSwitchType())) {
]]>
- </jsp:scriptlet>
+ </jsp:scriptlet>
<input class="dr-tree-h-input" type="hidden" id="#{clientId}NodeExpanded" name="#{clientId}NodeExpanded" value="#{this:getExpandedValue(context,component)}" />
<jsp:scriptlet>
<![CDATA[
}
]]>
- </jsp:scriptlet>
+ </jsp:scriptlet>
<jsp:scriptlet>
<![CDATA[
if (component.getUITree().isLeaf()) {
]]>
- </jsp:scriptlet>
- <img id="#{clientId}:handle:img" src="#{spacer}" alt="" class="dr-tree-h-ic-img" />
+ </jsp:scriptlet>
+ <img id="#{clientId}:handle:img" src="#{spacer}" alt="" class="dr-tree-h-ic-img-md dr-tree-h-ic-img" />
<jsp:scriptlet>
<![CDATA[
} else {
]]>
- </jsp:scriptlet>
+ </jsp:scriptlet>
<a href="#" id="#{clientId}:handle"
- onclick="#{this:getToggleScript(context, component, 'handle')} return false;">
+ onclick="#{this:getToggleScript(context, component, 'handle')} return false;">
<jsp:scriptlet>
<![CDATA[
UIComponent iconCollapsedFacet = component.getIconCollapsedFacet();
if (iconCollapsedFacet != null && iconCollapsedFacet.isRendered()) {
]]>
- </jsp:scriptlet>
+ </jsp:scriptlet>
<span id="#{clientId}:handle:img:collapsed"
- class="dr-tree-pointer-cursor dr-tree-h-ic-img dr-tree-h-ic-facets"
+ class="dr-tree-pointer-cursor dr-tree-h-ic-img-md dr-tree-h-ic-img dr-tree-h-ic-facets"
style="#{this:getHandleCollapsedDisplayStyle(context, component)}">
-
+
<jsp:scriptlet>
<![CDATA[
renderChild(context, iconCollapsedFacet);
]]>
- </jsp:scriptlet>
- </span>
+ </jsp:scriptlet>
+ </span>
<jsp:scriptlet>
<![CDATA[
} else {
]]>
- </jsp:scriptlet>
+ </jsp:scriptlet>
<img border="0" id="#{clientId}:handle:img:collapsed"
- src="#{collapsed}" class="dr-tree-pointer-cursor dr-tree-h-ic-img"
+ src="#{collapsed}" class="dr-tree-pointer-cursor dr-tree-h-ic-img-md dr-tree-h-ic-img"
style="#{this:getHandleCollapsedDisplayStyle(context, component)}" alt="" />
<jsp:scriptlet>
<![CDATA[
}
]]>
- </jsp:scriptlet>
+ </jsp:scriptlet>
<jsp:scriptlet>
@@ -100,36 +100,36 @@
UIComponent iconExpandedFacet = component.getIconExpandedFacet();
if (iconExpandedFacet != null && iconExpandedFacet.isRendered()) {
]]>
- </jsp:scriptlet>
+ </jsp:scriptlet>
<span id="#{clientId}:handle:img:expanded"
style="#{this:getHandleExpandedDisplayStyle(context, component)}"
- class="dr-tree-pointer-cursor dr-tree-h-ic-img dr-tree-h-ic-facets">
-
+ class="dr-tree-pointer-cursor dr-tree-h-ic-img-md dr-tree-h-ic-img dr-tree-h-ic-facets">
+
<jsp:scriptlet>
<![CDATA[
renderChild(context, iconExpandedFacet);
]]>
- </jsp:scriptlet>
- </span>
+ </jsp:scriptlet>
+ </span>
<jsp:scriptlet>
<![CDATA[
} else {
]]>
- </jsp:scriptlet>
+ </jsp:scriptlet>
<img border="0" id="#{clientId}:handle:img:expanded" src="#{expanded}"
style="#{this:getHandleExpandedDisplayStyle(context, component)}"
- class="dr-tree-pointer-cursor dr-tree-h-ic-img" alt="" />
+ class="dr-tree-pointer-cursor dr-tree-h-ic-img-md dr-tree-h-ic-img" alt="" />
<jsp:scriptlet>
<![CDATA[
}
]]>
- </jsp:scriptlet>
- </a>
+ </jsp:scriptlet>
+ </a>
<jsp:scriptlet>
<![CDATA[
}
]]>
- </jsp:scriptlet>
+ </jsp:scriptlet>
</div>
</td>
<td
@@ -149,19 +149,19 @@
]]>
</jsp:scriptlet>
- <span class="dr-tree-h-ic-img dr-tree-h-ic-facets">
+ <span class="dr-tree-h-ic-img-md dr-tree-h-ic-img dr-tree-h-ic-facets">
<jsp:scriptlet>
<![CDATA[
renderChild(context, leafFacet);
]]>
- </jsp:scriptlet>
+ </jsp:scriptlet>
</span>
<jsp:scriptlet>
<![CDATA[
} else {
]]>
</jsp:scriptlet>
- <img src="#{leaf}" alt="" class="dr-tree-h-ic-img" />
+ <img src="#{leaf}" alt="" class="dr-tree-h-ic-img-md dr-tree-h-ic-img" />
<jsp:scriptlet>
<![CDATA[
}
@@ -174,19 +174,19 @@
if (iconFacet != null && iconFacet.isRendered()) {
]]>
</jsp:scriptlet>
- <span class="dr-tree-h-ic-img dr-tree-h-ic-facets">
+ <span class="dr-tree-h-ic-img-md dr-tree-h-ic-img dr-tree-h-ic-facets">
<jsp:scriptlet>
<![CDATA[
renderChild(context, iconFacet);
]]>
- </jsp:scriptlet>
+ </jsp:scriptlet>
</span>
<jsp:scriptlet>
<![CDATA[
} else {
]]>
</jsp:scriptlet>
- <img src="#{folder}" alt="" class="dr-tree-h-ic-img" />
+ <img src="#{folder}" alt="" class="dr-tree-h-ic-img-md dr-tree-h-ic-img" />
<jsp:scriptlet>
<![CDATA[
}
17 years, 7 months
JBoss Rich Faces SVN: r1068 - trunk/richfaces-samples/simpleTogglePanel-sample/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-06-07 06:38:23 -0400 (Thu, 07 Jun 2007)
New Revision: 1068
Modified:
trunk/richfaces-samples/simpleTogglePanel-sample/src/main/webapp/pages/index.jsp
Log:
http://jira.jboss.com/jira/browse/RF-255
Modified: trunk/richfaces-samples/simpleTogglePanel-sample/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/richfaces-samples/simpleTogglePanel-sample/src/main/webapp/pages/index.jsp 2007-06-07 10:37:20 UTC (rev 1067)
+++ trunk/richfaces-samples/simpleTogglePanel-sample/src/main/webapp/pages/index.jsp 2007-06-07 10:38:23 UTC (rev 1068)
@@ -27,6 +27,9 @@
style="font: 18px;font-weight: bold;"/>
<stp:simpleTogglePanel switchType="client" id="panel1" label="client switchType"
width="#{bean.width}" opened="false" height="#{bean.height}" style="#{bean.style}">
+ <f:facet name="header">
+ <h:outputText value="client switchType from facet" />
+ </f:facet>
<f:facet name="closeMarker">
<h:outputText value="Close It" />
</f:facet>
17 years, 7 months