[richfaces-svn-commits] JBoss Rich Faces SVN: r1386 - in branches/refactor: framework/api/src/main/java/org and 32 other directories.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Thu Jun 28 15:18:37 EDT 2007
Author: alexsmirnov
Date: 2007-06-28 15:18:37 -0400 (Thu, 28 Jun 2007)
New Revision: 1386
Added:
branches/refactor/framework/api/src/main/java/org/
branches/refactor/framework/api/src/main/java/org/richfaces/
branches/refactor/framework/api/src/main/java/org/richfaces/component/
branches/refactor/framework/api/src/main/java/org/richfaces/component/AbstractTreeDataModel.java
branches/refactor/framework/api/src/main/java/org/richfaces/component/CalendarDataModel.java
branches/refactor/framework/api/src/main/java/org/richfaces/component/CalendarDataModelItem.java
branches/refactor/framework/api/src/main/java/org/richfaces/component/Column.java
branches/refactor/framework/api/src/main/java/org/richfaces/component/LastElementAware.java
branches/refactor/framework/api/src/main/java/org/richfaces/component/ListRowKey.java
branches/refactor/framework/api/src/main/java/org/richfaces/component/Row.java
branches/refactor/framework/api/src/main/java/org/richfaces/component/TreeDataModel.java
branches/refactor/framework/api/src/main/java/org/richfaces/component/TreeListenerEventsProducer.java
branches/refactor/framework/api/src/main/java/org/richfaces/component/TreeNode.java
branches/refactor/framework/api/src/main/java/org/richfaces/component/TreeNodeImpl.java
branches/refactor/framework/api/src/main/java/org/richfaces/component/TreeRowKey.java
branches/refactor/framework/api/src/main/java/org/richfaces/component/events/
branches/refactor/framework/api/src/main/java/org/richfaces/component/events/AjaxSelectedEvent.java
branches/refactor/framework/api/src/main/java/org/richfaces/component/events/NodeExpandedEvent.java
branches/refactor/framework/api/src/main/java/org/richfaces/component/events/NodeExpandedListener.java
branches/refactor/framework/api/src/main/java/org/richfaces/component/events/NodeSelectedEvent.java
branches/refactor/framework/api/src/main/java/org/richfaces/component/events/NodeSelectedListener.java
branches/refactor/framework/api/src/main/java/org/richfaces/component/state/
branches/refactor/framework/api/src/main/java/org/richfaces/component/state/TreeRange.java
branches/refactor/framework/api/src/main/java/org/richfaces/component/state/TreeStateAdvisor.java
branches/refactor/framework/api/src/main/java/org/richfaces/component/xml/
branches/refactor/framework/api/src/main/java/org/richfaces/component/xml/XmlNodeData.java
branches/refactor/framework/api/src/main/java/org/richfaces/component/xml/XmlTreeDataBuilder.java
branches/refactor/framework/api/src/main/java/org/richfaces/event/
branches/refactor/framework/api/src/main/java/org/richfaces/event/DataFilterSliderEvent.java
branches/refactor/framework/api/src/main/java/org/richfaces/event/DataFilterSliderListener.java
branches/refactor/framework/api/src/main/java/org/richfaces/event/DataFilterSliderSource.java
branches/refactor/framework/api/src/main/java/org/richfaces/event/DataScrollerEvent.java
branches/refactor/framework/api/src/main/java/org/richfaces/event/DataScrollerListener.java
branches/refactor/framework/api/src/main/java/org/richfaces/event/DataScrollerSource.java
branches/refactor/framework/api/src/main/java/org/richfaces/event/ISimpleToggleListener.java
branches/refactor/framework/api/src/main/java/org/richfaces/event/SimpleToggleEvent.java
branches/refactor/sandbox/api/src/main/java/org/
branches/refactor/sandbox/api/src/main/java/org/richfaces/
branches/refactor/sandbox/api/src/main/java/org/richfaces/component/
branches/refactor/sandbox/api/src/main/java/org/richfaces/component/Selectable.java
branches/refactor/sandbox/api/src/main/java/org/richfaces/component/Sortable.java
branches/refactor/sandbox/api/src/main/java/org/richfaces/event/
branches/refactor/sandbox/api/src/main/java/org/richfaces/event/ISimpleToggle2Listener.java
branches/refactor/sandbox/api/src/main/java/org/richfaces/event/SimpleToggle2Event.java
branches/refactor/sandbox/api/src/main/java/org/richfaces/event/scroll/
branches/refactor/sandbox/api/src/main/java/org/richfaces/event/scroll/ScrollEvent.java
branches/refactor/sandbox/api/src/main/java/org/richfaces/event/sort/
branches/refactor/sandbox/api/src/main/java/org/richfaces/event/sort/SortEvent.java
branches/refactor/sandbox/api/src/main/java/org/richfaces/event/sort/SortListener.java
branches/refactor/sandbox/api/src/main/java/org/richfaces/event/sort/SortSource.java
branches/refactor/sandbox/api/src/main/java/org/richfaces/model/
branches/refactor/sandbox/api/src/main/java/org/richfaces/model/DataModelCache.java
branches/refactor/sandbox/api/src/main/java/org/richfaces/model/GridDataModel.java
branches/refactor/sandbox/api/src/main/java/org/richfaces/model/ScrollableGridRange.java
branches/refactor/sandbox/api/src/main/java/org/richfaces/model/SortOrder.java
branches/refactor/sandbox/api/src/main/java/org/richfaces/model/selection/
branches/refactor/sandbox/api/src/main/java/org/richfaces/model/selection/ClientSelection.java
branches/refactor/sandbox/api/src/main/java/org/richfaces/model/selection/Selection.java
branches/refactor/sandbox/api/src/main/java/org/richfaces/model/selection/SelectionRange.java
branches/refactor/sandbox/api/src/main/java/org/richfaces/model/selection/SimpleSelection.java
Removed:
branches/refactor/sandbox/ui/calendar/src/main/java/org/richfaces/component/CalendarDataModel.java
branches/refactor/sandbox/ui/calendar/src/main/java/org/richfaces/component/CalendarDataModelItem.java
branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Selectable.java
branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Sortable.java
branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/scroll/ScrollEvent.java
branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortEvent.java
branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortListener.java
branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortSource.java
branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/DataModelCache.java
branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/GridDataModel.java
branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/ScrollableGridRange.java
branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/SortOrder.java
branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/ClientSelection.java
branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/Selection.java
branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/SelectionRange.java
branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/SimpleSelection.java
branches/refactor/sandbox/ui/simpleTogglePanel2/src/main/java/org/richfaces/event/ISimpleToggle2Listener.java
branches/refactor/sandbox/ui/simpleTogglePanel2/src/main/java/org/richfaces/event/SimpleToggle2Event.java
branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/event/DataFilterSliderEvent.java
branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/event/DataFilterSliderListener.java
branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/event/DataFilterSliderSource.java
branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/events/DataFilterSliderAdapter.java
branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/events/DataFilterSliderEvent.java
branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/events/DataFilterSliderListener.java
branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/events/DataFilterSliderSource.java
branches/refactor/ui/dataTable/src/main/java/org/richfaces/component/Column.java
branches/refactor/ui/dataTable/src/main/java/org/richfaces/component/Row.java
branches/refactor/ui/datascroller/src/main/java/org/richfaces/event/DataScrollerEvent.java
branches/refactor/ui/datascroller/src/main/java/org/richfaces/event/DataScrollerListener.java
branches/refactor/ui/datascroller/src/main/java/org/richfaces/event/DataScrollerSource.java
branches/refactor/ui/simpleTogglePanel/src/main/java/org/richfaces/event/ISimpleToggleListener.java
branches/refactor/ui/simpleTogglePanel/src/main/java/org/richfaces/event/SimpleToggleEvent.java
branches/refactor/ui/tabPanel/src/main/java/org/richfaces/model/TabModel.java
branches/refactor/ui/tree/src/main/java/org/richfaces/component/AbstractTreeDataModel.java
branches/refactor/ui/tree/src/main/java/org/richfaces/component/CacheableTreeDataModel.java
branches/refactor/ui/tree/src/main/java/org/richfaces/component/LastElementAware.java
branches/refactor/ui/tree/src/main/java/org/richfaces/component/ListRowKey.java
branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeDataModel.java
branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeListenerEventsProducer.java
branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeNode.java
branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeNodeImpl.java
branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeRowKey.java
branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/AjaxSelectedEvent.java
branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/NodeExpandedEvent.java
branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/NodeExpandedListener.java
branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/NodeSelectedEvent.java
branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/NodeSelectedListener.java
branches/refactor/ui/tree/src/main/java/org/richfaces/component/state/TreeRange.java
branches/refactor/ui/tree/src/main/java/org/richfaces/component/state/TreeStateAdvisor.java
branches/refactor/ui/tree/src/main/java/org/richfaces/component/xml/XmlNodeData.java
branches/refactor/ui/tree/src/main/java/org/richfaces/component/xml/XmlTreeDataBuilder.java
Log:
Move classes to API projects
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/component/AbstractTreeDataModel.java (from rev 1385, branches/refactor/ui/tree/src/main/java/org/richfaces/component/AbstractTreeDataModel.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/component/AbstractTreeDataModel.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/component/AbstractTreeDataModel.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,139 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import java.io.IOException;
+
+import javax.faces.component.NamingContainer;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.ajax.repeat.DataVisitor;
+import org.ajax4jsf.ajax.repeat.ExtendedDataModel;
+import org.ajax4jsf.ajax.repeat.Range;
+import org.ajax4jsf.ajax.repeat.UIDataAdaptor;
+import org.richfaces.component.state.TreeRange;
+
+/**
+ * @author Nick Belaevski - nbelaevski at exadel.com created 07.12.2006
+ * Base class for all tree data models
+ */
+public abstract class AbstractTreeDataModel extends ExtendedDataModel {
+ public final static char SEPARATOR = NamingContainer.SEPARATOR_CHAR;
+
+ private TreeNode wrappedData;
+
+ public final int getRowCount() {
+ return -1;
+ }
+
+ public final int getRowIndex() {
+ return -1;
+ }
+
+ public final void setRowIndex(int rowIndex) {
+ if(rowIndex!=-1) {
+ throw new IllegalArgumentException("In AbstractTreeDataModel rowIndex must be -1.");
+ }
+ }
+
+ public final Object getWrappedData() {
+ return wrappedData;
+ }
+
+ public final void setWrappedData(Object data) {
+ wrappedData = (TreeNode) data;
+ }
+
+ public final void walk(FacesContext context, DataVisitor dataVisitor,
+ Range range, Object argument) throws IOException {
+ walk(context, dataVisitor, range, null, argument, false);
+ }
+
+ /**
+ * walk sub-model having row key argument as its root
+ * @param context faces context
+ * @param dataVisitor {@link UIDataAdaptor.ComponentVisitor}
+ * @param range {@link TreeRange} to constraint the walk
+ * @param rowKey row key to treat as root of sub-model
+ * @param argument implementation specific argument
+ * @param last boolean flag indicating whether we started our walk from last element
+ * @throws IOException
+ *
+ * @see {@link ExtendedDataModel#walk(FacesContext, DataVisitor, Range, Object)}
+ */
+ public abstract void walk(FacesContext context, DataVisitor dataVisitor,
+ Range range, Object rowKey, Object argument, boolean last) throws IOException;
+
+ /**
+ * returns whether this node is leaf
+ * @return
+ */
+ public abstract boolean isLeaf();
+
+ /**
+ * Walk backing sub-model having row key argument as its root. If there is no backing model
+ * configured, calling this method is equivalent to calling {@link #walk(FacesContext, DataVisitor, Range, Object, Object, boolean)}
+ * @param facesContext faces context
+ * @param visitor {@link UIDataAdaptor.ComponentVisitor} instance
+ * @param range {@link Range} to constraint the walk
+ * @param key row key to treat as root of sub-model
+ * @param argument implementation-specific argument
+ * @throws IOException
+ *
+ * @see {@link #walk(FacesContext, DataVisitor, Range, TreeRowKey, Object, boolean)}
+ */
+ public abstract void walkModel(FacesContext facesContext, DataVisitor visitor, Range range, Object key, Object argument, boolean last) throws IOException;
+
+ /**
+ * Processes concrete tree node. Knows about {@link LastElementAware} interface and handles it
+ * properly. Checks if argument is instance of {@link SubTreeChildrenAppender} and if it is so
+ * does appending current element
+ * @param context
+ * @param dataVisitor
+ * @param argument
+ * @param treeRowKey
+ * @param last
+ * @throws IOException
+ */
+ protected void processElement(FacesContext context, DataVisitor dataVisitor, Object argument, TreeRowKey treeRowKey, boolean last) throws IOException {
+// if (argument instanceof SubTreeChildrenAppender) {
+// setRowKey(treeRowKey);
+//
+// if (isRowAvailable()) {
+// ((SubTreeChildrenAppender) argument).addChild(treeRowKey, getRowData(), last, isLeaf(), getTreeNodeType());
+// }
+// }
+
+ if (last && dataVisitor instanceof LastElementAware) {
+ try {
+ ((LastElementAware) dataVisitor).setLastElement();
+ dataVisitor.process(context, treeRowKey, argument);
+ } finally {
+ ((LastElementAware) dataVisitor).resetLastElement();
+ }
+ } else {
+ dataVisitor.process(context, treeRowKey, argument);
+ }
+ }
+
+ public abstract TreeNode getTreeNode();
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/component/CalendarDataModel.java (from rev 1385, branches/refactor/sandbox/ui/calendar/src/main/java/org/richfaces/component/CalendarDataModel.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/component/CalendarDataModel.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/component/CalendarDataModel.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,44 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.component;
+
+import java.util.Date;
+/**
+ * @author Alexej Kushunin
+ * created 19.06.2007
+ *
+ */
+public interface CalendarDataModel {
+
+ /**
+ * @return array of CalendarDataModelItems for selected dates.
+ * This method will be called every time when components will need next block of CalendarDataItems.
+ * That may happens when calendar rendered, or when user navigate to next(previous) month or in any other case when calendar renders.
+ * This method will be called in Ajax mode when Calendar renders new page.
+ * */
+ public CalendarDataModelItem[] getData(Date[] dateArray);
+
+ /**
+ * @return tool tip when it's used in "single" mode
+ * This method used when tool tips are displayed in "single" mode
+ * */
+ public Object getToolTip(Date date);
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/component/CalendarDataModelItem.java (from rev 1385, branches/refactor/sandbox/ui/calendar/src/main/java/org/richfaces/component/CalendarDataModelItem.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/component/CalendarDataModelItem.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/component/CalendarDataModelItem.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,65 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.component;
+
+import java.util.Date;
+
+
+/**
+ * @author Alexej Kushunin
+ * created 19.06.2007
+ *
+ */
+
+public interface CalendarDataModelItem {
+
+ /**
+ * @return date that this item for, default implementation return Date
+ * */
+ public Date getDate();
+
+ /**
+ *@return true if date is selectable on calendar, default implementation return true
+ **/
+ public boolean isEnabled();
+
+ /**
+ * @return String that will be appended to style class for that date span.
+ * For example it may be relevant holyday that mean class will be like rich-cal-day relevant holyday.
+ * Default implementation return empty string.
+ * */
+ public String getStyleClass();
+
+ /**
+ * @return any additional payload that must be JSON-serialazable object.
+ * May be used in custom date representation on calendar (inside custom facet).*/
+ public Object getData();
+
+ /**
+ * @return true if given date has an associated with it tooltip data.
+ * Default implementation return false.*/
+ public boolean hasToolTip();
+
+ /**
+ *@return tool tip data that will be used in batch tooltip loading mode.
+ **/
+ public Object getToolTip();
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/component/Column.java (from rev 1385, branches/refactor/ui/dataTable/src/main/java/org/richfaces/component/Column.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/component/Column.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/component/Column.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,45 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+/**
+ * Marker interface for all components used as column in UIDataTable
+ * @author shura
+ *
+ */
+public interface Column {
+
+
+ /**
+ * Out this column on new row
+ * @parameter
+ * @return the acceptClass
+ */
+ public abstract boolean isBreakBefore();
+
+ /**
+ * @param newBreakBefore the value to set
+ */
+ public abstract void setBreakBefore(boolean newBreakBefore);
+
+
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/component/LastElementAware.java (from rev 1385, branches/refactor/ui/tree/src/main/java/org/richfaces/component/LastElementAware.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/component/LastElementAware.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/component/LastElementAware.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,45 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import org.ajax4jsf.ajax.repeat.UIDataAdaptor;
+
+/**
+ * @author Konstantin Mishin
+ *
+ * {@link UIDataAdaptor.ComponentVisitor} instances can implement this interface in order to
+ * be notified of last element occurence at the current tree level. {@link #setLastElement()}
+ * method is invoked before visiting last element and {@link #resetLastElement()} is called after
+ * visiting last element.
+ */
+public interface LastElementAware {
+
+ /**
+ * The method is invoked to notify that last element occured
+ */
+ public void setLastElement();
+ /**
+ * The method is invoked to notify that we're done with last element
+ */
+ public void resetLastElement();
+
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/component/ListRowKey.java (from rev 1385, branches/refactor/ui/tree/src/main/java/org/richfaces/component/ListRowKey.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/component/ListRowKey.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/component/ListRowKey.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,236 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author Nick Belaevski - nbelaevski at exadel.com
+ * created 17.11.2006
+ * Default {@link TreeRowKey} implementation based on {@link ArrayList}
+ */
+public class ListRowKey extends TreeRowKey {
+
+ private ArrayList path;
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 7718335783201397177L;
+
+ public String toString() {
+ return getPath();
+ }
+
+ /**
+ * Default constructor
+ */
+ public ListRowKey() {
+ super();
+ this.path = new ArrayList();
+ }
+
+ /**
+ * Copy constructor
+ * @param parentRowKey row key to clone
+ */
+ protected ListRowKey(ListRowKey parentRowKey) {
+ super();
+ this.path = (ArrayList) parentRowKey.path.clone();
+ }
+
+ /**
+ * Appending constructor
+ * @param parentRowKey base row key
+ * @param pathElement path segment to append to base row key
+ */
+ public ListRowKey(ListRowKey parentRowKey, Object pathElement) {
+ this(parentRowKey);
+ this.path.add(pathElement);
+ }
+
+ private static ArrayList parsePath(String path) {
+ ArrayList result = new ArrayList();
+
+ String trimmedPath = path.trim();
+
+ StringBuffer sb = new StringBuffer();
+ boolean escapedState = false;
+ int pathLength = trimmedPath.length();
+
+ //unescape
+ for (int i = 0; i < pathLength; i++) {
+ char c = trimmedPath.charAt(i);
+
+ if (SEPARATOR_ESCAPE_CHAR == c) {
+ if (escapedState) {
+ sb.append(c);
+ }
+ escapedState = !escapedState;
+ } else {
+ if (c == AbstractTreeDataModel.SEPARATOR) {
+ if (escapedState) {
+ sb.append(c);
+ } else {
+ result.add(sb.toString());
+ sb = new StringBuffer();
+ }
+ } else {
+ sb.append(c);
+ }
+
+ escapedState = false;
+ }
+ }
+
+ if (sb.length() != 0) {
+ result.add(sb.toString());
+ }
+
+ return result;
+ }
+
+ /**
+ * List constructor
+ * @param list List of strings to create corresponding row key from
+ */
+ public ListRowKey(List list) {
+ super();
+
+ this.path = new ArrayList(list);
+ }
+
+ /**
+ * Path object constructor
+ * @param path first path segment
+ */
+ public ListRowKey(Object path) {
+ super();
+ this.path = new ArrayList(1);
+ this.path.add(path);
+ }
+
+ /**
+ * Path string constructor
+ * @param path path string to create corresponding row key from
+ */
+ public ListRowKey(String path) {
+ super();
+ this.path = parsePath(path);
+ }
+
+ public int depth() {
+ return path.size();
+ }
+
+ public Iterator iterator() {
+ return path.iterator();
+ }
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((path == null) ? 0 : path.hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final ListRowKey other = (ListRowKey) obj;
+ if (path == null) {
+ if (other.path != null)
+ return false;
+ } else if (!path.equals(other.path))
+ return false;
+ return true;
+ }
+
+ public Iterator getSubPathIterator(int fromIndex) {
+ return path.listIterator(fromIndex);
+ }
+
+ public boolean isSubKey(TreeRowKey rowKey) {
+ if (rowKey instanceof ListRowKey) {
+ ListRowKey listRowKey = (ListRowKey) rowKey;
+
+ int commonLength = getCommonPathLength(listRowKey);
+ if (commonLength != 0) {
+ return commonLength == depth();
+ } else {
+ return rowKey.depth() == 0;
+ }
+ } else {
+ return super.isSubKey(rowKey);
+ }
+ }
+
+ public String getPath() {
+ StringBuffer result = new StringBuffer();
+ Iterator iterator = path.iterator();
+ boolean hasNext = iterator.hasNext();
+
+ while (hasNext) {
+ String pathSegment = iterator.next().toString();
+
+ StringBuffer escapedSubPath = new StringBuffer();
+ for (int i = 0; i < pathSegment.length(); i++) {
+ char ch = pathSegment.charAt(i);
+
+ //escape
+ if (AbstractTreeDataModel.SEPARATOR == ch || ListRowKey.SEPARATOR_ESCAPE_CHAR == ch) {
+ escapedSubPath.append(ListRowKey.SEPARATOR_ESCAPE_CHAR);
+ }
+
+ escapedSubPath.append(ch);
+ }
+
+ result.append(escapedSubPath.toString());
+
+ hasNext = iterator.hasNext();
+
+ if (hasNext) {
+ result.append(AbstractTreeDataModel.SEPARATOR);
+ }
+ }
+
+ return result.toString();
+ }
+
+ public int getCommonPathLength(TreeRowKey otherRowKey) {
+ if (otherRowKey == null)
+ return 0;
+ Iterator iterator = this.iterator();
+ Iterator otherIterator = otherRowKey.iterator();
+ int length = 0;
+ while (iterator.hasNext() && otherIterator.hasNext()
+ && iterator.next().equals(otherIterator.next()))
+ length++;
+ return length;
+ }
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/component/Row.java (from rev 1385, branches/refactor/ui/dataTable/src/main/java/org/richfaces/component/Row.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/component/Row.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/component/Row.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,39 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import java.util.Iterator;
+
+/**
+ * Marker interface for table columns, rendered as entire row.
+ * @author shura
+ *
+ */
+public interface Row extends Column {
+
+ /**
+ * Get iterator for all columns contained in this row.
+ * @return
+ */
+ public Iterator columns();
+
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/component/TreeDataModel.java (from rev 1385, branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeDataModel.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/component/TreeDataModel.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/component/TreeDataModel.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,223 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.ajax.repeat.DataVisitor;
+import org.ajax4jsf.ajax.repeat.Range;
+import org.richfaces.component.state.TreeRange;
+
+/**
+ * @author Nick Belaevski - nbelaevski at exadel.com created 16.11.2006
+ *
+ */
+public class TreeDataModel extends AbstractTreeDataModel {
+ private TreeRowKey currentRowKey;
+
+ private TreeRowKey oldRowKey;
+
+ private TreeNode rowTreeData;
+
+ public Object getRowKey() {
+ return this.currentRowKey;
+ }
+
+ public void setRowKey(Object rowKey) {
+ if (rowKey != null) {
+ ListRowKey newRowKey = (ListRowKey) rowKey;
+ this.currentRowKey = newRowKey;
+ } else {
+ this.currentRowKey = null;
+ this.oldRowKey = null;
+ this.rowTreeData = null;
+ }
+ }
+
+
+ public void walk(FacesContext context, DataVisitor dataVisitor,
+ Range range, Object rowKey, Object argument, boolean last) throws IOException {
+
+ ListRowKey listRowKey = (ListRowKey) rowKey;
+
+ TreeNode node = locateTreeNode(listRowKey);
+
+ if (node != null) {
+ TreeRange treeRange = (TreeRange) range;
+
+ if (treeRange == null || treeRange.processNode(listRowKey)) {
+
+ if (node.getParent() != null) {
+ processElement(context, dataVisitor, argument, listRowKey, last);
+ }
+
+ if (treeRange == null || treeRange.processChildren(listRowKey)) {
+ if (!node.isLeaf()) {
+ Iterator children = node.getChildren();
+
+ Map.Entry childEntry = children.hasNext() ? (Map.Entry) children.next() : null;
+ TreeNode childNode;
+ Object identifier;
+
+ if (childEntry != null) {
+ childNode = (TreeNode) childEntry.getValue();
+ identifier = childEntry.getKey();
+ } else {
+ childNode = null;
+ identifier = null;
+ }
+
+ do {
+ Map.Entry nextChildEntry = children.hasNext() ? (Map.Entry) children.next() : null;
+ TreeNode nextChildNode;
+ Object nextIdentifier;
+
+ if (nextChildEntry != null) {
+ nextChildNode = (TreeNode) nextChildEntry.getValue();
+ nextIdentifier = nextChildEntry.getKey();
+ } else {
+ nextChildNode = null;
+ nextIdentifier = null;
+ }
+
+ if (childNode != null) {
+
+ boolean isLast = nextChildNode == null;
+
+ ListRowKey newRowKey;
+ if (rowKey != null) {
+ newRowKey = new ListRowKey(listRowKey, identifier);
+ } else {
+ newRowKey = new ListRowKey(identifier);
+ }
+
+ this.walk(context, dataVisitor, range, newRowKey, argument, isLast);
+ }
+
+ identifier = nextIdentifier;
+ childNode = nextChildNode;
+ } while (childNode != null);
+ }
+ }
+ }
+ }
+ }
+
+ protected TreeNode locateTreeNode(TreeRowKey rowKey) {
+ return locateTreeNode(rowKey, false);
+ }
+
+ protected TreeNode locateTreeNode(TreeRowKey rowKey, boolean allowCreate) {
+ boolean useCached = (rowTreeData != null && rowKey != null && rowKey.equals(this.oldRowKey));
+ if (!useCached) {
+ TreeNode rootNode = (TreeNode) getWrappedData();
+
+ if (rootNode != null) {
+ if (rowKey != null) {
+ int commonPathLength = rowKey.getCommonPathLength(oldRowKey);
+ if (oldRowKey == null) {
+ rowTreeData = rootNode;
+ } else {
+ int rootOpsCount = rowKey.depth();
+ int currentUpOpsCount = oldRowKey.depth() - commonPathLength;
+ int currentOpsCount = currentUpOpsCount + rootOpsCount - commonPathLength;
+
+ if (rootOpsCount > currentOpsCount) {
+ for (int i = 0; i < oldRowKey.depth()
+ - commonPathLength; i++) {
+
+ rowTreeData = rowTreeData.getParent();
+ }
+ } else {
+ commonPathLength = 0;
+ rowTreeData = rootNode;
+ oldRowKey = null;
+ }
+ }
+ oldRowKey = rowKey;
+ Iterator iterator = rowKey.getSubPathIterator(commonPathLength);
+ while (iterator.hasNext()) {
+ Object pathSegment = iterator.next();
+ TreeNode childRowTreeData = rowTreeData.getChild(pathSegment);
+
+ if (childRowTreeData == null) {
+ if (!allowCreate) {
+ return null;
+ } else {
+ childRowTreeData = new TreeNodeImpl();
+ rowTreeData.addChild(pathSegment, childRowTreeData);
+ }
+ }
+
+ rowTreeData = childRowTreeData;
+ }
+ } else {
+ return rootNode;
+ }
+ } else {
+ return null;
+ }
+ }
+ return rowTreeData;
+ }
+
+ public boolean isRowAvailable() {
+ TreeNode data = locateTreeNode(this.currentRowKey);
+
+ if (data != null) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public Object getRowData() {
+ TreeNode treeNode = locateTreeNode(this.currentRowKey);
+ if (treeNode != null) {
+ return treeNode.getData();
+ }
+
+ return null;
+ }
+
+ public boolean isLeaf() {
+ TreeNode treeNode = locateTreeNode(this.currentRowKey);
+ if (treeNode != null) {
+ return treeNode.isLeaf();
+ }
+
+ throw new IllegalStateException(
+ "No tree element available or row key not set!");
+ }
+
+ public void walkModel(FacesContext context, DataVisitor visitor, Range range, Object key, Object argument, boolean last) throws IOException {
+ walk(context, visitor, range, key, argument, last);
+ }
+
+ public TreeNode getTreeNode() {
+ return locateTreeNode(this.currentRowKey);
+ }
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/component/TreeListenerEventsProducer.java (from rev 1385, branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeListenerEventsProducer.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/component/TreeListenerEventsProducer.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/component/TreeListenerEventsProducer.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,53 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import javax.faces.el.MethodBinding;
+
+import org.richfaces.component.events.NodeExpandedListener;
+import org.richfaces.component.events.NodeSelectedListener;
+
+/**
+ * @author Nick Belaevski - nbelaevski at exadel.com
+ * created 29.11.2006
+ *
+ * Base tree events interface
+ */
+public interface TreeListenerEventsProducer {
+ public abstract void setChangeExpandListener(MethodBinding binding);
+ public abstract MethodBinding getChangeExpandListener();
+
+ public abstract void setNodeSelectListener(MethodBinding binding);
+ public abstract MethodBinding getNodeSelectListener();
+
+ public abstract void setDropListener(MethodBinding binding);
+ public abstract MethodBinding getDropListener();
+
+ public abstract void setDragListener(MethodBinding binding);
+ public abstract MethodBinding getDragListener();
+
+ public void addNodeSelectListener(NodeSelectedListener listener);
+ public void addChangeExpandListener(NodeExpandedListener listener);
+
+ //TODO - rename this
+ public boolean hasAjaxSubmitSelection();
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/component/TreeNode.java (from rev 1385, branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeNode.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/component/TreeNode.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/component/TreeNode.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,89 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.Map;
+
+
+/**
+ * @author Nick Belaevski - nbelaevski at exadel.com
+ * created 16.11.2006
+ * Interface representing tree ADT nodes
+ */
+public interface TreeNode extends Serializable{
+
+ /**
+ * getter for node attached data
+ * @return node attached data
+ */
+ public Object getData();
+ /**
+ * setter for node attached data
+ * @param data data to set as attached node data
+ */
+ public void setData(Object data);
+
+ /**
+ * Returns whether this node is leaf
+ * @return <code>true</code> if this node is leaf else returns <code>false</code>
+ */
+ public boolean isLeaf();
+
+ /**
+ * getter for children
+ * @return {@link Iterator} of {@link Map.Entry} instances containing {@link TreeNode} as values
+ * and their identifiers as keys
+ */
+ public Iterator getChildren();
+ /**
+ * find child by id
+ * @param id identifier of the child to find
+ * @return designated {@link TreeNode} instance or <code>null</code>
+ */
+ public TreeNode getChild(Object id);
+
+ /**
+ * adds child to children collection
+ * @param identifier child identifier
+ * @param child child
+ */
+ public void addChild(Object identifier, TreeNode child);
+
+ /**
+ * removes child from children collection by child id
+ * @param id id of the child to remove
+ */
+ public void removeChild(Object id);
+
+ /**
+ * getter for parent {@link TreeNode}
+ * @return parent {@link TreeNode} instance or <code>null</code> if this node is root
+ */
+ public TreeNode getParent();
+ /**
+ * setter for parent {@link TreeNode}
+ * @param parent {@link TreeNode} to set as parent
+ */
+ public void setParent(TreeNode parent);
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/component/TreeNodeImpl.java (from rev 1385, branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeNodeImpl.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/component/TreeNodeImpl.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/component/TreeNodeImpl.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,82 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * @author Nick Belaevski - nbelaevski at exadel.com
+ * created 16.11.2006
+ * Default {@link TreeNode} implementation based on {@link LinkedHashMap} to preserve
+ * elements ordering
+ */
+public class TreeNodeImpl implements TreeNode {
+
+ private static final long serialVersionUID = -5498990493803705085L;
+ private Object data;
+ private TreeNode parent;
+
+ private Map childrenMap = new LinkedHashMap();
+
+ public Object getData() {
+ return data;
+ }
+
+ public TreeNode getChild(Object identifier) {
+ return (TreeNode) childrenMap.get(identifier);
+ }
+
+ public void addChild(Object identifier, TreeNode child) {
+ child.setParent(this);
+ childrenMap.put(identifier, child);
+ }
+
+ public void removeChild(Object identifier) {
+ TreeNode treeNode = (TreeNode) childrenMap.remove(identifier);
+ if (treeNode != null) {
+ treeNode.setParent(null);
+ }
+ }
+
+ public void setData(Object data) {
+ this.data = data;
+ }
+
+ public TreeNode getParent() {
+ return parent;
+ }
+
+ public void setParent(TreeNode parent) {
+ this.parent = parent;
+ }
+
+ public Iterator getChildren() {
+ return childrenMap.entrySet().iterator();
+ }
+
+ public boolean isLeaf() {
+ return childrenMap.isEmpty();
+ }
+
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/component/TreeRowKey.java (from rev 1385, branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeRowKey.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/component/TreeRowKey.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/component/TreeRowKey.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,85 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import java.io.Serializable;
+import java.util.Iterator;
+
+/**
+ * @author Nick Belaevski - nbelaevski at exadel.com
+ * created 06.12.2006
+ * Base abstract clas for all tree row keys
+ */
+public abstract class TreeRowKey implements Serializable {
+
+ public static final char SEPARATOR_ESCAPE_CHAR = '_';
+
+ /**
+ * getter for key depth
+ * @return key depth
+ */
+ public abstract int depth();
+
+ /**
+ * getter for subpath iterator
+ * @param fromIndex
+ * @return subpath segments iterator
+ */
+ public abstract Iterator getSubPathIterator(int fromIndex);
+
+ /**
+ * getter for path string representation
+ * @return path string
+ */
+ public abstract String getPath();
+
+ public String toString() {
+ return getPath();
+ }
+
+ /**
+ * tests if specified rowKey is sub-key of this row key
+ * @param rowKey
+ * @return
+ */
+ public boolean isSubKey(TreeRowKey rowKey) {
+ if (rowKey == null) {
+ return false;
+ }
+
+ return (rowKey.getPath() + AbstractTreeDataModel.SEPARATOR).startsWith(getPath());
+ }
+
+ /**
+ * getter for path iterator
+ * @return path segments iterator
+ */
+ public abstract Iterator iterator();
+
+ /**
+ * returns this row key and otherRowKey argument row key common path segments count
+ * @param otherRowKey {@link TreeRowKey} to count common path segments for
+ * @return common path segmments count
+ */
+ public abstract int getCommonPathLength(TreeRowKey otherRowKey);
+
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/component/events/AjaxSelectedEvent.java (from rev 1385, branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/AjaxSelectedEvent.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/component/events/AjaxSelectedEvent.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/component/events/AjaxSelectedEvent.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,41 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component.events;
+
+import javax.faces.component.UIComponent;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class AjaxSelectedEvent extends NodeSelectedEvent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1156974665865521208L;
+
+ public AjaxSelectedEvent(UIComponent component) {
+ super(component);
+ }
+
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/component/events/NodeExpandedEvent.java (from rev 1385, branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/NodeExpandedEvent.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/component/events/NodeExpandedEvent.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/component/events/NodeExpandedEvent.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,58 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component.events;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+/**
+ * @author Nick Belaevski - nbelaevski at exadel.com
+ * created 27.11.2006
+ *
+ */
+public class NodeExpandedEvent extends FacesEvent {
+
+ public NodeExpandedEvent(UIComponent component) {
+ super(component);
+ }
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2620359072575831666L;
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
+ */
+ public boolean isAppropriateListener(FacesListener listener) {
+ return listener instanceof NodeExpandedListener;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
+ */
+ public void processListener(FacesListener listener) {
+ ((NodeExpandedListener) listener).processExpansion(this);
+ }
+
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/component/events/NodeExpandedListener.java (from rev 1385, branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/NodeExpandedListener.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/component/events/NodeExpandedListener.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/component/events/NodeExpandedListener.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,34 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component.events;
+
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesListener;
+
+/**
+ * @author Nick Belaevski - nbelaevski at exadel.com
+ * created 27.11.2006
+ *
+ */
+public interface NodeExpandedListener extends FacesListener {
+ public void processExpansion(NodeExpandedEvent nodeExpandedEvent) throws AbortProcessingException;
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/component/events/NodeSelectedEvent.java (from rev 1385, branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/NodeSelectedEvent.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/component/events/NodeSelectedEvent.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/component/events/NodeSelectedEvent.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,60 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component.events;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+/**
+ * @author Nick Belaevski - nbelaevski at exadel.com
+ * created 27.11.2006
+ *
+ */
+public class NodeSelectedEvent extends FacesEvent {
+
+ public NodeSelectedEvent(UIComponent component) {
+ super(component);
+ }
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1292268859927735863L;
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
+ */
+
+ public boolean isAppropriateListener(FacesListener listener) {
+ return listener instanceof NodeSelectedListener;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
+ */
+
+ public void processListener(FacesListener listener) {
+ ((NodeSelectedListener) listener).processSelection(this);
+ }
+
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/component/events/NodeSelectedListener.java (from rev 1385, branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/NodeSelectedListener.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/component/events/NodeSelectedListener.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/component/events/NodeSelectedListener.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,34 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component.events;
+
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesListener;
+
+/**
+ * @author Nick Belaevski - nbelaevski at exadel.com
+ * created 27.11.2006
+ *
+ */
+public interface NodeSelectedListener extends FacesListener {
+ public void processSelection(NodeSelectedEvent nodeSelectedEvent) throws AbortProcessingException;
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/component/state/TreeRange.java (from rev 1385, branches/refactor/ui/tree/src/main/java/org/richfaces/component/state/TreeRange.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/component/state/TreeRange.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/component/state/TreeRange.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,35 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component.state;
+
+import org.ajax4jsf.ajax.repeat.Range;
+import org.richfaces.component.TreeRowKey;
+
+/**
+ * @author Nick Belaevski - nbelaevski at exadel.com
+ * created 23.11.2006
+ *
+ */
+public interface TreeRange extends Range {
+ public boolean processNode(TreeRowKey rowKey);
+ public boolean processChildren(TreeRowKey rowKey);
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/component/state/TreeStateAdvisor.java (from rev 1385, branches/refactor/ui/tree/src/main/java/org/richfaces/component/state/TreeStateAdvisor.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/component/state/TreeStateAdvisor.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/component/state/TreeStateAdvisor.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,60 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component.state;
+
+import org.richfaces.component.UITree;
+
+
+/**
+ * @author Nick Belaevski - mailto:nbelaevski at exadel.com
+ * created 19.06.2007
+ *
+ * This interface is intended to "advising" changes to tree state. Tree component should queue user-provided
+ * instance of the interface for changes during RENDER_RESPONSE phase. Changes advised by user should be
+ * immediately applied. Advisor methods are provided with {@link UITree} component instance to queue current
+ * tree state.
+ */
+public interface TreeStateAdvisor {
+ /**
+ * Advises new node opened/closed state
+ * @param tree {@link UITree} component state to queue state
+ * @return
+ * <ul>
+ * <li><code>null</code> if changes are not needed</li>
+ * <li>{@link Boolean#TRUE} to advise node to be opened</li>
+ * <li>{@link Boolean#FALSE} to advise node to be closed</li>
+ * </ul>
+ */
+ public Boolean adviseNodeOpened(UITree tree);
+
+ /**
+ * Advises new node selection
+ * @param tree {@link UITree} component state to queue state
+ * @return
+ * <ul>
+ * <li><code>null</code> if changes are not needed</li>
+ * <li>{@link Boolean#TRUE} to advise current node to be selected</li>
+ * <li>{@link Boolean#FALSE} to advise current node to be unselected</li>
+ * </ul>
+ */
+ public Boolean adviseNodeSelected(UITree tree);
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/component/xml/XmlNodeData.java (from rev 1385, branches/refactor/ui/tree/src/main/java/org/richfaces/component/xml/XmlNodeData.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/component/xml/XmlNodeData.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/component/xml/XmlNodeData.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,82 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component.xml;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Nick Belaevski - nbelaevski at exadel.com
+ * created 16.11.2006
+ *
+ */
+public class XmlNodeData implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 8320619478974873168L;
+
+ private String namespace;
+
+ private String name = "";
+
+ private String text;
+
+ private Map attributes = new HashMap();
+
+ public Map getAttributes() {
+ return attributes;
+ }
+
+ public void setAttribute(String key, Object value) {
+ this.attributes.put(key, value);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public String getText() {
+ return text != null ? text : "";
+ }
+
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public String toString() {
+ return getName() + "{" + attributes.toString() + " <" + getText().trim() + ">" + "}";
+ }
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/component/xml/XmlTreeDataBuilder.java (from rev 1385, branches/refactor/ui/tree/src/main/java/org/richfaces/component/xml/XmlTreeDataBuilder.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/component/xml/XmlTreeDataBuilder.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/component/xml/XmlTreeDataBuilder.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,164 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component.xml;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.digester.Digester;
+import org.apache.commons.digester.RulesBase;
+import org.richfaces.component.TreeNode;
+import org.richfaces.component.TreeNodeImpl;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * @author Nick Belaevski - nbelaevski at exadel.com
+ * created 16.11.2006
+ *
+ */
+public class XmlTreeDataBuilder {
+
+ private final static class Rule extends org.apache.commons.digester.Rule {
+ private int level = -1;
+ private List idsList = new ArrayList();
+ private List treeNodesList = new ArrayList();
+ private List exclusionSets = new ArrayList();
+ private TreeNode treeNode = new TreeNodeImpl(); //add empty node to serve as root
+
+ public void begin(String namespace, String name, Attributes attributes)
+ throws Exception {
+ super.begin(namespace, name, attributes);
+
+ level++;
+
+ XmlNodeData xmlNodeData = new XmlNodeData();
+ xmlNodeData.setName(name);
+ xmlNodeData.setNamespace(namespace);
+
+ String id = null;
+
+ if (attributes != null) {
+ int length = attributes.getLength();
+ for (int i = 0; i < length; i++) {
+ xmlNodeData.setAttribute(attributes.getQName(i),
+ attributes.getValue(i));
+
+ }
+
+ id = attributes.getValue("id");
+ }
+
+ if (exclusionSets.size() == level) {
+ exclusionSets.add(null);
+ }
+
+ if (id == null || id.length() == 0) {
+ int currentId = 0;
+
+ if (idsList.size() <= level) {
+ for (int i = idsList.size(); i <= level; i++) {
+ idsList.add(null);
+ }
+ } else {
+ Integer integer = (Integer) idsList.get(level);
+ currentId = integer.intValue() + 1;
+ }
+
+ Set exclusions = (Set) exclusionSets.get(level);
+
+ while (exclusions != null && exclusions.contains(Integer.toString(currentId))) {
+ currentId++;
+ }
+
+ idsList.set(level, new Integer(currentId));
+
+ id = Integer.toString(currentId);
+ } else {
+ Set exclusions = (Set) exclusionSets.get(level);
+ if (exclusions == null) {
+ exclusions = new HashSet();
+
+ exclusionSets.set(level, exclusions);
+ }
+
+ exclusions.add(id);
+ }
+
+ TreeNode node = new TreeNodeImpl();
+ node.setData(xmlNodeData);
+
+ this.treeNode.addChild(id, node);
+ this.treeNodesList.add(this.treeNode);
+ this.treeNode = node;
+ }
+
+ public void body(String namespace, String name, String text)
+ throws Exception {
+ super.body(namespace, name, text);
+
+ if (text != null) {
+ ((XmlNodeData) this.treeNode.getData()).setText(text.trim());
+ }
+ }
+
+ public void end(String namespace, String name) throws Exception {
+ super.end(namespace, name);
+
+ level--;
+
+ if (idsList.size() - 1 > level + 1) {
+ //idsList grew larger than we really need
+ idsList.remove(idsList.size() - 1);
+ }
+
+ if (exclusionSets.size() - 1 > level + 1) {
+ //the same condition as above
+ exclusionSets.remove(exclusionSets.size() - 1);
+ }
+
+ this.treeNode = (TreeNode) this.treeNodesList.remove(this.treeNodesList.size() - 1);
+ }
+ }
+
+ public static TreeNode build(InputSource inputSource) throws SAXException, IOException {
+ Digester digester = new Digester();
+ Rule rule = new Rule();
+ final List rulesList = new ArrayList(1);
+ rulesList.add(rule);
+
+ RulesBase rulesBase = new RulesBase() {
+ protected List lookup(String namespace, String name) {
+ return rulesList;
+ }
+ };
+ digester.setRules(rulesBase);
+ digester.setNamespaceAware(true);
+ digester.parse(inputSource);
+
+ return rule.treeNode;
+ }
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/event/DataFilterSliderEvent.java (from rev 1385, branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/event/DataFilterSliderEvent.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/event/DataFilterSliderEvent.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/event/DataFilterSliderEvent.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,71 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.event;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.FacesListener;
+import javax.faces.event.FacesEvent;
+
+/**
+ * @author Wesley Hales
+ */
+public class DataFilterSliderEvent extends FacesEvent {
+
+ private Integer oldSliderVal;
+ private Integer newSliderVal;
+
+ /**
+ * Creates a new SliderEvent.
+ *
+ * @param component the source of the event
+ * @param thisOldSliderVal the previously showing item identifier
+ * @param thisNewSliderVal the currently showing item identifier
+ */
+ public DataFilterSliderEvent(UIComponent component, Integer thisOldSliderVal, Integer thisNewSliderVal) {
+ super(component);
+ setPhaseId(PhaseId.INVOKE_APPLICATION);
+ oldSliderVal = thisOldSliderVal;
+ newSliderVal = thisNewSliderVal;
+ }
+
+ public Integer getOldSliderVal() {
+ return oldSliderVal;
+ }
+
+ public Integer getNewSliderVal() {
+ return newSliderVal;
+ }
+
+ public boolean isAppropriateListener(FacesListener listener){
+ return (listener instanceof DataFilterSliderListener);
+ }
+
+ /**
+ * Delivers this event to the SliderListener.
+ *
+ * @param listener the slider listener
+ */
+ public void processListener(FacesListener listener){
+ ((DataFilterSliderListener) listener).processSlider(this);
+ }
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/event/DataFilterSliderListener.java (from rev 1385, branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/event/DataFilterSliderListener.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/event/DataFilterSliderListener.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/event/DataFilterSliderListener.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,33 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.event;
+
+import javax.faces.event.FacesListener;
+
+/**
+ * @author Wesley Hales
+ */
+public interface DataFilterSliderListener extends FacesListener {
+
+ public void processSlider(org.richfaces.event.DataFilterSliderEvent event);
+
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/event/DataFilterSliderSource.java (from rev 1385, branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/event/DataFilterSliderSource.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/event/DataFilterSliderSource.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/event/DataFilterSliderSource.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,50 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.event;
+
+/**
+ * @author Wesley Hales
+ */
+public interface DataFilterSliderSource {
+
+ /**
+ * Adds a DataFilterSliderListener to this DataFilterSliderSource.
+ *
+ * @param listener the Slider listener to be added
+ */
+ public void addSliderListener(org.richfaces.event.DataFilterSliderListener listener);
+
+ /**
+ * Removes a DataFilterSliderListener from this DataFilterSliderSource.
+ *
+ * @param listener the Slider listener to be removed
+ */
+ public void removeSliderListener(DataFilterSliderListener listener);
+
+ /**
+ * Returns all SliderListeners for this DataFilterSliderSource.
+ *
+ * @return the Slider listener array
+ */
+ public DataFilterSliderListener[] getSliderListeners();
+
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/event/DataScrollerEvent.java (from rev 1385, branches/refactor/ui/datascroller/src/main/java/org/richfaces/event/DataScrollerEvent.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/event/DataScrollerEvent.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/event/DataScrollerEvent.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,80 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.event;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.FacesListener;
+
+/**
+ * @author Wesley Hales
+ */
+public class DataScrollerEvent extends ActionEvent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2657353903701932561L;
+ private String oldScrolVal;
+ private String newScrolVal;
+
+ /**
+ * Creates a new ScrollerEvent.
+ *
+ * @param component the source of the event
+ * @param thisOldScrolVal the previously showing item identifier
+ * @param thisNewScrolVal the currently showing item identifier
+ */
+ public DataScrollerEvent(UIComponent component, String thisOldScrolVal, String thisNewScrolVal) {
+ super(component);
+ oldScrolVal = thisOldScrolVal;
+ newScrolVal = thisNewScrolVal;
+ }
+
+ public String getOldScrolVal() {
+ return oldScrolVal;
+ }
+
+ public String getNewScrolVal() {
+ return newScrolVal;
+ }
+
+ public boolean isAppropriateListener(FacesListener listener){
+ return super.isAppropriateListener(listener) || (listener instanceof DataScrollerListener);
+ }
+
+ /**
+ * Delivers this event to the SliderListener.
+ *
+ * @param listener the slider listener
+ */
+ public void processListener(FacesListener listener){
+ if (listener instanceof DataScrollerListener) {
+ DataScrollerListener dataScrollerListener = (DataScrollerListener) listener;
+ dataScrollerListener.processScroller(this);
+ }
+
+ if (super.isAppropriateListener(listener)) {
+ super.processListener(listener);
+ }
+ }
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/event/DataScrollerListener.java (from rev 1385, branches/refactor/ui/datascroller/src/main/java/org/richfaces/event/DataScrollerListener.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/event/DataScrollerListener.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/event/DataScrollerListener.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,31 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.event;
+
+import javax.faces.event.FacesListener;
+
+
+public interface DataScrollerListener extends FacesListener {
+
+ public void processScroller(org.richfaces.event.DataScrollerEvent event);
+
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/event/DataScrollerSource.java (from rev 1385, branches/refactor/ui/datascroller/src/main/java/org/richfaces/event/DataScrollerSource.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/event/DataScrollerSource.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/event/DataScrollerSource.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,47 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.event;
+
+public interface DataScrollerSource {
+
+ /**
+ * Adds a DataScrollerListener to this DataScrollerSource.
+ *
+ * @param listener the Scroler listener to be added
+ */
+ public void addScrollerListener(org.richfaces.event.DataScrollerListener listener);
+
+ /**
+ * Removes a DataFilterSliderListener from this DataScrollerSourceSource.
+ *
+ * @param listener the Scroler listener to be removed
+ */
+ public void removeScrollerListener(DataScrollerListener listener);
+
+ /**
+ * Returns all ScrollerListeners for this DataScrollerSource.
+ *
+ * @return the Scroler listener array
+ */
+ public DataScrollerListener[] getScrollerListeners();
+
+}
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/event/ISimpleToggleListener.java (from rev 1385, branches/refactor/ui/simpleTogglePanel/src/main/java/org/richfaces/event/ISimpleToggleListener.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/event/ISimpleToggleListener.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/event/ISimpleToggleListener.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,38 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * Created on 11.07.2006
+ */
+package org.richfaces.event;
+
+import javax.faces.event.FacesListener;
+
+/**
+ * @author igels
+ */
+
+//TODO by nick - denis - add addToggleListener method to component
+public interface ISimpleToggleListener extends FacesListener {
+
+ public void processToggle(SimpleToggleEvent event);
+
+}
\ No newline at end of file
Copied: branches/refactor/framework/api/src/main/java/org/richfaces/event/SimpleToggleEvent.java (from rev 1385, branches/refactor/ui/simpleTogglePanel/src/main/java/org/richfaces/event/SimpleToggleEvent.java)
===================================================================
--- branches/refactor/framework/api/src/main/java/org/richfaces/event/SimpleToggleEvent.java (rev 0)
+++ branches/refactor/framework/api/src/main/java/org/richfaces/event/SimpleToggleEvent.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,76 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * Created on 11.07.2006
+ */
+package org.richfaces.event;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.FacesListener;
+
+/**
+ * @author igels
+ */
+public class SimpleToggleEvent extends ActionEvent {
+
+ private static final long serialVersionUID = 5582624805941635421L;
+ private boolean _opened;
+
+ /**
+ * @param source
+ * @param opened
+ */
+ public SimpleToggleEvent(UIComponent source, boolean opened) {
+ super(source);
+ this._opened = opened;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
+ */
+ public boolean isAppropriateListener(FacesListener listener) {
+ return listener instanceof ISimpleToggleListener;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
+ */
+ public void processListener(FacesListener listener) {
+ ((ISimpleToggleListener) listener).processToggle(this);
+ }
+
+ /**
+ * @return Returns the _state.
+ */
+ public boolean isIsOpen() {
+ return _opened;
+ }
+
+ /**
+ *
+ * @param opened The state to set
+ */
+ public void setIsOpen(boolean opened) {
+ this._opened = opened;
+ }
+}
\ No newline at end of file
Copied: branches/refactor/sandbox/api/src/main/java/org/richfaces/component/Selectable.java (from rev 1385, branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Selectable.java)
===================================================================
--- branches/refactor/sandbox/api/src/main/java/org/richfaces/component/Selectable.java (rev 0)
+++ branches/refactor/sandbox/api/src/main/java/org/richfaces/component/Selectable.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,15 @@
+/**
+ *
+ */
+package org.richfaces.component;
+
+import org.richfaces.model.selection.Selection;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public interface Selectable {
+ public Selection getSelection();
+ public void setSelection (Selection selection);
+}
Copied: branches/refactor/sandbox/api/src/main/java/org/richfaces/component/Sortable.java (from rev 1385, branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Sortable.java)
===================================================================
--- branches/refactor/sandbox/api/src/main/java/org/richfaces/component/Sortable.java (rev 0)
+++ branches/refactor/sandbox/api/src/main/java/org/richfaces/component/Sortable.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,23 @@
+/*
+ * 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);
+}
Copied: branches/refactor/sandbox/api/src/main/java/org/richfaces/event/ISimpleToggle2Listener.java (from rev 1385, branches/refactor/sandbox/ui/simpleTogglePanel2/src/main/java/org/richfaces/event/ISimpleToggle2Listener.java)
===================================================================
--- branches/refactor/sandbox/api/src/main/java/org/richfaces/event/ISimpleToggle2Listener.java (rev 0)
+++ branches/refactor/sandbox/api/src/main/java/org/richfaces/event/ISimpleToggle2Listener.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,38 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * Created on 11.07.2006
+ */
+package org.richfaces.event;
+
+import javax.faces.event.FacesListener;
+
+/**
+ * @author igels
+ */
+
+//TODO by nick - denis - add addToggleListener method to component
+public interface ISimpleToggle2Listener extends FacesListener {
+
+ public void processToggle(SimpleToggle2Event event);
+
+}
\ No newline at end of file
Copied: branches/refactor/sandbox/api/src/main/java/org/richfaces/event/SimpleToggle2Event.java (from rev 1385, branches/refactor/sandbox/ui/simpleTogglePanel2/src/main/java/org/richfaces/event/SimpleToggle2Event.java)
===================================================================
--- branches/refactor/sandbox/api/src/main/java/org/richfaces/event/SimpleToggle2Event.java (rev 0)
+++ branches/refactor/sandbox/api/src/main/java/org/richfaces/event/SimpleToggle2Event.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,76 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * Created on 11.07.2006
+ */
+package org.richfaces.event;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.FacesListener;
+
+/**
+ * @author igels
+ */
+public class SimpleToggle2Event extends ActionEvent {
+
+ private static final long serialVersionUID = 5582624805941635421L;
+ private boolean _opened;
+
+ /**
+ * @param source
+ * @param opened
+ */
+ public SimpleToggle2Event(UIComponent source, boolean opened) {
+ super(source);
+ this._opened = opened;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
+ */
+ public boolean isAppropriateListener(FacesListener listener) {
+ return listener instanceof ISimpleToggle2Listener;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
+ */
+ public void processListener(FacesListener listener) {
+ ((ISimpleToggle2Listener) listener).processToggle(this);
+ }
+
+ /**
+ * @return Returns the _state.
+ */
+ public boolean isIsOpen() {
+ return _opened;
+ }
+
+ /**
+ *
+ * @param opened The state to set
+ */
+ public void setIsOpen(boolean opened) {
+ this._opened = opened;
+ }
+}
\ No newline at end of file
Copied: branches/refactor/sandbox/api/src/main/java/org/richfaces/event/scroll/ScrollEvent.java (from rev 1385, branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/scroll/ScrollEvent.java)
===================================================================
--- branches/refactor/sandbox/api/src/main/java/org/richfaces/event/scroll/ScrollEvent.java (rev 0)
+++ branches/refactor/sandbox/api/src/main/java/org/richfaces/event/scroll/ScrollEvent.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,51 @@
+/**
+ *
+ */
+package org.richfaces.event.scroll;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+public class ScrollEvent extends FacesEvent {
+
+ private static final long serialVersionUID = 3786221668771853810L;
+
+ private int rows;
+
+ private int first;
+
+ public ScrollEvent(UIComponent component, int rows, int first){
+ super(component);
+ this.rows = rows;
+ this.first = first;
+ }
+
+ public boolean isAppropriateListener(FacesListener listener) {
+ return false;
+ }
+
+ public void processListener(FacesListener listener) {
+ }
+
+ public int getFirst() {
+ return first;
+ }
+
+ public void setFirst(int first) {
+ this.first = first;
+ }
+
+ public int getRows() {
+ return rows;
+ }
+
+ public void setRows(int rows) {
+ this.rows = rows;
+ }
+
+}
Copied: branches/refactor/sandbox/api/src/main/java/org/richfaces/event/sort/SortEvent.java (from rev 1385, branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortEvent.java)
===================================================================
--- branches/refactor/sandbox/api/src/main/java/org/richfaces/event/sort/SortEvent.java (rev 0)
+++ branches/refactor/sandbox/api/src/main/java/org/richfaces/event/sort/SortEvent.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,95 @@
+/*
+ * 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;
+ }
+}
Copied: branches/refactor/sandbox/api/src/main/java/org/richfaces/event/sort/SortListener.java (from rev 1385, branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortListener.java)
===================================================================
--- branches/refactor/sandbox/api/src/main/java/org/richfaces/event/sort/SortListener.java (rev 0)
+++ branches/refactor/sandbox/api/src/main/java/org/richfaces/event/sort/SortListener.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,21 @@
+/*
+ * 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);
+}
Copied: branches/refactor/sandbox/api/src/main/java/org/richfaces/event/sort/SortSource.java (from rev 1385, branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortSource.java)
===================================================================
--- branches/refactor/sandbox/api/src/main/java/org/richfaces/event/sort/SortSource.java (rev 0)
+++ branches/refactor/sandbox/api/src/main/java/org/richfaces/event/sort/SortSource.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,21 @@
+/*
+ * 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();
+}
Copied: branches/refactor/sandbox/api/src/main/java/org/richfaces/model/DataModelCache.java (from rev 1385, branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/DataModelCache.java)
===================================================================
--- branches/refactor/sandbox/api/src/main/java/org/richfaces/model/DataModelCache.java (rev 0)
+++ branches/refactor/sandbox/api/src/main/java/org/richfaces/model/DataModelCache.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,186 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+import javax.faces.model.DataModelListener;
+
+import org.ajax4jsf.ajax.repeat.DataVisitor;
+import org.ajax4jsf.ajax.repeat.Range;
+import org.ajax4jsf.ajax.repeat.SerializableDataModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Implementation stores last loaded data, so no additional requests to db will be performed
+ * Acts as a proxy between the component and original data model
+ * @author Maksim Kaszynski
+ *
+ */
+public class DataModelCache extends GridDataModel {
+
+ private static Log log = LogFactory.getLog(DataModelCache.class);
+
+ private static class DataRange {
+ private int startRow;
+ private int endRow;
+ private SortOrder sortOrder;
+ private List loadedData;
+
+ public DataRange(int startRow, int endRow, SortOrder sortOrder,
+ List loadedData) {
+ super();
+ this.startRow = startRow;
+ this.endRow = endRow;
+ this.sortOrder = sortOrder;
+ this.loadedData = loadedData;
+ }
+
+ public boolean match(int s, int e, SortOrder sortOrder) {
+ return s == startRow
+ && e == endRow
+ && sortOrdersMatch(sortOrder, this.sortOrder);
+ }
+
+ private boolean sortOrdersMatch(SortOrder sortOrder1, SortOrder sortOrder2) {
+ boolean result = sortOrder1 == sortOrder2;
+
+ if (sortOrder1 != null && sortOrder2 != null) {
+ result = sortOrder1.equals(sortOrder2);
+ }
+
+ return result;
+ }
+
+ }
+
+ private Map secondaryMapping = new HashMap();
+
+ private DataRange dataRange;
+
+ private GridDataModel gridDataModel;
+
+ private int rowCount = Integer.MIN_VALUE;
+
+ public DataModelCache(GridDataModel gridDataModel) {
+ super();
+ this.gridDataModel = gridDataModel;
+
+ if (log.isTraceEnabled()) {
+ log.trace("initializing with " + gridDataModel);
+ }
+ }
+
+ public void addDataModelListener(DataModelListener listener) {
+ gridDataModel.addDataModelListener(listener);
+ }
+
+ public DataModelListener[] getDataModelListeners() {
+ return gridDataModel.getDataModelListeners();
+ }
+
+ public Object getObjectById(Object id) {
+
+ if (log.isDebugEnabled()) {
+ log.debug("Trying to get object by id" + id);
+ }
+ //First try to find data in inner cache
+ //If not found - get it from original model
+ Object cached = secondaryMapping.get(id);
+
+ if (cached == null) {
+
+ if (log.isDebugEnabled()) {
+ log.debug("Cache miss " + id + " falling back to original model");
+ }
+
+ cached = gridDataModel.getObjectById(id);
+ secondaryMapping.put(id, cached);
+
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("At last found element " + cached);
+ }
+
+ return cached;
+ }
+
+ public int getRowCount() {
+ if (rowCount == Integer.MIN_VALUE) {
+ rowCount = gridDataModel.getRowCount();
+ }
+ return rowCount;
+ }
+
+ public Object getRowData() {
+ Object secondaryMapped = secondaryMapping.get(getRowKey());
+
+ if (secondaryMapped == null) {
+ secondaryMapped = super.getRowData();
+ }
+ return secondaryMapped;
+ }
+
+ public int getRowIndex() {
+ return gridDataModel.getRowIndex();
+ }
+
+ public Object getRowKey() {
+ return gridDataModel.getRowKey();
+ }
+
+ public SerializableDataModel getSerializableModel(Range range) {
+ return gridDataModel.getSerializableModel(range);
+ }
+
+ public Object getWrappedData() {
+ return gridDataModel.getWrappedData();
+ }
+
+ public boolean isRowAvailable() {
+ return secondaryMapping.containsKey(getRowKey()) || super.isRowAvailable();
+ }
+
+ public List loadData(int startRow, int endRow, SortOrder sortOrder) {
+ if (dataRange == null || !dataRange.match(startRow, endRow, sortOrder)) {
+ List data = gridDataModel.loadData(startRow, endRow, sortOrder);
+ dataRange = new DataRange(startRow, endRow, sortOrder, data);
+ }
+ return dataRange.loadedData;
+ }
+
+ public void removeDataModelListener(DataModelListener listener) {
+ gridDataModel.removeDataModelListener(listener);
+ }
+
+ public void setRowIndex(int arg0) {
+ gridDataModel.setRowIndex(arg0);
+ }
+
+ public void setRowKey(Object key) {
+ gridDataModel.setRowKey(key);
+ super.setRowKey(key);
+ }
+
+ public void setWrappedData(Object arg0) {
+ gridDataModel.setWrappedData(arg0);
+ }
+
+ public Object getId(Object o) {
+ return gridDataModel.getId(o);
+ }
+
+ public void walk(FacesContext context, DataVisitor visitor, Range range,
+ Object argument) throws IOException {
+ // TODO Auto-generated method stub
+ super.walk(context, visitor, range, argument);
+ }
+
+}
Copied: branches/refactor/sandbox/api/src/main/java/org/richfaces/model/GridDataModel.java (from rev 1385, branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/GridDataModel.java)
===================================================================
--- branches/refactor/sandbox/api/src/main/java/org/richfaces/model/GridDataModel.java (rev 0)
+++ branches/refactor/sandbox/api/src/main/java/org/richfaces/model/GridDataModel.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,208 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.ajax.repeat.DataVisitor;
+import org.ajax4jsf.ajax.repeat.ExtendedDataModel;
+import org.ajax4jsf.ajax.repeat.Range;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Base class for data models
+ * Subclasses must implement {@link #loadData(int, int, SortOrder)}
+ * For certain features (like selection and sorting) to work correctly together,
+ * {@link #getId(Object)} and {@link #getObjectById(Object)}
+ * methods need to be overriden
+ *
+ * @author Maksim Kaszynski
+ *
+ */
+public abstract class GridDataModel extends ExtendedDataModel {
+
+ /**
+ * Simple implementation - index-based row key
+ * @author Maksim Kaszynski
+ *
+ */
+ private static class SimpleRowKey implements Serializable{
+
+ private static final long serialVersionUID = 1L;
+ private int i;
+
+ public SimpleRowKey(int i) {
+ super();
+ this.i = i;
+ }
+
+ public int intValue() {
+ return i;
+ }
+
+ public String toString() {
+ return String.valueOf(i);
+ }
+ }
+
+
+ private static final Log log = LogFactory.getLog(GridDataModel.class);
+
+ private Object rowKey;
+
+ private Map mapping;
+
+ private SortOrder lastSortOrder;
+
+ /**
+ * Load range of data items from the source.
+ * Starting from startRow, and up to but excluding endRow
+ * @param startRow
+ * @param endRow
+ * @param sortOrder
+ * @return list of ordered data
+ */
+ public abstract List loadData(int startRow, int endRow, SortOrder sortOrder);
+
+
+ /**
+ * Load data range, and iterate over it
+ */
+ public void walk(FacesContext context, DataVisitor visitor, Range range,
+ Object argument) throws IOException {
+
+ if (log.isTraceEnabled()) {
+ log.trace("Starting walk");
+ }
+
+ ScrollableGridRange sequenceRange = (ScrollableGridRange) range;
+
+ int startIndex = sequenceRange.getFirst();
+ int last = sequenceRange.getLast();
+
+ lastSortOrder = sequenceRange.getSortOrder();
+
+ List objects = loadData(startIndex, last, lastSortOrder);
+
+ mapping = new HashMap();
+
+ for (int i = 0; i < objects.size(); i++,startIndex++) {
+ Object data = objects.get(i);
+ Object key = getId(data);
+
+ if (key == null) {
+ key = new SimpleRowKey(startIndex);
+ }
+
+ mapping.put(key, data);
+
+ visitor.process(context, key, argument);
+
+ }
+
+ if (log.isTraceEnabled()) {
+ log.trace("Ending walk");
+ }
+
+ }
+
+
+ /**
+ * This method is the reverse of {@link #getId(Object)}
+ * If you override this method, you need to override {@link #getId(Object)} as well
+ * @param id
+ * @return
+ */
+ public Object getObjectById(Object id) {
+
+ if (id instanceof SimpleRowKey) {
+ int i = ((SimpleRowKey) id).intValue();
+
+ List l = loadData(i, i + 1, lastSortOrder);
+
+ return l.get(0);
+
+ }
+
+ return null;
+ }
+
+ /**
+ * To get rid of Entity interface, method is introduced
+ * Implementations may override it to provide domain-specific searches
+ * Id should be serializable
+ * Default implementation returns <code>null</code> anyway
+ * If you override this method, you need to override {@link #getObjectById(Object)} as well
+ * @param o
+ * @return
+ */
+ public Object getId(Object o) {
+ return null;
+ }
+
+
+ public Object getRowData() {
+
+ if (mapping != null && mapping.containsKey(rowKey)) {
+ return mapping.get(rowKey);
+ } else {
+ return loadAndMap(rowKey);
+ }
+
+ }
+
+ /**
+ * Row indexes navigation is no longer supported
+ */
+ public int getRowIndex() {
+ throw new UnsupportedOperationException("getRowIndex");
+ }
+
+ /**
+ * Quite simple implementation - data will be cached, so the call will be cheap
+ */
+ public boolean isRowAvailable() {
+ return getRowData() != null;
+ }
+
+ /**
+ * Row indexes navigation is no longer supported
+ */
+ public void setRowIndex(int arg0) {
+ throw new UnsupportedOperationException("setRowIndex");
+ }
+
+ public Object getRowKey() {
+ return rowKey;
+ }
+
+ public void setRowKey(Object key) {
+ rowKey = key;
+ }
+
+ private Object loadAndMap(Object id) {
+
+ if (log.isTraceEnabled()) {
+ log.trace("loadAndMap " + id);
+ }
+
+ Object o = getObjectById(id);
+ if (o != null) {
+ if (mapping == null) {
+ mapping = new HashMap();
+ }
+ mapping.put(id, o);
+ }
+ return o;
+ }
+
+
+}
Copied: branches/refactor/sandbox/api/src/main/java/org/richfaces/model/ScrollableGridRange.java (from rev 1385, branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/ScrollableGridRange.java)
===================================================================
--- branches/refactor/sandbox/api/src/main/java/org/richfaces/model/ScrollableGridRange.java (rev 0)
+++ branches/refactor/sandbox/api/src/main/java/org/richfaces/model/ScrollableGridRange.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,93 @@
+/*
+ * 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/model/ScrollableGridRange.java,v $
+ * $Revision: 1.7 $
+ */
+
+package org.richfaces.model;
+
+import java.io.Serializable;
+
+import org.ajax4jsf.ajax.repeat.Range;
+
+
+
+/**
+ * @author Maksim Kaszynski
+ * @modified by Anton Belevich
+ */
+public class ScrollableGridRange implements Range, Serializable{
+
+ private static final long serialVersionUID = -6675002421400464892L;
+
+ private int first = 0;
+ private int last = 0;
+ private SortOrder sortOrder;
+
+ public ScrollableGridRange(int first, int last, SortOrder sortOrder) {
+ super();
+ this.first = first;
+ this.last = last;
+ this.sortOrder = sortOrder;
+ }
+
+ /**
+ * @return the bufferSize
+ */
+ public int getLast() {
+ return last;
+ }
+ /**
+ * @param bufferSize the bufferSize to set
+ */
+ public void setLast(int lastRow) {
+ this.last = lastRow;
+ }
+ /**
+ * @return the first
+ */
+ public int getFirst() {
+ return first;
+ }
+ /**
+ * @param first the first to set
+ */
+ public void setFirst(int first) {
+ this.first = first;
+ }
+
+ public SortOrder getSortOrder() {
+ return sortOrder;
+ }
+
+ public void setSortOrder(SortOrder sortOrder) {
+ this.sortOrder = sortOrder;
+ }
+
+ public boolean equals(Object obj) {
+
+ if(!(obj instanceof ScrollableGridRange)){
+ return super.equals(obj);
+ }
+
+ ScrollableGridRange ref = (ScrollableGridRange)obj;
+
+ boolean ret = (this.first == ref.first)&&(this.last == ref.last );
+
+ if(this.sortOrder != null){
+ ret = ret && this.sortOrder.equals(ref.sortOrder);
+ } else {
+ ret = (ret && (ref.sortOrder == null));
+ }
+
+ return ret;
+ }
+
+ public int hashCode() {
+ return super.hashCode();
+ }
+}
Copied: branches/refactor/sandbox/api/src/main/java/org/richfaces/model/SortOrder.java (from rev 1385, branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/SortOrder.java)
===================================================================
--- branches/refactor/sandbox/api/src/main/java/org/richfaces/model/SortOrder.java (rev 0)
+++ branches/refactor/sandbox/api/src/main/java/org/richfaces/model/SortOrder.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,74 @@
+package org.richfaces.model;
+
+import java.io.Serializable;
+/**
+ *
+ * @author Maksim Kaszynski
+ *
+ *
+ */
+public class SortOrder implements Serializable {
+
+ private static final long serialVersionUID = 2423450561570551363L;
+
+ private boolean ascending;
+
+ private int sortColumn = -1;
+
+
+ public SortOrder( int sortColumn, boolean ascending) {
+ super();
+ this.sortColumn = sortColumn;
+ this.ascending = ascending;
+ }
+
+ public SortOrder() {
+ super();
+ }
+
+ public boolean isAscending() {
+ return ascending;
+ }
+
+ public void setAscending(boolean ascending) {
+ this.ascending = ascending;
+ }
+
+ public int getSortColumn() {
+ return sortColumn;
+ }
+
+ public void setSortColumn(int sortColumn) {
+ this.sortColumn = sortColumn;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return "SortOrder: {field:" + sortColumn + ", ascending: " + ascending
+ + "}";
+ }
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+
+ if (obj instanceof SortOrder) {
+ SortOrder sortOrder = (SortOrder) obj;
+ return sortColumn == sortOrder.sortColumn
+ && ascending == sortOrder.ascending;
+
+ }
+ return super.equals(obj);
+ }
+
+ public int hashCode() {
+ int c = (new Integer(sortColumn)).hashCode();
+ if (ascending) {
+ c = -c;
+ }
+ return c;
+ }
+}
\ No newline at end of file
Copied: branches/refactor/sandbox/api/src/main/java/org/richfaces/model/selection/ClientSelection.java (from rev 1385, branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/ClientSelection.java)
===================================================================
--- branches/refactor/sandbox/api/src/main/java/org/richfaces/model/selection/ClientSelection.java (rev 0)
+++ branches/refactor/sandbox/api/src/main/java/org/richfaces/model/selection/ClientSelection.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,129 @@
+/**
+ *
+ */
+package org.richfaces.model.selection;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class ClientSelection implements Serializable{
+
+ private static final long serialVersionUID = 5855157282287053681L;
+
+ public static final String FLAG_RESET = "x";
+
+ public static final String FLAG_ALL = "a";
+
+ private String selectionFlag;
+
+ private List ranges = new ArrayList();
+
+ public ClientSelection() {
+ }
+
+
+ public void addRange(SelectionRange range) {
+ ranges.add(range);
+ }
+
+ public boolean isSelected(int i) {
+ boolean result = false;
+ Iterator iterator = ranges.iterator();
+ while (iterator.hasNext() && !result) {
+ result |= ((SelectionRange) iterator.next()).within(i);
+ }
+ return result;
+ }
+
+ public List getRanges() {
+ return ranges;
+ }
+
+ 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;
+ }
+
+
+ }
+
+ private boolean reset = false;
+ public boolean isReset() {
+ return reset;
+ }
+
+ private boolean selectAll = false;
+ public boolean isSelectAll() {
+ return selectAll;
+ }
+
+
+ public String getSelectionFlag() {
+ return selectionFlag;
+ }
+
+
+ public void setSelectionFlag(String selectionFlag) {
+ this.selectionFlag = selectionFlag;
+
+ reset = false;
+ selectAll = false;
+
+ if (FLAG_ALL.equals(selectionFlag)) {
+ selectAll = true;
+ } else if (FLAG_RESET.equals(selectionFlag)) {
+ reset = true;
+ }
+ }
+}
Copied: branches/refactor/sandbox/api/src/main/java/org/richfaces/model/selection/Selection.java (from rev 1385, branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/Selection.java)
===================================================================
--- branches/refactor/sandbox/api/src/main/java/org/richfaces/model/selection/Selection.java (rev 0)
+++ branches/refactor/sandbox/api/src/main/java/org/richfaces/model/selection/Selection.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,20 @@
+/**
+ *
+ */
+package org.richfaces.model.selection;
+
+import java.io.Serializable;
+import java.util.Iterator;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public interface Selection extends Serializable {
+
+ public Iterator getKeys();
+
+ public int size();
+
+ public boolean isSelected(Object rowKey);
+}
Copied: branches/refactor/sandbox/api/src/main/java/org/richfaces/model/selection/SelectionRange.java (from rev 1385, branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/SelectionRange.java)
===================================================================
--- branches/refactor/sandbox/api/src/main/java/org/richfaces/model/selection/SelectionRange.java (rev 0)
+++ branches/refactor/sandbox/api/src/main/java/org/richfaces/model/selection/SelectionRange.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,64 @@
+/**
+ *
+ */
+package org.richfaces.model.selection;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class SelectionRange {
+ private int startIndex = -1;;
+ private int endIndex = -1;
+
+ public SelectionRange(int startIndex, int endIndex) {
+ super();
+ this.startIndex = startIndex;
+ this.endIndex = endIndex;
+ }
+
+ public int getStartIndex() {
+ return startIndex;
+ }
+
+ public void setStartIndex(int startIndex) {
+ this.startIndex = startIndex;
+ }
+
+ public int getEndIndex() {
+ return endIndex;
+ }
+
+ public void setEndIndex(int endIndex) {
+ this.endIndex = endIndex;
+ }
+
+ 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;
+ }
+
+
+}
Copied: branches/refactor/sandbox/api/src/main/java/org/richfaces/model/selection/SimpleSelection.java (from rev 1385, branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/SimpleSelection.java)
===================================================================
--- branches/refactor/sandbox/api/src/main/java/org/richfaces/model/selection/SimpleSelection.java (rev 0)
+++ branches/refactor/sandbox/api/src/main/java/org/richfaces/model/selection/SimpleSelection.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -0,0 +1,43 @@
+/**
+ *
+ */
+package org.richfaces.model.selection;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class SimpleSelection implements Selection {
+
+ private static final long serialVersionUID = 1L;
+
+ private Set keys = new HashSet();
+
+ public boolean addKey(Object rowKey) {
+ return keys.add(rowKey);
+ }
+
+ public boolean removeKey(Object rowKey) {
+ return keys.remove(rowKey);
+ }
+
+ public Iterator getKeys() {
+ return keys.iterator();
+ }
+
+ public int size() {
+ return keys.size();
+ }
+
+ public boolean isSelected(Object rowKey) {
+ return keys.contains(rowKey);
+ }
+
+ public void clear() {
+ keys.clear();
+ }
+}
Deleted: branches/refactor/sandbox/ui/calendar/src/main/java/org/richfaces/component/CalendarDataModel.java
===================================================================
--- branches/refactor/sandbox/ui/calendar/src/main/java/org/richfaces/component/CalendarDataModel.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/sandbox/ui/calendar/src/main/java/org/richfaces/component/CalendarDataModel.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,44 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-package org.richfaces.component;
-
-import java.util.Date;
-/**
- * @author Alexej Kushunin
- * created 19.06.2007
- *
- */
-public interface CalendarDataModel {
-
- /**
- * @return array of CalendarDataModelItems for selected dates.
- * This method will be called every time when components will need next block of CalendarDataItems.
- * That may happens when calendar rendered, or when user navigate to next(previous) month or in any other case when calendar renders.
- * This method will be called in Ajax mode when Calendar renders new page.
- * */
- public CalendarDataModelItem[] getData(Date[] dateArray);
-
- /**
- * @return tool tip when it's used in "single" mode
- * This method used when tool tips are displayed in "single" mode
- * */
- public Object getToolTip(Date date);
-}
Deleted: branches/refactor/sandbox/ui/calendar/src/main/java/org/richfaces/component/CalendarDataModelItem.java
===================================================================
--- branches/refactor/sandbox/ui/calendar/src/main/java/org/richfaces/component/CalendarDataModelItem.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/sandbox/ui/calendar/src/main/java/org/richfaces/component/CalendarDataModelItem.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,65 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-package org.richfaces.component;
-
-import java.util.Date;
-
-
-/**
- * @author Alexej Kushunin
- * created 19.06.2007
- *
- */
-
-public interface CalendarDataModelItem {
-
- /**
- * @return date that this item for, default implementation return Date
- * */
- public Date getDate();
-
- /**
- *@return true if date is selectable on calendar, default implementation return true
- **/
- public boolean isEnabled();
-
- /**
- * @return String that will be appended to style class for that date span.
- * For example it may be relevant holyday that mean class will be like rich-cal-day relevant holyday.
- * Default implementation return empty string.
- * */
- public String getStyleClass();
-
- /**
- * @return any additional payload that must be JSON-serialazable object.
- * May be used in custom date representation on calendar (inside custom facet).*/
- public Object getData();
-
- /**
- * @return true if given date has an associated with it tooltip data.
- * Default implementation return false.*/
- public boolean hasToolTip();
-
- /**
- *@return tool tip data that will be used in batch tooltip loading mode.
- **/
- public Object getToolTip();
-}
Deleted: branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Selectable.java
===================================================================
--- branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Selectable.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Selectable.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -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: branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Sortable.java
===================================================================
--- branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Sortable.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Sortable.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -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);
-}
Deleted: branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/scroll/ScrollEvent.java
===================================================================
--- branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/scroll/ScrollEvent.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/scroll/ScrollEvent.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,51 +0,0 @@
-/**
- *
- */
-package org.richfaces.event.scroll;
-
-import javax.faces.component.UIComponent;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-
-/**
- * @author Anton Belevich
- *
- */
-public class ScrollEvent extends FacesEvent {
-
- private static final long serialVersionUID = 3786221668771853810L;
-
- private int rows;
-
- private int first;
-
- public ScrollEvent(UIComponent component, int rows, int first){
- super(component);
- this.rows = rows;
- this.first = first;
- }
-
- public boolean isAppropriateListener(FacesListener listener) {
- return false;
- }
-
- public void processListener(FacesListener listener) {
- }
-
- public int getFirst() {
- return first;
- }
-
- public void setFirst(int first) {
- this.first = first;
- }
-
- public int getRows() {
- return rows;
- }
-
- public void setRows(int rows) {
- this.rows = rows;
- }
-
-}
Deleted: branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortEvent.java
===================================================================
--- branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortEvent.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortEvent.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -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: branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortListener.java
===================================================================
--- branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortListener.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortListener.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -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: branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortSource.java
===================================================================
--- branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortSource.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortSource.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -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();
-}
Deleted: branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/DataModelCache.java
===================================================================
--- branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/DataModelCache.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/DataModelCache.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,186 +0,0 @@
-/**
- *
- */
-package org.richfaces.model;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.faces.context.FacesContext;
-import javax.faces.model.DataModelListener;
-
-import org.ajax4jsf.ajax.repeat.DataVisitor;
-import org.ajax4jsf.ajax.repeat.Range;
-import org.ajax4jsf.ajax.repeat.SerializableDataModel;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Implementation stores last loaded data, so no additional requests to db will be performed
- * Acts as a proxy between the component and original data model
- * @author Maksim Kaszynski
- *
- */
-public class DataModelCache extends GridDataModel {
-
- private static Log log = LogFactory.getLog(DataModelCache.class);
-
- private static class DataRange {
- private int startRow;
- private int endRow;
- private SortOrder sortOrder;
- private List loadedData;
-
- public DataRange(int startRow, int endRow, SortOrder sortOrder,
- List loadedData) {
- super();
- this.startRow = startRow;
- this.endRow = endRow;
- this.sortOrder = sortOrder;
- this.loadedData = loadedData;
- }
-
- public boolean match(int s, int e, SortOrder sortOrder) {
- return s == startRow
- && e == endRow
- && sortOrdersMatch(sortOrder, this.sortOrder);
- }
-
- private boolean sortOrdersMatch(SortOrder sortOrder1, SortOrder sortOrder2) {
- boolean result = sortOrder1 == sortOrder2;
-
- if (sortOrder1 != null && sortOrder2 != null) {
- result = sortOrder1.equals(sortOrder2);
- }
-
- return result;
- }
-
- }
-
- private Map secondaryMapping = new HashMap();
-
- private DataRange dataRange;
-
- private GridDataModel gridDataModel;
-
- private int rowCount = Integer.MIN_VALUE;
-
- public DataModelCache(GridDataModel gridDataModel) {
- super();
- this.gridDataModel = gridDataModel;
-
- if (log.isTraceEnabled()) {
- log.trace("initializing with " + gridDataModel);
- }
- }
-
- public void addDataModelListener(DataModelListener listener) {
- gridDataModel.addDataModelListener(listener);
- }
-
- public DataModelListener[] getDataModelListeners() {
- return gridDataModel.getDataModelListeners();
- }
-
- public Object getObjectById(Object id) {
-
- if (log.isDebugEnabled()) {
- log.debug("Trying to get object by id" + id);
- }
- //First try to find data in inner cache
- //If not found - get it from original model
- Object cached = secondaryMapping.get(id);
-
- if (cached == null) {
-
- if (log.isDebugEnabled()) {
- log.debug("Cache miss " + id + " falling back to original model");
- }
-
- cached = gridDataModel.getObjectById(id);
- secondaryMapping.put(id, cached);
-
- }
-
- if (log.isDebugEnabled()) {
- log.debug("At last found element " + cached);
- }
-
- return cached;
- }
-
- public int getRowCount() {
- if (rowCount == Integer.MIN_VALUE) {
- rowCount = gridDataModel.getRowCount();
- }
- return rowCount;
- }
-
- public Object getRowData() {
- Object secondaryMapped = secondaryMapping.get(getRowKey());
-
- if (secondaryMapped == null) {
- secondaryMapped = super.getRowData();
- }
- return secondaryMapped;
- }
-
- public int getRowIndex() {
- return gridDataModel.getRowIndex();
- }
-
- public Object getRowKey() {
- return gridDataModel.getRowKey();
- }
-
- public SerializableDataModel getSerializableModel(Range range) {
- return gridDataModel.getSerializableModel(range);
- }
-
- public Object getWrappedData() {
- return gridDataModel.getWrappedData();
- }
-
- public boolean isRowAvailable() {
- return secondaryMapping.containsKey(getRowKey()) || super.isRowAvailable();
- }
-
- public List loadData(int startRow, int endRow, SortOrder sortOrder) {
- if (dataRange == null || !dataRange.match(startRow, endRow, sortOrder)) {
- List data = gridDataModel.loadData(startRow, endRow, sortOrder);
- dataRange = new DataRange(startRow, endRow, sortOrder, data);
- }
- return dataRange.loadedData;
- }
-
- public void removeDataModelListener(DataModelListener listener) {
- gridDataModel.removeDataModelListener(listener);
- }
-
- public void setRowIndex(int arg0) {
- gridDataModel.setRowIndex(arg0);
- }
-
- public void setRowKey(Object key) {
- gridDataModel.setRowKey(key);
- super.setRowKey(key);
- }
-
- public void setWrappedData(Object arg0) {
- gridDataModel.setWrappedData(arg0);
- }
-
- public Object getId(Object o) {
- return gridDataModel.getId(o);
- }
-
- public void walk(FacesContext context, DataVisitor visitor, Range range,
- Object argument) throws IOException {
- // TODO Auto-generated method stub
- super.walk(context, visitor, range, argument);
- }
-
-}
Deleted: branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/GridDataModel.java
===================================================================
--- branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/GridDataModel.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/GridDataModel.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,208 +0,0 @@
-/**
- *
- */
-package org.richfaces.model;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.ajax.repeat.DataVisitor;
-import org.ajax4jsf.ajax.repeat.ExtendedDataModel;
-import org.ajax4jsf.ajax.repeat.Range;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Base class for data models
- * Subclasses must implement {@link #loadData(int, int, SortOrder)}
- * For certain features (like selection and sorting) to work correctly together,
- * {@link #getId(Object)} and {@link #getObjectById(Object)}
- * methods need to be overriden
- *
- * @author Maksim Kaszynski
- *
- */
-public abstract class GridDataModel extends ExtendedDataModel {
-
- /**
- * Simple implementation - index-based row key
- * @author Maksim Kaszynski
- *
- */
- private static class SimpleRowKey implements Serializable{
-
- private static final long serialVersionUID = 1L;
- private int i;
-
- public SimpleRowKey(int i) {
- super();
- this.i = i;
- }
-
- public int intValue() {
- return i;
- }
-
- public String toString() {
- return String.valueOf(i);
- }
- }
-
-
- private static final Log log = LogFactory.getLog(GridDataModel.class);
-
- private Object rowKey;
-
- private Map mapping;
-
- private SortOrder lastSortOrder;
-
- /**
- * Load range of data items from the source.
- * Starting from startRow, and up to but excluding endRow
- * @param startRow
- * @param endRow
- * @param sortOrder
- * @return list of ordered data
- */
- public abstract List loadData(int startRow, int endRow, SortOrder sortOrder);
-
-
- /**
- * Load data range, and iterate over it
- */
- public void walk(FacesContext context, DataVisitor visitor, Range range,
- Object argument) throws IOException {
-
- if (log.isTraceEnabled()) {
- log.trace("Starting walk");
- }
-
- ScrollableGridRange sequenceRange = (ScrollableGridRange) range;
-
- int startIndex = sequenceRange.getFirst();
- int last = sequenceRange.getLast();
-
- lastSortOrder = sequenceRange.getSortOrder();
-
- List objects = loadData(startIndex, last, lastSortOrder);
-
- mapping = new HashMap();
-
- for (int i = 0; i < objects.size(); i++,startIndex++) {
- Object data = objects.get(i);
- Object key = getId(data);
-
- if (key == null) {
- key = new SimpleRowKey(startIndex);
- }
-
- mapping.put(key, data);
-
- visitor.process(context, key, argument);
-
- }
-
- if (log.isTraceEnabled()) {
- log.trace("Ending walk");
- }
-
- }
-
-
- /**
- * This method is the reverse of {@link #getId(Object)}
- * If you override this method, you need to override {@link #getId(Object)} as well
- * @param id
- * @return
- */
- public Object getObjectById(Object id) {
-
- if (id instanceof SimpleRowKey) {
- int i = ((SimpleRowKey) id).intValue();
-
- List l = loadData(i, i + 1, lastSortOrder);
-
- return l.get(0);
-
- }
-
- return null;
- }
-
- /**
- * To get rid of Entity interface, method is introduced
- * Implementations may override it to provide domain-specific searches
- * Id should be serializable
- * Default implementation returns <code>null</code> anyway
- * If you override this method, you need to override {@link #getObjectById(Object)} as well
- * @param o
- * @return
- */
- public Object getId(Object o) {
- return null;
- }
-
-
- public Object getRowData() {
-
- if (mapping != null && mapping.containsKey(rowKey)) {
- return mapping.get(rowKey);
- } else {
- return loadAndMap(rowKey);
- }
-
- }
-
- /**
- * Row indexes navigation is no longer supported
- */
- public int getRowIndex() {
- throw new UnsupportedOperationException("getRowIndex");
- }
-
- /**
- * Quite simple implementation - data will be cached, so the call will be cheap
- */
- public boolean isRowAvailable() {
- return getRowData() != null;
- }
-
- /**
- * Row indexes navigation is no longer supported
- */
- public void setRowIndex(int arg0) {
- throw new UnsupportedOperationException("setRowIndex");
- }
-
- public Object getRowKey() {
- return rowKey;
- }
-
- public void setRowKey(Object key) {
- rowKey = key;
- }
-
- private Object loadAndMap(Object id) {
-
- if (log.isTraceEnabled()) {
- log.trace("loadAndMap " + id);
- }
-
- Object o = getObjectById(id);
- if (o != null) {
- if (mapping == null) {
- mapping = new HashMap();
- }
- mapping.put(id, o);
- }
- return o;
- }
-
-
-}
Deleted: branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/ScrollableGridRange.java
===================================================================
--- branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/ScrollableGridRange.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/ScrollableGridRange.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,93 +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/model/ScrollableGridRange.java,v $
- * $Revision: 1.7 $
- */
-
-package org.richfaces.model;
-
-import java.io.Serializable;
-
-import org.ajax4jsf.ajax.repeat.Range;
-
-
-
-/**
- * @author Maksim Kaszynski
- * @modified by Anton Belevich
- */
-public class ScrollableGridRange implements Range, Serializable{
-
- private static final long serialVersionUID = -6675002421400464892L;
-
- private int first = 0;
- private int last = 0;
- private SortOrder sortOrder;
-
- public ScrollableGridRange(int first, int last, SortOrder sortOrder) {
- super();
- this.first = first;
- this.last = last;
- this.sortOrder = sortOrder;
- }
-
- /**
- * @return the bufferSize
- */
- public int getLast() {
- return last;
- }
- /**
- * @param bufferSize the bufferSize to set
- */
- public void setLast(int lastRow) {
- this.last = lastRow;
- }
- /**
- * @return the first
- */
- public int getFirst() {
- return first;
- }
- /**
- * @param first the first to set
- */
- public void setFirst(int first) {
- this.first = first;
- }
-
- public SortOrder getSortOrder() {
- return sortOrder;
- }
-
- public void setSortOrder(SortOrder sortOrder) {
- this.sortOrder = sortOrder;
- }
-
- public boolean equals(Object obj) {
-
- if(!(obj instanceof ScrollableGridRange)){
- return super.equals(obj);
- }
-
- ScrollableGridRange ref = (ScrollableGridRange)obj;
-
- boolean ret = (this.first == ref.first)&&(this.last == ref.last );
-
- if(this.sortOrder != null){
- ret = ret && this.sortOrder.equals(ref.sortOrder);
- } else {
- ret = (ret && (ref.sortOrder == null));
- }
-
- return ret;
- }
-
- public int hashCode() {
- return super.hashCode();
- }
-}
Deleted: branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/SortOrder.java
===================================================================
--- branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/SortOrder.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/SortOrder.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,74 +0,0 @@
-package org.richfaces.model;
-
-import java.io.Serializable;
-/**
- *
- * @author Maksim Kaszynski
- *
- *
- */
-public class SortOrder implements Serializable {
-
- private static final long serialVersionUID = 2423450561570551363L;
-
- private boolean ascending;
-
- private int sortColumn = -1;
-
-
- public SortOrder( int sortColumn, boolean ascending) {
- super();
- this.sortColumn = sortColumn;
- this.ascending = ascending;
- }
-
- public SortOrder() {
- super();
- }
-
- public boolean isAscending() {
- return ascending;
- }
-
- public void setAscending(boolean ascending) {
- this.ascending = ascending;
- }
-
- public int getSortColumn() {
- return sortColumn;
- }
-
- public void setSortColumn(int sortColumn) {
- this.sortColumn = sortColumn;
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return "SortOrder: {field:" + sortColumn + ", ascending: " + ascending
- + "}";
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
-
- if (obj instanceof SortOrder) {
- SortOrder sortOrder = (SortOrder) obj;
- return sortColumn == sortOrder.sortColumn
- && ascending == sortOrder.ascending;
-
- }
- return super.equals(obj);
- }
-
- public int hashCode() {
- int c = (new Integer(sortColumn)).hashCode();
- if (ascending) {
- c = -c;
- }
- return c;
- }
-}
\ No newline at end of file
Deleted: branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/ClientSelection.java
===================================================================
--- branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/ClientSelection.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/ClientSelection.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,129 +0,0 @@
-/**
- *
- */
-package org.richfaces.model.selection;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public class ClientSelection implements Serializable{
-
- private static final long serialVersionUID = 5855157282287053681L;
-
- public static final String FLAG_RESET = "x";
-
- public static final String FLAG_ALL = "a";
-
- private String selectionFlag;
-
- private List ranges = new ArrayList();
-
- public ClientSelection() {
- }
-
-
- public void addRange(SelectionRange range) {
- ranges.add(range);
- }
-
- public boolean isSelected(int i) {
- boolean result = false;
- Iterator iterator = ranges.iterator();
- while (iterator.hasNext() && !result) {
- result |= ((SelectionRange) iterator.next()).within(i);
- }
- return result;
- }
-
- public List getRanges() {
- return ranges;
- }
-
- 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;
- }
-
-
- }
-
- private boolean reset = false;
- public boolean isReset() {
- return reset;
- }
-
- private boolean selectAll = false;
- public boolean isSelectAll() {
- return selectAll;
- }
-
-
- public String getSelectionFlag() {
- return selectionFlag;
- }
-
-
- public void setSelectionFlag(String selectionFlag) {
- this.selectionFlag = selectionFlag;
-
- reset = false;
- selectAll = false;
-
- if (FLAG_ALL.equals(selectionFlag)) {
- selectAll = true;
- } else if (FLAG_RESET.equals(selectionFlag)) {
- reset = true;
- }
- }
-}
Deleted: branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/Selection.java
===================================================================
--- branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/Selection.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/Selection.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,20 +0,0 @@
-/**
- *
- */
-package org.richfaces.model.selection;
-
-import java.io.Serializable;
-import java.util.Iterator;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public interface Selection extends Serializable {
-
- public Iterator getKeys();
-
- public int size();
-
- public boolean isSelected(Object rowKey);
-}
Deleted: branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/SelectionRange.java
===================================================================
--- branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/SelectionRange.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/SelectionRange.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,64 +0,0 @@
-/**
- *
- */
-package org.richfaces.model.selection;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public class SelectionRange {
- private int startIndex = -1;;
- private int endIndex = -1;
-
- public SelectionRange(int startIndex, int endIndex) {
- super();
- this.startIndex = startIndex;
- this.endIndex = endIndex;
- }
-
- public int getStartIndex() {
- return startIndex;
- }
-
- public void setStartIndex(int startIndex) {
- this.startIndex = startIndex;
- }
-
- public int getEndIndex() {
- return endIndex;
- }
-
- public void setEndIndex(int endIndex) {
- this.endIndex = endIndex;
- }
-
- 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;
- }
-
-
-}
Deleted: branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/SimpleSelection.java
===================================================================
--- branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/SimpleSelection.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/SimpleSelection.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,43 +0,0 @@
-/**
- *
- */
-package org.richfaces.model.selection;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public class SimpleSelection implements Selection {
-
- private static final long serialVersionUID = 1L;
-
- private Set keys = new HashSet();
-
- public boolean addKey(Object rowKey) {
- return keys.add(rowKey);
- }
-
- public boolean removeKey(Object rowKey) {
- return keys.remove(rowKey);
- }
-
- public Iterator getKeys() {
- return keys.iterator();
- }
-
- public int size() {
- return keys.size();
- }
-
- public boolean isSelected(Object rowKey) {
- return keys.contains(rowKey);
- }
-
- public void clear() {
- keys.clear();
- }
-}
Deleted: branches/refactor/sandbox/ui/simpleTogglePanel2/src/main/java/org/richfaces/event/ISimpleToggle2Listener.java
===================================================================
--- branches/refactor/sandbox/ui/simpleTogglePanel2/src/main/java/org/richfaces/event/ISimpleToggle2Listener.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/sandbox/ui/simpleTogglePanel2/src/main/java/org/richfaces/event/ISimpleToggle2Listener.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,38 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * Created on 11.07.2006
- */
-package org.richfaces.event;
-
-import javax.faces.event.FacesListener;
-
-/**
- * @author igels
- */
-
-//TODO by nick - denis - add addToggleListener method to component
-public interface ISimpleToggle2Listener extends FacesListener {
-
- public void processToggle(SimpleToggle2Event event);
-
-}
\ No newline at end of file
Deleted: branches/refactor/sandbox/ui/simpleTogglePanel2/src/main/java/org/richfaces/event/SimpleToggle2Event.java
===================================================================
--- branches/refactor/sandbox/ui/simpleTogglePanel2/src/main/java/org/richfaces/event/SimpleToggle2Event.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/sandbox/ui/simpleTogglePanel2/src/main/java/org/richfaces/event/SimpleToggle2Event.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,76 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * Created on 11.07.2006
- */
-package org.richfaces.event;
-
-import javax.faces.component.UIComponent;
-import javax.faces.event.ActionEvent;
-import javax.faces.event.FacesListener;
-
-/**
- * @author igels
- */
-public class SimpleToggle2Event extends ActionEvent {
-
- private static final long serialVersionUID = 5582624805941635421L;
- private boolean _opened;
-
- /**
- * @param source
- * @param opened
- */
- public SimpleToggle2Event(UIComponent source, boolean opened) {
- super(source);
- this._opened = opened;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
- */
- public boolean isAppropriateListener(FacesListener listener) {
- return listener instanceof ISimpleToggle2Listener;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
- */
- public void processListener(FacesListener listener) {
- ((ISimpleToggle2Listener) listener).processToggle(this);
- }
-
- /**
- * @return Returns the _state.
- */
- public boolean isIsOpen() {
- return _opened;
- }
-
- /**
- *
- * @param opened The state to set
- */
- public void setIsOpen(boolean opened) {
- this._opened = opened;
- }
-}
\ No newline at end of file
Deleted: branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/event/DataFilterSliderEvent.java
===================================================================
--- branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/event/DataFilterSliderEvent.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/event/DataFilterSliderEvent.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,71 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.event;
-
-import javax.faces.component.UIComponent;
-import javax.faces.event.PhaseId;
-import javax.faces.event.FacesListener;
-import javax.faces.event.FacesEvent;
-
-/**
- * @author Wesley Hales
- */
-public class DataFilterSliderEvent extends FacesEvent {
-
- private Integer oldSliderVal;
- private Integer newSliderVal;
-
- /**
- * Creates a new SliderEvent.
- *
- * @param component the source of the event
- * @param thisOldSliderVal the previously showing item identifier
- * @param thisNewSliderVal the currently showing item identifier
- */
- public DataFilterSliderEvent(UIComponent component, Integer thisOldSliderVal, Integer thisNewSliderVal) {
- super(component);
- setPhaseId(PhaseId.INVOKE_APPLICATION);
- oldSliderVal = thisOldSliderVal;
- newSliderVal = thisNewSliderVal;
- }
-
- public Integer getOldSliderVal() {
- return oldSliderVal;
- }
-
- public Integer getNewSliderVal() {
- return newSliderVal;
- }
-
- public boolean isAppropriateListener(FacesListener listener){
- return (listener instanceof DataFilterSliderListener);
- }
-
- /**
- * Delivers this event to the SliderListener.
- *
- * @param listener the slider listener
- */
- public void processListener(FacesListener listener){
- ((DataFilterSliderListener) listener).processSlider(this);
- }
-}
Deleted: branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/event/DataFilterSliderListener.java
===================================================================
--- branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/event/DataFilterSliderListener.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/event/DataFilterSliderListener.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,33 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.event;
-
-import javax.faces.event.FacesListener;
-
-/**
- * @author Wesley Hales
- */
-public interface DataFilterSliderListener extends FacesListener {
-
- public void processSlider(org.richfaces.event.DataFilterSliderEvent event);
-
-}
Deleted: branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/event/DataFilterSliderSource.java
===================================================================
--- branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/event/DataFilterSliderSource.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/event/DataFilterSliderSource.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,50 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.event;
-
-/**
- * @author Wesley Hales
- */
-public interface DataFilterSliderSource {
-
- /**
- * Adds a DataFilterSliderListener to this DataFilterSliderSource.
- *
- * @param listener the Slider listener to be added
- */
- public void addSliderListener(org.richfaces.event.DataFilterSliderListener listener);
-
- /**
- * Removes a DataFilterSliderListener from this DataFilterSliderSource.
- *
- * @param listener the Slider listener to be removed
- */
- public void removeSliderListener(DataFilterSliderListener listener);
-
- /**
- * Returns all SliderListeners for this DataFilterSliderSource.
- *
- * @return the Slider listener array
- */
- public DataFilterSliderListener[] getSliderListeners();
-
-}
Deleted: branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/events/DataFilterSliderAdapter.java
===================================================================
--- branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/events/DataFilterSliderAdapter.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/events/DataFilterSliderAdapter.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,108 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.events;
-
-import javax.faces.component.StateHolder;
-import javax.faces.component.UIComponentBase;
-import javax.faces.el.MethodBinding;
-import javax.faces.context.FacesContext;
-
-/**
- * @author Wesley Hales
- */
-public class DataFilterSliderAdapter implements DataFilterSliderListener, StateHolder {
-
- public static Class[] SIGNATURE = new Class[] { DataFilterSliderEvent.class };
-
- private MethodBinding sliderMethod;
- private boolean sliderTransient;
-
- /**
- * empty constructor needed.
- *
- */
- public DataFilterSliderAdapter() {
- }
-
- /**
- * Creates a new DataFilterSliderAdapter.
- *
- * @param mySliderMethod the MethodBinding to adapt
- */
- public DataFilterSliderAdapter(MethodBinding mySliderMethod) {
- sliderMethod = mySliderMethod;
- }
-
- /**
- * Processes a SliderEvent.
- *
- * @param event the slider event
- */
- public void processSlider(DataFilterSliderEvent event) {
- FacesContext context = FacesContext.getCurrentInstance();
- sliderMethod.invoke(context, new Object[]{event});
- }
-
- /**
- * Saves the internal state of this DataFilterSliderAdapter.
- *
- * @param context the Faces context
- *
- * @return the saved state
- */
- public Object saveState(FacesContext context) {
- return UIComponentBase.saveAttachedState(context, sliderMethod);
- }
-
- /**
- * Restores the internal state of this DataFilterSliderAdapter.
- *
- * @param context the Faces context
- * @param object the state to restore
- */
- public void restoreState(FacesContext context, Object object){
- sliderMethod = (MethodBinding) UIComponentBase.restoreAttachedState(context, object);
- }
-
- /**
- * Returns true if this DataFilterSliderAdapter is transient and should
- * not be state saved, otherwise false.
- *
- * @return the value of transient
- */
- public boolean isTransient() {
- return sliderTransient;
- }
-
- /**
- * Indicates whether or not this DataFilterSliderAdapter is transient and should
- * not be state saved.
- *
- * @param isTransient the new value for transient
- */
- public void setTransient(
-
- boolean isTransient) {
- sliderTransient = isTransient;
- }
-
-}
Deleted: branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/events/DataFilterSliderEvent.java
===================================================================
--- branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/events/DataFilterSliderEvent.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/events/DataFilterSliderEvent.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,73 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.events;
-
-import org.ajax4jsf.framework.ajax.AjaxEvent;
-
-import javax.faces.component.UIComponent;
-import javax.faces.event.PhaseId;
-import javax.faces.event.FacesListener;
-import javax.faces.event.FacesEvent;
-
-/**
- * @author Wesley Hales
- */
-public class DataFilterSliderEvent extends FacesEvent {
-
- private Integer oldSliderVal;
- private Integer newSliderVal;
-
- /**
- * Creates a new SliderEvent.
- *
- * @param component the source of the event
- * @param thisOldSliderVal the previously showing item identifier
- * @param thisNewSliderVal the currently showing item identifier
- */
- public DataFilterSliderEvent(UIComponent component, Integer thisOldSliderVal, Integer thisNewSliderVal) {
- super(component);
- setPhaseId(PhaseId.INVOKE_APPLICATION);
- oldSliderVal = thisOldSliderVal;
- newSliderVal = thisNewSliderVal;
- }
-
- public Integer getOldSliderVal() {
- return oldSliderVal;
- }
-
- public Integer getNewSliderVal() {
- return newSliderVal;
- }
-
- public boolean isAppropriateListener(FacesListener listener){
- return (listener instanceof DataFilterSliderListener);
- }
-
- /**
- * Delivers this event to the SliderListener.
- *
- * @param listener the slider listener
- */
- public void processListener(FacesListener listener){
- ((DataFilterSliderListener) listener).processSlider(this);
- }
-}
Deleted: branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/events/DataFilterSliderListener.java
===================================================================
--- branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/events/DataFilterSliderListener.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/events/DataFilterSliderListener.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,33 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.events;
-
-import javax.faces.event.FacesListener;
-
-/**
- * @author Wesley Hales
- */
-public interface DataFilterSliderListener extends FacesListener {
-
- public void processSlider(org.richfaces.events.DataFilterSliderEvent event);
-
-}
Deleted: branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/events/DataFilterSliderSource.java
===================================================================
--- branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/events/DataFilterSliderSource.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/dataFilterSlider/src/main/java/org/richfaces/events/DataFilterSliderSource.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,52 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.events;
-
-import javax.faces.el.MethodBinding;
-
-/**
- * @author Wesley Hales
- */
-public interface DataFilterSliderSource {
-
- /**
- * Adds a DataFilterSliderListener to this DataFilterSliderSource.
- *
- * @param listener the Slider listener to be added
- */
- public void addSliderListener(org.richfaces.events.DataFilterSliderListener listener);
-
- /**
- * Removes a DataFilterSliderListener from this DataFilterSliderSource.
- *
- * @param listener the Slider listener to be removed
- */
- public void removeSliderListener(DataFilterSliderListener listener);
-
- /**
- * Returns all SliderListeners for this DataFilterSliderSource.
- *
- * @return the Slider listener array
- */
- public DataFilterSliderListener[] getSliderListeners();
-
-}
Deleted: branches/refactor/ui/dataTable/src/main/java/org/richfaces/component/Column.java
===================================================================
--- branches/refactor/ui/dataTable/src/main/java/org/richfaces/component/Column.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/dataTable/src/main/java/org/richfaces/component/Column.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,45 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-/**
- * Marker interface for all components used as column in UIDataTable
- * @author shura
- *
- */
-public interface Column {
-
-
- /**
- * Out this column on new row
- * @parameter
- * @return the acceptClass
- */
- public abstract boolean isBreakBefore();
-
- /**
- * @param newBreakBefore the value to set
- */
- public abstract void setBreakBefore(boolean newBreakBefore);
-
-
-}
Deleted: branches/refactor/ui/dataTable/src/main/java/org/richfaces/component/Row.java
===================================================================
--- branches/refactor/ui/dataTable/src/main/java/org/richfaces/component/Row.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/dataTable/src/main/java/org/richfaces/component/Row.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,39 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-import java.util.Iterator;
-
-/**
- * Marker interface for table columns, rendered as entire row.
- * @author shura
- *
- */
-public interface Row extends Column {
-
- /**
- * Get iterator for all columns contained in this row.
- * @return
- */
- public Iterator columns();
-
-}
Deleted: branches/refactor/ui/datascroller/src/main/java/org/richfaces/event/DataScrollerEvent.java
===================================================================
--- branches/refactor/ui/datascroller/src/main/java/org/richfaces/event/DataScrollerEvent.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/datascroller/src/main/java/org/richfaces/event/DataScrollerEvent.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,80 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.event;
-
-import javax.faces.component.UIComponent;
-import javax.faces.event.ActionEvent;
-import javax.faces.event.FacesListener;
-
-/**
- * @author Wesley Hales
- */
-public class DataScrollerEvent extends ActionEvent {
-
- /**
- *
- */
- private static final long serialVersionUID = 2657353903701932561L;
- private String oldScrolVal;
- private String newScrolVal;
-
- /**
- * Creates a new ScrollerEvent.
- *
- * @param component the source of the event
- * @param thisOldScrolVal the previously showing item identifier
- * @param thisNewScrolVal the currently showing item identifier
- */
- public DataScrollerEvent(UIComponent component, String thisOldScrolVal, String thisNewScrolVal) {
- super(component);
- oldScrolVal = thisOldScrolVal;
- newScrolVal = thisNewScrolVal;
- }
-
- public String getOldScrolVal() {
- return oldScrolVal;
- }
-
- public String getNewScrolVal() {
- return newScrolVal;
- }
-
- public boolean isAppropriateListener(FacesListener listener){
- return super.isAppropriateListener(listener) || (listener instanceof DataScrollerListener);
- }
-
- /**
- * Delivers this event to the SliderListener.
- *
- * @param listener the slider listener
- */
- public void processListener(FacesListener listener){
- if (listener instanceof DataScrollerListener) {
- DataScrollerListener dataScrollerListener = (DataScrollerListener) listener;
- dataScrollerListener.processScroller(this);
- }
-
- if (super.isAppropriateListener(listener)) {
- super.processListener(listener);
- }
- }
-}
Deleted: branches/refactor/ui/datascroller/src/main/java/org/richfaces/event/DataScrollerListener.java
===================================================================
--- branches/refactor/ui/datascroller/src/main/java/org/richfaces/event/DataScrollerListener.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/datascroller/src/main/java/org/richfaces/event/DataScrollerListener.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,31 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.event;
-
-import javax.faces.event.FacesListener;
-
-
-public interface DataScrollerListener extends FacesListener {
-
- public void processScroller(org.richfaces.event.DataScrollerEvent event);
-
-}
Deleted: branches/refactor/ui/datascroller/src/main/java/org/richfaces/event/DataScrollerSource.java
===================================================================
--- branches/refactor/ui/datascroller/src/main/java/org/richfaces/event/DataScrollerSource.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/datascroller/src/main/java/org/richfaces/event/DataScrollerSource.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,47 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.event;
-
-public interface DataScrollerSource {
-
- /**
- * Adds a DataScrollerListener to this DataScrollerSource.
- *
- * @param listener the Scroler listener to be added
- */
- public void addScrollerListener(org.richfaces.event.DataScrollerListener listener);
-
- /**
- * Removes a DataFilterSliderListener from this DataScrollerSourceSource.
- *
- * @param listener the Scroler listener to be removed
- */
- public void removeScrollerListener(DataScrollerListener listener);
-
- /**
- * Returns all ScrollerListeners for this DataScrollerSource.
- *
- * @return the Scroler listener array
- */
- public DataScrollerListener[] getScrollerListeners();
-
-}
Deleted: branches/refactor/ui/simpleTogglePanel/src/main/java/org/richfaces/event/ISimpleToggleListener.java
===================================================================
--- branches/refactor/ui/simpleTogglePanel/src/main/java/org/richfaces/event/ISimpleToggleListener.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/simpleTogglePanel/src/main/java/org/richfaces/event/ISimpleToggleListener.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,38 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * Created on 11.07.2006
- */
-package org.richfaces.event;
-
-import javax.faces.event.FacesListener;
-
-/**
- * @author igels
- */
-
-//TODO by nick - denis - add addToggleListener method to component
-public interface ISimpleToggleListener extends FacesListener {
-
- public void processToggle(SimpleToggleEvent event);
-
-}
\ No newline at end of file
Deleted: branches/refactor/ui/simpleTogglePanel/src/main/java/org/richfaces/event/SimpleToggleEvent.java
===================================================================
--- branches/refactor/ui/simpleTogglePanel/src/main/java/org/richfaces/event/SimpleToggleEvent.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/simpleTogglePanel/src/main/java/org/richfaces/event/SimpleToggleEvent.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,76 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * Created on 11.07.2006
- */
-package org.richfaces.event;
-
-import javax.faces.component.UIComponent;
-import javax.faces.event.ActionEvent;
-import javax.faces.event.FacesListener;
-
-/**
- * @author igels
- */
-public class SimpleToggleEvent extends ActionEvent {
-
- private static final long serialVersionUID = 5582624805941635421L;
- private boolean _opened;
-
- /**
- * @param source
- * @param opened
- */
- public SimpleToggleEvent(UIComponent source, boolean opened) {
- super(source);
- this._opened = opened;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
- */
- public boolean isAppropriateListener(FacesListener listener) {
- return listener instanceof ISimpleToggleListener;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
- */
- public void processListener(FacesListener listener) {
- ((ISimpleToggleListener) listener).processToggle(this);
- }
-
- /**
- * @return Returns the _state.
- */
- public boolean isIsOpen() {
- return _opened;
- }
-
- /**
- *
- * @param opened The state to set
- */
- public void setIsOpen(boolean opened) {
- this._opened = opened;
- }
-}
\ No newline at end of file
Deleted: branches/refactor/ui/tabPanel/src/main/java/org/richfaces/model/TabModel.java
===================================================================
--- branches/refactor/ui/tabPanel/src/main/java/org/richfaces/model/TabModel.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/tabPanel/src/main/java/org/richfaces/model/TabModel.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,104 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.model;
-
-
-/**
- * @author asmirnov at exadel.com (latest modification by $Author: ishabalov $)
- * @version $Revision: 1.3 $ $Date: 2007/02/21 20:35:05 $
- */
-public interface TabModel {
-
- /**
- * Get Get internal value for this tab - to store in selectedTab attribute of {@link org.richfaces.component.UITabPanel}.
- * by default, if no tabValue set, as it's value used ordered number of this tab in panel.
- *
- * @return Returns the value.
- */
- public Object getName();
-
- /**
- * Set Get internal value for this tab - to store in selectedTab attribute of {@link org.richfaces.component.UITabPanel}.
- *
- * @param newvalue
- */
- public void setName(Object newvalue);
-
- public boolean isDisabled();
-
- public void setDisabled(boolean disabled);
-
- /**
- * Get label for this tab.
- *
- * @return Returns the label.
- */
- public String getLabel();
-
- /**
- * Set label for this tab.
- *
- * @param newvalue
- */
- public void setLabel(String newvalue);
-
- /**
- * Get width of label for this tab.
- *
- * @return Returns the labelWidth.
- */
- public String getLabelWidth();
-
- /**
- * Set width of label for this tab.
- *
- * @param newvalue
- */
- public void setLabelWidth(String newvalue);
-
- /**
- * Get Tab title - for pop-up message.
- *
- * @return Returns the title.
- */
- public String getTitle();
-
- /**
- * Set Tab title - for pop-up message.
- *
- * @param newvalue
- */
- public void setTitle(String newvalue);
-
- /**
- * Get Tab selection behavior for panel - one of "client", "server", "ajax", "page".
- *
- * @return Returns the switchType.
- */
- public String getSwitchType();
-
- /**
- * Set Tab selection behavior for panel - one of "client", "server", "ajax", "page".
- * @param newvalue
- */
- public void setSwitchType(String newvalue);
-}
\ No newline at end of file
Deleted: branches/refactor/ui/tree/src/main/java/org/richfaces/component/AbstractTreeDataModel.java
===================================================================
--- branches/refactor/ui/tree/src/main/java/org/richfaces/component/AbstractTreeDataModel.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/tree/src/main/java/org/richfaces/component/AbstractTreeDataModel.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,139 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-import java.io.IOException;
-
-import javax.faces.component.NamingContainer;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.ajax.repeat.DataVisitor;
-import org.ajax4jsf.ajax.repeat.ExtendedDataModel;
-import org.ajax4jsf.ajax.repeat.Range;
-import org.ajax4jsf.ajax.repeat.UIDataAdaptor;
-import org.richfaces.component.state.TreeRange;
-
-/**
- * @author Nick Belaevski - nbelaevski at exadel.com created 07.12.2006
- * Base class for all tree data models
- */
-public abstract class AbstractTreeDataModel extends ExtendedDataModel {
- public final static char SEPARATOR = NamingContainer.SEPARATOR_CHAR;
-
- private TreeNode wrappedData;
-
- public final int getRowCount() {
- return -1;
- }
-
- public final int getRowIndex() {
- return -1;
- }
-
- public final void setRowIndex(int rowIndex) {
- if(rowIndex!=-1) {
- throw new IllegalArgumentException("In AbstractTreeDataModel rowIndex must be -1.");
- }
- }
-
- public final Object getWrappedData() {
- return wrappedData;
- }
-
- public final void setWrappedData(Object data) {
- wrappedData = (TreeNode) data;
- }
-
- public final void walk(FacesContext context, DataVisitor dataVisitor,
- Range range, Object argument) throws IOException {
- walk(context, dataVisitor, range, null, argument, false);
- }
-
- /**
- * walk sub-model having row key argument as its root
- * @param context faces context
- * @param dataVisitor {@link UIDataAdaptor.ComponentVisitor}
- * @param range {@link TreeRange} to constraint the walk
- * @param rowKey row key to treat as root of sub-model
- * @param argument implementation specific argument
- * @param last boolean flag indicating whether we started our walk from last element
- * @throws IOException
- *
- * @see {@link ExtendedDataModel#walk(FacesContext, DataVisitor, Range, Object)}
- */
- public abstract void walk(FacesContext context, DataVisitor dataVisitor,
- Range range, Object rowKey, Object argument, boolean last) throws IOException;
-
- /**
- * returns whether this node is leaf
- * @return
- */
- public abstract boolean isLeaf();
-
- /**
- * Walk backing sub-model having row key argument as its root. If there is no backing model
- * configured, calling this method is equivalent to calling {@link #walk(FacesContext, DataVisitor, Range, Object, Object, boolean)}
- * @param facesContext faces context
- * @param visitor {@link UIDataAdaptor.ComponentVisitor} instance
- * @param range {@link Range} to constraint the walk
- * @param key row key to treat as root of sub-model
- * @param argument implementation-specific argument
- * @throws IOException
- *
- * @see {@link #walk(FacesContext, DataVisitor, Range, TreeRowKey, Object, boolean)}
- */
- public abstract void walkModel(FacesContext facesContext, DataVisitor visitor, Range range, Object key, Object argument, boolean last) throws IOException;
-
- /**
- * Processes concrete tree node. Knows about {@link LastElementAware} interface and handles it
- * properly. Checks if argument is instance of {@link SubTreeChildrenAppender} and if it is so
- * does appending current element
- * @param context
- * @param dataVisitor
- * @param argument
- * @param treeRowKey
- * @param last
- * @throws IOException
- */
- protected void processElement(FacesContext context, DataVisitor dataVisitor, Object argument, TreeRowKey treeRowKey, boolean last) throws IOException {
-// if (argument instanceof SubTreeChildrenAppender) {
-// setRowKey(treeRowKey);
-//
-// if (isRowAvailable()) {
-// ((SubTreeChildrenAppender) argument).addChild(treeRowKey, getRowData(), last, isLeaf(), getTreeNodeType());
-// }
-// }
-
- if (last && dataVisitor instanceof LastElementAware) {
- try {
- ((LastElementAware) dataVisitor).setLastElement();
- dataVisitor.process(context, treeRowKey, argument);
- } finally {
- ((LastElementAware) dataVisitor).resetLastElement();
- }
- } else {
- dataVisitor.process(context, treeRowKey, argument);
- }
- }
-
- public abstract TreeNode getTreeNode();
-}
Deleted: branches/refactor/ui/tree/src/main/java/org/richfaces/component/CacheableTreeDataModel.java
===================================================================
--- branches/refactor/ui/tree/src/main/java/org/richfaces/component/CacheableTreeDataModel.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/tree/src/main/java/org/richfaces/component/CacheableTreeDataModel.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,140 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-import java.io.IOException;
-
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.ajax.repeat.DataVisitor;
-import org.ajax4jsf.ajax.repeat.Range;
-
-/**
- * @author Nick - mailto:nbelaevski at exadel.com created 08.01.2007
- *
- */
-public class CacheableTreeDataModel extends TreeDataModel {
-
- private final class Visitor implements DataVisitor, LastElementAware {
- private final DataVisitor visitor;
-
- private Visitor(DataVisitor visitor) {
- this.visitor = visitor;
- }
-
- public void process(FacesContext context, Object rowKey, Object argument)
- throws IOException {
- TreeRowKey treeRowKey = (TreeRowKey) rowKey;
- treeDataModel.setRowKey(treeRowKey);
- locateTreeNode(treeRowKey, true).setData(treeDataModel.getRowData());
-
- if (visitor != null) {
- visitor.process(context, rowKey, argument);
- }
- }
-
- public void resetLastElement() {
- if (visitor instanceof LastElementAware) {
- ((LastElementAware) visitor).resetLastElement();
-
- }
- }
-
- public void setLastElement() {
- if (visitor instanceof LastElementAware) {
- ((LastElementAware) visitor).setLastElement();
-
- }
- }
- }
-
- private TreeDataModel treeDataModel;
-
- public boolean isLeaf() {
- TreeRowKey rowKey = (TreeRowKey) getRowKey();
- TreeNode treeNode = locateTreeNode(rowKey);
- if (treeNode != null && !treeNode.isLeaf()) {
- return false;
- }
-
- treeNode = treeDataModel.locateTreeNode(rowKey);
- if (treeNode != null) {
- return treeNode.isLeaf();
- }
-
- return false;
- }
-
- public CacheableTreeDataModel(TreeDataModel model) {
- super();
- setWrappedData(new TreeNodeImpl());
- setTreeDataModel(model);
- }
-
- public void walkModel(FacesContext context, DataVisitor visitor,
- Range range, Object key, Object argument, boolean last)
- throws IOException {
- treeDataModel.walkModel(context, new Visitor(visitor), range, key,
- argument, last);
- }
-
- public void setTreeDataModel(TreeDataModel treeDataModel) {
- this.treeDataModel = treeDataModel;
- }
-
- public TreeDataModel getTreeDataModel() {
- return treeDataModel;
- }
-
- public void walk(FacesContext context, final DataVisitor dataVisitor,
- Range range, Object rowKey, Object argument, boolean last)
- throws IOException {
-
- TreeNode cachedTreeNode = locateTreeNode((TreeRowKey) rowKey);
- TreeNode treeNode = treeDataModel.locateTreeNode((TreeRowKey) rowKey);
-
- if (treeNode != null) {
- if (cachedTreeNode == null || (cachedTreeNode.isLeaf() && !treeNode.isLeaf())) {
- //fill cache
- treeDataModel.walk(context, new Visitor(dataVisitor), range,
- rowKey, argument, last);
- } else {
- super.walk(context, dataVisitor, range, rowKey, argument, last);
- }
- }
- }
-
- public void setRowData(Object object) {
- (locateTreeNode((TreeRowKey)getRowKey())).setData(object);
- }
-
- public boolean isTransient() {
- return true;
- }
-
- public void setTransient(boolean newTransientValue) {
- if (!newTransientValue) {
- throw new IllegalArgumentException(
- "ReplaceableTreeDataModel shouldn't be transient!");
- }
- }
-}
Deleted: branches/refactor/ui/tree/src/main/java/org/richfaces/component/LastElementAware.java
===================================================================
--- branches/refactor/ui/tree/src/main/java/org/richfaces/component/LastElementAware.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/tree/src/main/java/org/richfaces/component/LastElementAware.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,45 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-import org.ajax4jsf.ajax.repeat.UIDataAdaptor;
-
-/**
- * @author Konstantin Mishin
- *
- * {@link UIDataAdaptor.ComponentVisitor} instances can implement this interface in order to
- * be notified of last element occurence at the current tree level. {@link #setLastElement()}
- * method is invoked before visiting last element and {@link #resetLastElement()} is called after
- * visiting last element.
- */
-public interface LastElementAware {
-
- /**
- * The method is invoked to notify that last element occured
- */
- public void setLastElement();
- /**
- * The method is invoked to notify that we're done with last element
- */
- public void resetLastElement();
-
-}
Deleted: branches/refactor/ui/tree/src/main/java/org/richfaces/component/ListRowKey.java
===================================================================
--- branches/refactor/ui/tree/src/main/java/org/richfaces/component/ListRowKey.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/tree/src/main/java/org/richfaces/component/ListRowKey.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,236 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * @author Nick Belaevski - nbelaevski at exadel.com
- * created 17.11.2006
- * Default {@link TreeRowKey} implementation based on {@link ArrayList}
- */
-public class ListRowKey extends TreeRowKey {
-
- private ArrayList path;
-
- /**
- *
- */
- private static final long serialVersionUID = 7718335783201397177L;
-
- public String toString() {
- return getPath();
- }
-
- /**
- * Default constructor
- */
- public ListRowKey() {
- super();
- this.path = new ArrayList();
- }
-
- /**
- * Copy constructor
- * @param parentRowKey row key to clone
- */
- protected ListRowKey(ListRowKey parentRowKey) {
- super();
- this.path = (ArrayList) parentRowKey.path.clone();
- }
-
- /**
- * Appending constructor
- * @param parentRowKey base row key
- * @param pathElement path segment to append to base row key
- */
- public ListRowKey(ListRowKey parentRowKey, Object pathElement) {
- this(parentRowKey);
- this.path.add(pathElement);
- }
-
- private static ArrayList parsePath(String path) {
- ArrayList result = new ArrayList();
-
- String trimmedPath = path.trim();
-
- StringBuffer sb = new StringBuffer();
- boolean escapedState = false;
- int pathLength = trimmedPath.length();
-
- //unescape
- for (int i = 0; i < pathLength; i++) {
- char c = trimmedPath.charAt(i);
-
- if (SEPARATOR_ESCAPE_CHAR == c) {
- if (escapedState) {
- sb.append(c);
- }
- escapedState = !escapedState;
- } else {
- if (c == AbstractTreeDataModel.SEPARATOR) {
- if (escapedState) {
- sb.append(c);
- } else {
- result.add(sb.toString());
- sb = new StringBuffer();
- }
- } else {
- sb.append(c);
- }
-
- escapedState = false;
- }
- }
-
- if (sb.length() != 0) {
- result.add(sb.toString());
- }
-
- return result;
- }
-
- /**
- * List constructor
- * @param list List of strings to create corresponding row key from
- */
- public ListRowKey(List list) {
- super();
-
- this.path = new ArrayList(list);
- }
-
- /**
- * Path object constructor
- * @param path first path segment
- */
- public ListRowKey(Object path) {
- super();
- this.path = new ArrayList(1);
- this.path.add(path);
- }
-
- /**
- * Path string constructor
- * @param path path string to create corresponding row key from
- */
- public ListRowKey(String path) {
- super();
- this.path = parsePath(path);
- }
-
- public int depth() {
- return path.size();
- }
-
- public Iterator iterator() {
- return path.iterator();
- }
-
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((path == null) ? 0 : path.hashCode());
- return result;
- }
-
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- final ListRowKey other = (ListRowKey) obj;
- if (path == null) {
- if (other.path != null)
- return false;
- } else if (!path.equals(other.path))
- return false;
- return true;
- }
-
- public Iterator getSubPathIterator(int fromIndex) {
- return path.listIterator(fromIndex);
- }
-
- public boolean isSubKey(TreeRowKey rowKey) {
- if (rowKey instanceof ListRowKey) {
- ListRowKey listRowKey = (ListRowKey) rowKey;
-
- int commonLength = getCommonPathLength(listRowKey);
- if (commonLength != 0) {
- return commonLength == depth();
- } else {
- return rowKey.depth() == 0;
- }
- } else {
- return super.isSubKey(rowKey);
- }
- }
-
- public String getPath() {
- StringBuffer result = new StringBuffer();
- Iterator iterator = path.iterator();
- boolean hasNext = iterator.hasNext();
-
- while (hasNext) {
- String pathSegment = iterator.next().toString();
-
- StringBuffer escapedSubPath = new StringBuffer();
- for (int i = 0; i < pathSegment.length(); i++) {
- char ch = pathSegment.charAt(i);
-
- //escape
- if (AbstractTreeDataModel.SEPARATOR == ch || ListRowKey.SEPARATOR_ESCAPE_CHAR == ch) {
- escapedSubPath.append(ListRowKey.SEPARATOR_ESCAPE_CHAR);
- }
-
- escapedSubPath.append(ch);
- }
-
- result.append(escapedSubPath.toString());
-
- hasNext = iterator.hasNext();
-
- if (hasNext) {
- result.append(AbstractTreeDataModel.SEPARATOR);
- }
- }
-
- return result.toString();
- }
-
- public int getCommonPathLength(TreeRowKey otherRowKey) {
- if (otherRowKey == null)
- return 0;
- Iterator iterator = this.iterator();
- Iterator otherIterator = otherRowKey.iterator();
- int length = 0;
- while (iterator.hasNext() && otherIterator.hasNext()
- && iterator.next().equals(otherIterator.next()))
- length++;
- return length;
- }
-}
Deleted: branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeDataModel.java
===================================================================
--- branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeDataModel.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeDataModel.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,223 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.ajax.repeat.DataVisitor;
-import org.ajax4jsf.ajax.repeat.Range;
-import org.richfaces.component.state.TreeRange;
-
-/**
- * @author Nick Belaevski - nbelaevski at exadel.com created 16.11.2006
- *
- */
-public class TreeDataModel extends AbstractTreeDataModel {
- private TreeRowKey currentRowKey;
-
- private TreeRowKey oldRowKey;
-
- private TreeNode rowTreeData;
-
- public Object getRowKey() {
- return this.currentRowKey;
- }
-
- public void setRowKey(Object rowKey) {
- if (rowKey != null) {
- ListRowKey newRowKey = (ListRowKey) rowKey;
- this.currentRowKey = newRowKey;
- } else {
- this.currentRowKey = null;
- this.oldRowKey = null;
- this.rowTreeData = null;
- }
- }
-
-
- public void walk(FacesContext context, DataVisitor dataVisitor,
- Range range, Object rowKey, Object argument, boolean last) throws IOException {
-
- ListRowKey listRowKey = (ListRowKey) rowKey;
-
- TreeNode node = locateTreeNode(listRowKey);
-
- if (node != null) {
- TreeRange treeRange = (TreeRange) range;
-
- if (treeRange == null || treeRange.processNode(listRowKey)) {
-
- if (node.getParent() != null) {
- processElement(context, dataVisitor, argument, listRowKey, last);
- }
-
- if (treeRange == null || treeRange.processChildren(listRowKey)) {
- if (!node.isLeaf()) {
- Iterator children = node.getChildren();
-
- Map.Entry childEntry = children.hasNext() ? (Map.Entry) children.next() : null;
- TreeNode childNode;
- Object identifier;
-
- if (childEntry != null) {
- childNode = (TreeNode) childEntry.getValue();
- identifier = childEntry.getKey();
- } else {
- childNode = null;
- identifier = null;
- }
-
- do {
- Map.Entry nextChildEntry = children.hasNext() ? (Map.Entry) children.next() : null;
- TreeNode nextChildNode;
- Object nextIdentifier;
-
- if (nextChildEntry != null) {
- nextChildNode = (TreeNode) nextChildEntry.getValue();
- nextIdentifier = nextChildEntry.getKey();
- } else {
- nextChildNode = null;
- nextIdentifier = null;
- }
-
- if (childNode != null) {
-
- boolean isLast = nextChildNode == null;
-
- ListRowKey newRowKey;
- if (rowKey != null) {
- newRowKey = new ListRowKey(listRowKey, identifier);
- } else {
- newRowKey = new ListRowKey(identifier);
- }
-
- this.walk(context, dataVisitor, range, newRowKey, argument, isLast);
- }
-
- identifier = nextIdentifier;
- childNode = nextChildNode;
- } while (childNode != null);
- }
- }
- }
- }
- }
-
- protected TreeNode locateTreeNode(TreeRowKey rowKey) {
- return locateTreeNode(rowKey, false);
- }
-
- protected TreeNode locateTreeNode(TreeRowKey rowKey, boolean allowCreate) {
- boolean useCached = (rowTreeData != null && rowKey != null && rowKey.equals(this.oldRowKey));
- if (!useCached) {
- TreeNode rootNode = (TreeNode) getWrappedData();
-
- if (rootNode != null) {
- if (rowKey != null) {
- int commonPathLength = rowKey.getCommonPathLength(oldRowKey);
- if (oldRowKey == null) {
- rowTreeData = rootNode;
- } else {
- int rootOpsCount = rowKey.depth();
- int currentUpOpsCount = oldRowKey.depth() - commonPathLength;
- int currentOpsCount = currentUpOpsCount + rootOpsCount - commonPathLength;
-
- if (rootOpsCount > currentOpsCount) {
- for (int i = 0; i < oldRowKey.depth()
- - commonPathLength; i++) {
-
- rowTreeData = rowTreeData.getParent();
- }
- } else {
- commonPathLength = 0;
- rowTreeData = rootNode;
- oldRowKey = null;
- }
- }
- oldRowKey = rowKey;
- Iterator iterator = rowKey.getSubPathIterator(commonPathLength);
- while (iterator.hasNext()) {
- Object pathSegment = iterator.next();
- TreeNode childRowTreeData = rowTreeData.getChild(pathSegment);
-
- if (childRowTreeData == null) {
- if (!allowCreate) {
- return null;
- } else {
- childRowTreeData = new TreeNodeImpl();
- rowTreeData.addChild(pathSegment, childRowTreeData);
- }
- }
-
- rowTreeData = childRowTreeData;
- }
- } else {
- return rootNode;
- }
- } else {
- return null;
- }
- }
- return rowTreeData;
- }
-
- public boolean isRowAvailable() {
- TreeNode data = locateTreeNode(this.currentRowKey);
-
- if (data != null) {
- return true;
- }
-
- return false;
- }
-
- public Object getRowData() {
- TreeNode treeNode = locateTreeNode(this.currentRowKey);
- if (treeNode != null) {
- return treeNode.getData();
- }
-
- return null;
- }
-
- public boolean isLeaf() {
- TreeNode treeNode = locateTreeNode(this.currentRowKey);
- if (treeNode != null) {
- return treeNode.isLeaf();
- }
-
- throw new IllegalStateException(
- "No tree element available or row key not set!");
- }
-
- public void walkModel(FacesContext context, DataVisitor visitor, Range range, Object key, Object argument, boolean last) throws IOException {
- walk(context, visitor, range, key, argument, last);
- }
-
- public TreeNode getTreeNode() {
- return locateTreeNode(this.currentRowKey);
- }
-}
Deleted: branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeListenerEventsProducer.java
===================================================================
--- branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeListenerEventsProducer.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeListenerEventsProducer.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,53 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-import javax.faces.el.MethodBinding;
-
-import org.richfaces.component.events.NodeExpandedListener;
-import org.richfaces.component.events.NodeSelectedListener;
-
-/**
- * @author Nick Belaevski - nbelaevski at exadel.com
- * created 29.11.2006
- *
- * Base tree events interface
- */
-public interface TreeListenerEventsProducer {
- public abstract void setChangeExpandListener(MethodBinding binding);
- public abstract MethodBinding getChangeExpandListener();
-
- public abstract void setNodeSelectListener(MethodBinding binding);
- public abstract MethodBinding getNodeSelectListener();
-
- public abstract void setDropListener(MethodBinding binding);
- public abstract MethodBinding getDropListener();
-
- public abstract void setDragListener(MethodBinding binding);
- public abstract MethodBinding getDragListener();
-
- public void addNodeSelectListener(NodeSelectedListener listener);
- public void addChangeExpandListener(NodeExpandedListener listener);
-
- //TODO - rename this
- public boolean hasAjaxSubmitSelection();
-}
Deleted: branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeNode.java
===================================================================
--- branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeNode.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeNode.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,89 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-import java.io.Serializable;
-import java.util.Iterator;
-import java.util.Map;
-
-
-/**
- * @author Nick Belaevski - nbelaevski at exadel.com
- * created 16.11.2006
- * Interface representing tree ADT nodes
- */
-public interface TreeNode extends Serializable{
-
- /**
- * getter for node attached data
- * @return node attached data
- */
- public Object getData();
- /**
- * setter for node attached data
- * @param data data to set as attached node data
- */
- public void setData(Object data);
-
- /**
- * Returns whether this node is leaf
- * @return <code>true</code> if this node is leaf else returns <code>false</code>
- */
- public boolean isLeaf();
-
- /**
- * getter for children
- * @return {@link Iterator} of {@link Map.Entry} instances containing {@link TreeNode} as values
- * and their identifiers as keys
- */
- public Iterator getChildren();
- /**
- * find child by id
- * @param id identifier of the child to find
- * @return designated {@link TreeNode} instance or <code>null</code>
- */
- public TreeNode getChild(Object id);
-
- /**
- * adds child to children collection
- * @param identifier child identifier
- * @param child child
- */
- public void addChild(Object identifier, TreeNode child);
-
- /**
- * removes child from children collection by child id
- * @param id id of the child to remove
- */
- public void removeChild(Object id);
-
- /**
- * getter for parent {@link TreeNode}
- * @return parent {@link TreeNode} instance or <code>null</code> if this node is root
- */
- public TreeNode getParent();
- /**
- * setter for parent {@link TreeNode}
- * @param parent {@link TreeNode} to set as parent
- */
- public void setParent(TreeNode parent);
-}
Deleted: branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeNodeImpl.java
===================================================================
--- branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeNodeImpl.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeNodeImpl.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,82 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * @author Nick Belaevski - nbelaevski at exadel.com
- * created 16.11.2006
- * Default {@link TreeNode} implementation based on {@link LinkedHashMap} to preserve
- * elements ordering
- */
-public class TreeNodeImpl implements TreeNode {
-
- private static final long serialVersionUID = -5498990493803705085L;
- private Object data;
- private TreeNode parent;
-
- private Map childrenMap = new LinkedHashMap();
-
- public Object getData() {
- return data;
- }
-
- public TreeNode getChild(Object identifier) {
- return (TreeNode) childrenMap.get(identifier);
- }
-
- public void addChild(Object identifier, TreeNode child) {
- child.setParent(this);
- childrenMap.put(identifier, child);
- }
-
- public void removeChild(Object identifier) {
- TreeNode treeNode = (TreeNode) childrenMap.remove(identifier);
- if (treeNode != null) {
- treeNode.setParent(null);
- }
- }
-
- public void setData(Object data) {
- this.data = data;
- }
-
- public TreeNode getParent() {
- return parent;
- }
-
- public void setParent(TreeNode parent) {
- this.parent = parent;
- }
-
- public Iterator getChildren() {
- return childrenMap.entrySet().iterator();
- }
-
- public boolean isLeaf() {
- return childrenMap.isEmpty();
- }
-
-}
Deleted: branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeRowKey.java
===================================================================
--- branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeRowKey.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/tree/src/main/java/org/richfaces/component/TreeRowKey.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,85 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-import java.io.Serializable;
-import java.util.Iterator;
-
-/**
- * @author Nick Belaevski - nbelaevski at exadel.com
- * created 06.12.2006
- * Base abstract clas for all tree row keys
- */
-public abstract class TreeRowKey implements Serializable {
-
- public static final char SEPARATOR_ESCAPE_CHAR = '_';
-
- /**
- * getter for key depth
- * @return key depth
- */
- public abstract int depth();
-
- /**
- * getter for subpath iterator
- * @param fromIndex
- * @return subpath segments iterator
- */
- public abstract Iterator getSubPathIterator(int fromIndex);
-
- /**
- * getter for path string representation
- * @return path string
- */
- public abstract String getPath();
-
- public String toString() {
- return getPath();
- }
-
- /**
- * tests if specified rowKey is sub-key of this row key
- * @param rowKey
- * @return
- */
- public boolean isSubKey(TreeRowKey rowKey) {
- if (rowKey == null) {
- return false;
- }
-
- return (rowKey.getPath() + AbstractTreeDataModel.SEPARATOR).startsWith(getPath());
- }
-
- /**
- * getter for path iterator
- * @return path segments iterator
- */
- public abstract Iterator iterator();
-
- /**
- * returns this row key and otherRowKey argument row key common path segments count
- * @param otherRowKey {@link TreeRowKey} to count common path segments for
- * @return common path segmments count
- */
- public abstract int getCommonPathLength(TreeRowKey otherRowKey);
-
-}
Deleted: branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/AjaxSelectedEvent.java
===================================================================
--- branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/AjaxSelectedEvent.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/AjaxSelectedEvent.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,41 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component.events;
-
-import javax.faces.component.UIComponent;
-
-/**
- * @author Konstantin Mishin
- *
- */
-public class AjaxSelectedEvent extends NodeSelectedEvent {
-
- /**
- *
- */
- private static final long serialVersionUID = 1156974665865521208L;
-
- public AjaxSelectedEvent(UIComponent component) {
- super(component);
- }
-
-}
Deleted: branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/NodeExpandedEvent.java
===================================================================
--- branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/NodeExpandedEvent.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/NodeExpandedEvent.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,58 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component.events;
-
-import javax.faces.component.UIComponent;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-
-/**
- * @author Nick Belaevski - nbelaevski at exadel.com
- * created 27.11.2006
- *
- */
-public class NodeExpandedEvent extends FacesEvent {
-
- public NodeExpandedEvent(UIComponent component) {
- super(component);
- }
-
- /**
- *
- */
- private static final long serialVersionUID = 2620359072575831666L;
-
- /* (non-Javadoc)
- * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
- */
- public boolean isAppropriateListener(FacesListener listener) {
- return listener instanceof NodeExpandedListener;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
- */
- public void processListener(FacesListener listener) {
- ((NodeExpandedListener) listener).processExpansion(this);
- }
-
-}
Deleted: branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/NodeExpandedListener.java
===================================================================
--- branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/NodeExpandedListener.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/NodeExpandedListener.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,34 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component.events;
-
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesListener;
-
-/**
- * @author Nick Belaevski - nbelaevski at exadel.com
- * created 27.11.2006
- *
- */
-public interface NodeExpandedListener extends FacesListener {
- public void processExpansion(NodeExpandedEvent nodeExpandedEvent) throws AbortProcessingException;
-}
Deleted: branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/NodeSelectedEvent.java
===================================================================
--- branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/NodeSelectedEvent.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/NodeSelectedEvent.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,60 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component.events;
-
-import javax.faces.component.UIComponent;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-
-/**
- * @author Nick Belaevski - nbelaevski at exadel.com
- * created 27.11.2006
- *
- */
-public class NodeSelectedEvent extends FacesEvent {
-
- public NodeSelectedEvent(UIComponent component) {
- super(component);
- }
-
- /**
- *
- */
- private static final long serialVersionUID = -1292268859927735863L;
-
- /* (non-Javadoc)
- * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
- */
-
- public boolean isAppropriateListener(FacesListener listener) {
- return listener instanceof NodeSelectedListener;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
- */
-
- public void processListener(FacesListener listener) {
- ((NodeSelectedListener) listener).processSelection(this);
- }
-
-}
Deleted: branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/NodeSelectedListener.java
===================================================================
--- branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/NodeSelectedListener.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/tree/src/main/java/org/richfaces/component/events/NodeSelectedListener.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,34 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component.events;
-
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesListener;
-
-/**
- * @author Nick Belaevski - nbelaevski at exadel.com
- * created 27.11.2006
- *
- */
-public interface NodeSelectedListener extends FacesListener {
- public void processSelection(NodeSelectedEvent nodeSelectedEvent) throws AbortProcessingException;
-}
Deleted: branches/refactor/ui/tree/src/main/java/org/richfaces/component/state/TreeRange.java
===================================================================
--- branches/refactor/ui/tree/src/main/java/org/richfaces/component/state/TreeRange.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/tree/src/main/java/org/richfaces/component/state/TreeRange.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,35 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component.state;
-
-import org.ajax4jsf.ajax.repeat.Range;
-import org.richfaces.component.TreeRowKey;
-
-/**
- * @author Nick Belaevski - nbelaevski at exadel.com
- * created 23.11.2006
- *
- */
-public interface TreeRange extends Range {
- public boolean processNode(TreeRowKey rowKey);
- public boolean processChildren(TreeRowKey rowKey);
-}
Deleted: branches/refactor/ui/tree/src/main/java/org/richfaces/component/state/TreeStateAdvisor.java
===================================================================
--- branches/refactor/ui/tree/src/main/java/org/richfaces/component/state/TreeStateAdvisor.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/tree/src/main/java/org/richfaces/component/state/TreeStateAdvisor.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,60 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component.state;
-
-import org.richfaces.component.UITree;
-
-
-/**
- * @author Nick Belaevski - mailto:nbelaevski at exadel.com
- * created 19.06.2007
- *
- * This interface is intended to "advising" changes to tree state. Tree component should queue user-provided
- * instance of the interface for changes during RENDER_RESPONSE phase. Changes advised by user should be
- * immediately applied. Advisor methods are provided with {@link UITree} component instance to queue current
- * tree state.
- */
-public interface TreeStateAdvisor {
- /**
- * Advises new node opened/closed state
- * @param tree {@link UITree} component state to queue state
- * @return
- * <ul>
- * <li><code>null</code> if changes are not needed</li>
- * <li>{@link Boolean#TRUE} to advise node to be opened</li>
- * <li>{@link Boolean#FALSE} to advise node to be closed</li>
- * </ul>
- */
- public Boolean adviseNodeOpened(UITree tree);
-
- /**
- * Advises new node selection
- * @param tree {@link UITree} component state to queue state
- * @return
- * <ul>
- * <li><code>null</code> if changes are not needed</li>
- * <li>{@link Boolean#TRUE} to advise current node to be selected</li>
- * <li>{@link Boolean#FALSE} to advise current node to be unselected</li>
- * </ul>
- */
- public Boolean adviseNodeSelected(UITree tree);
-}
Deleted: branches/refactor/ui/tree/src/main/java/org/richfaces/component/xml/XmlNodeData.java
===================================================================
--- branches/refactor/ui/tree/src/main/java/org/richfaces/component/xml/XmlNodeData.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/tree/src/main/java/org/richfaces/component/xml/XmlNodeData.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,82 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component.xml;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Nick Belaevski - nbelaevski at exadel.com
- * created 16.11.2006
- *
- */
-public class XmlNodeData implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = 8320619478974873168L;
-
- private String namespace;
-
- private String name = "";
-
- private String text;
-
- private Map attributes = new HashMap();
-
- public Map getAttributes() {
- return attributes;
- }
-
- public void setAttribute(String key, Object value) {
- this.attributes.put(key, value);
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setText(String text) {
- this.text = text;
- }
-
- public String getText() {
- return text != null ? text : "";
- }
-
- public void setNamespace(String namespace) {
- this.namespace = namespace;
- }
-
- public String getNamespace() {
- return namespace;
- }
-
- public String toString() {
- return getName() + "{" + attributes.toString() + " <" + getText().trim() + ">" + "}";
- }
-}
Deleted: branches/refactor/ui/tree/src/main/java/org/richfaces/component/xml/XmlTreeDataBuilder.java
===================================================================
--- branches/refactor/ui/tree/src/main/java/org/richfaces/component/xml/XmlTreeDataBuilder.java 2007-06-28 19:16:41 UTC (rev 1385)
+++ branches/refactor/ui/tree/src/main/java/org/richfaces/component/xml/XmlTreeDataBuilder.java 2007-06-28 19:18:37 UTC (rev 1386)
@@ -1,164 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component.xml;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.digester.Digester;
-import org.apache.commons.digester.RulesBase;
-import org.richfaces.component.TreeNode;
-import org.richfaces.component.TreeNodeImpl;
-import org.xml.sax.Attributes;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * @author Nick Belaevski - nbelaevski at exadel.com
- * created 16.11.2006
- *
- */
-public class XmlTreeDataBuilder {
-
- private final static class Rule extends org.apache.commons.digester.Rule {
- private int level = -1;
- private List idsList = new ArrayList();
- private List treeNodesList = new ArrayList();
- private List exclusionSets = new ArrayList();
- private TreeNode treeNode = new TreeNodeImpl(); //add empty node to serve as root
-
- public void begin(String namespace, String name, Attributes attributes)
- throws Exception {
- super.begin(namespace, name, attributes);
-
- level++;
-
- XmlNodeData xmlNodeData = new XmlNodeData();
- xmlNodeData.setName(name);
- xmlNodeData.setNamespace(namespace);
-
- String id = null;
-
- if (attributes != null) {
- int length = attributes.getLength();
- for (int i = 0; i < length; i++) {
- xmlNodeData.setAttribute(attributes.getQName(i),
- attributes.getValue(i));
-
- }
-
- id = attributes.getValue("id");
- }
-
- if (exclusionSets.size() == level) {
- exclusionSets.add(null);
- }
-
- if (id == null || id.length() == 0) {
- int currentId = 0;
-
- if (idsList.size() <= level) {
- for (int i = idsList.size(); i <= level; i++) {
- idsList.add(null);
- }
- } else {
- Integer integer = (Integer) idsList.get(level);
- currentId = integer.intValue() + 1;
- }
-
- Set exclusions = (Set) exclusionSets.get(level);
-
- while (exclusions != null && exclusions.contains(Integer.toString(currentId))) {
- currentId++;
- }
-
- idsList.set(level, new Integer(currentId));
-
- id = Integer.toString(currentId);
- } else {
- Set exclusions = (Set) exclusionSets.get(level);
- if (exclusions == null) {
- exclusions = new HashSet();
-
- exclusionSets.set(level, exclusions);
- }
-
- exclusions.add(id);
- }
-
- TreeNode node = new TreeNodeImpl();
- node.setData(xmlNodeData);
-
- this.treeNode.addChild(id, node);
- this.treeNodesList.add(this.treeNode);
- this.treeNode = node;
- }
-
- public void body(String namespace, String name, String text)
- throws Exception {
- super.body(namespace, name, text);
-
- if (text != null) {
- ((XmlNodeData) this.treeNode.getData()).setText(text.trim());
- }
- }
-
- public void end(String namespace, String name) throws Exception {
- super.end(namespace, name);
-
- level--;
-
- if (idsList.size() - 1 > level + 1) {
- //idsList grew larger than we really need
- idsList.remove(idsList.size() - 1);
- }
-
- if (exclusionSets.size() - 1 > level + 1) {
- //the same condition as above
- exclusionSets.remove(exclusionSets.size() - 1);
- }
-
- this.treeNode = (TreeNode) this.treeNodesList.remove(this.treeNodesList.size() - 1);
- }
- }
-
- public static TreeNode build(InputSource inputSource) throws SAXException, IOException {
- Digester digester = new Digester();
- Rule rule = new Rule();
- final List rulesList = new ArrayList(1);
- rulesList.add(rule);
-
- RulesBase rulesBase = new RulesBase() {
- protected List lookup(String namespace, String name) {
- return rulesList;
- }
- };
- digester.setRules(rulesBase);
- digester.setNamespaceAware(true);
- digester.parse(inputSource);
-
- return rule.treeNode;
- }
-}
More information about the richfaces-svn-commits
mailing list