Author: maksimkaszynski
Date: 2007-07-23 15:02:50 -0400 (Mon, 23 Jul 2007)
New Revision: 1809
Added:
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/convert/
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/convert/selection/
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/convert/selection/ClientSelectionConverter.java
Removed:
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Selectable.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Sortable.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/scroll/
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortEvent.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortListener.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortSource.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/
Log:
introduced framework/impl-parent and sandbox/impl modules
Deleted:
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Selectable.java
===================================================================
---
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Selectable.java 2007-07-23
18:59:03 UTC (rev 1808)
+++
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Selectable.java 2007-07-23
19:02:50 UTC (rev 1809)
@@ -1,15 +0,0 @@
-/**
- *
- */
-package org.richfaces.component;
-
-import org.richfaces.model.selection.Selection;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public interface Selectable {
- public Selection getSelection();
- public void setSelection (Selection selection);
-}
Deleted:
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Sortable.java
===================================================================
---
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Sortable.java 2007-07-23
18:59:03 UTC (rev 1808)
+++
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Sortable.java 2007-07-23
19:02:50 UTC (rev 1809)
@@ -1,23 +0,0 @@
-/*
- * Copyright
- * Copyright (c) Exadel,Inc. 2006
- * All rights reserved.
- *
- * History
- * $Source:
/cvs-master/intralinks-jsf-comps/components/data-view-grid/src/component/com/exadel/jsf/component/Sortable.java,v
$
- * $Revision: 1.1 $
- */
-
-package org.richfaces.component;
-
-import org.richfaces.model.SortOrder;
-
-
-/**
- * @author Maksim Kaszynski
- * Base interface for sort capable components
- */
-public interface Sortable {
- public SortOrder getSortOrder();
- public void setSortOrder(SortOrder sortOrder);
-}
Added:
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/convert/selection/ClientSelectionConverter.java
===================================================================
---
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/convert/selection/ClientSelectionConverter.java
(rev 0)
+++
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/convert/selection/ClientSelectionConverter.java 2007-07-23
19:02:50 UTC (rev 1809)
@@ -0,0 +1,98 @@
+/**
+ *
+ */
+package org.richfaces.convert.selection;
+
+import java.util.Iterator;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.richfaces.model.selection.ClientSelection;
+import org.richfaces.model.selection.SelectionRange;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class ClientSelectionConverter implements Converter {
+
+ public static final String CONVERTER_ID =
+ ClientSelectionConverter.class.getName();
+
+ private static final Log log =
+ LogFactory.getLog(ClientSelectionConverter.class);
+
+ public Object getAsObject(FacesContext context, UIComponent component, String 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();
+
+ while(iterator.hasNext()) {
+
+ SelectionRange selectionRange =
+ (SelectionRange) iterator.next();
+
+ buffer
+ .append(selectionRange.getStartIndex())
+ .append(",")
+ .append(selectionRange.getEndIndex())
+ .append(";");
+ }
+
+ return buffer.toString();
+ }
+
+ 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(";");
+ int length = selections.length;
+ if (selections[length-1].length() == 1) {
+ clientSelection.setSelectionFlag(selections[length-1]);
+ length--;
+ }
+ for (int i = 0; i < length; i++) {
+
+ String range = selections[i];
+
+ if (range.length() != 0) {
+ String [] rng = range.split(",");
+
+ try {
+ int fi = Integer.parseInt(rng[0]);
+ int il = Integer.parseInt(rng[1]);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Parsed range " + fi + " " + il);
+ }
+
+ clientSelection.addRange(new SelectionRange(fi, il));
+
+ } catch (NumberFormatException e) {
+ throw new ConverterException(e);
+ }
+ }
+ }
+
+ return clientSelection;
+ }
+
+}
Deleted:
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortEvent.java
===================================================================
---
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortEvent.java 2007-07-23
18:59:03 UTC (rev 1808)
+++
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortEvent.java 2007-07-23
19:02:50 UTC (rev 1809)
@@ -1,95 +0,0 @@
-/*
- * Copyright
- * Copyright (c) Exadel,Inc. 2006
- * All rights reserved.
- *
- * History
- * $Source:
/cvs-master/intralinks-jsf-comps/components/data-view-grid/src/component/com/exadel/jsf/event/sort/SortEvent.java,v
$
- * $Revision: 1.2 $
- */
-
-package org.richfaces.event.sort;
-
-import javax.faces.component.UIComponent;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-
-/**
- * @author Maksim Kaszynski
- * @modified by Anton Belevich
- *
- */
-public class SortEvent extends FacesEvent {
-
- private static final long serialVersionUID = -1453867412542792281L;
-
- private int sortColumn;
-
- private int startRow;
-
- private int dataIndex;
-
- private boolean asc;
-
-
- public SortEvent(
- UIComponent component, int sortColumn, int startRow, int dataIndex, boolean asc) {
-
- super(component);
- this.asc = asc;
- this.sortColumn = sortColumn;
- this.startRow = startRow;
- this.dataIndex = dataIndex;
-
- }
-
- public boolean isAppropriateListener(FacesListener listener) {
- return (listener instanceof SortListener);
- }
-
- public void processListener(FacesListener listener) {
- ((SortListener) listener).processSort(this);
- }
-
- /**
- * @return the sortField
- */
- public int getSortColumn() {
- return sortColumn;
- }
-
- /**
- * @see java.util.EventObject#toString()
- */
- public String toString() {
- return "SortEvent: {sortColumn: " + sortColumn + "}";
- }
-
- public boolean isAsc() {
- return asc;
- }
-
- public void setAsc(boolean asc) {
- this.asc = asc;
- }
-
- public int getDataIndex() {
- return dataIndex;
- }
-
- public void setDataIndex(int dataIndex) {
- this.dataIndex = dataIndex;
- }
-
- public int getStartRow() {
- return startRow;
- }
-
- public void setStartRow(int startRow) {
- this.startRow = startRow;
- }
-
- public void setSortColumn(int sortColumn) {
- this.sortColumn = sortColumn;
- }
-}
Deleted:
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortListener.java
===================================================================
---
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortListener.java 2007-07-23
18:59:03 UTC (rev 1808)
+++
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortListener.java 2007-07-23
19:02:50 UTC (rev 1809)
@@ -1,21 +0,0 @@
-/*
- * Copyright
- * Copyright (c) Exadel,Inc. 2006
- * All rights reserved.
- *
- * History
- * $Source:
/cvs-master/intralinks-jsf-comps/components/data-view-grid/src/component/com/exadel/jsf/event/sort/SortListener.java,v
$
- * $Revision: 1.1 $
- */
-
-package org.richfaces.event.sort;
-
-import javax.faces.event.FacesListener;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public interface SortListener extends FacesListener {
- public void processSort(SortEvent e);
-}
Deleted:
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortSource.java
===================================================================
---
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortSource.java 2007-07-23
18:59:03 UTC (rev 1808)
+++
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortSource.java 2007-07-23
19:02:50 UTC (rev 1809)
@@ -1,21 +0,0 @@
-/*
- * Copyright
- * Copyright (c) Exadel,Inc. 2006
- * All rights reserved.
- *
- * History
- * $Source:
/cvs-master/intralinks-jsf-comps/components/data-view-grid/src/component/com/exadel/jsf/event/sort/SortSource.java,v
$
- * $Revision: 1.1 $
- */
-
-package org.richfaces.event.sort;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public interface SortSource {
- public void addSortListener(SortListener listener);
- public void removeSortListener(SortListener listener);
- public SortListener[] getSortListeners();
-}
Show replies by date