Author: maksimkaszynski
Date: 2007-06-04 12:52:20 -0400 (Mon, 04 Jun 2007)
New Revision: 1003
Removed:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/model/visual/
Modified:
trunk/sandbox/scrollable-grid/src/main/config/component/scrollable-grid.xml
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGridColumn.java
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/model/ScrollableGridDataModel.java
Log:
removed visual model
Modified: trunk/sandbox/scrollable-grid/src/main/config/component/scrollable-grid.xml
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/config/component/scrollable-grid.xml 2007-06-04
15:52:18 UTC (rev 1002)
+++ trunk/sandbox/scrollable-grid/src/main/config/component/scrollable-grid.xml 2007-06-04
16:52:20 UTC (rev 1003)
@@ -44,12 +44,6 @@
<defaultvalue>"700px"</defaultvalue>
</property>
- <property attachedstate="true">
- <name>visualModel</name>
- <classname>org.richfaces.model.visual.ScrollableGridVisualModel</classname>
- <description>Visual model for data grid</description>
- </property>
-
&ui_component_attributes;
</component>
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java 2007-06-04
15:52:18 UTC (rev 1002)
+++
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java 2007-06-04
16:52:20 UTC (rev 1003)
@@ -11,7 +11,6 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
import javax.faces.event.PhaseId;
@@ -32,9 +31,6 @@
import org.richfaces.model.SortOrder;
import org.richfaces.model.impl.ArrayDataModelExt;
import org.richfaces.model.impl.ListDataModelExt;
-import org.richfaces.model.snapshot.ObjectLocator;
-import org.richfaces.model.visual.DefaultGridVisualModel;
-import org.richfaces.model.visual.ScrollableGridVisualModel;
@@ -54,16 +50,22 @@
private transient Collection partialUpdateChildren;
- private ScrollableGridVisualModel visualModel;
-
private Collection responseData = new ArrayList();
+
+ private SortOrder sortOrder;
-
-
public Collection getResponseData() {
return responseData;
}
+ public SortOrder getSortOrder() {
+ return sortOrder;
+ }
+
+ public void setSortOrder(SortOrder sortOrder) {
+ this.sortOrder = sortOrder;
+ }
+
public void setResponseData(Collection responseData) {
this.responseData = responseData;
}
@@ -94,7 +96,7 @@
}
BufferedSequenceRange range = new BufferedSequenceRange(curentRow,rows);
- range.setSortOrder(getVisualModel().getSortOrder());
+ range.setSortOrder(getSortOrder());
return range;
}
@@ -113,72 +115,12 @@
} else if (value instanceof Object []) {
model = new ArrayDataModelExt((Object[]) value);
} else {
- model = new ArrayDataModelExt(new Object[]{});
+ model = new ArrayDataModelExt(new Object[]{value});
}
return model;
}
- public ScrollableGridVisualModel getVisualModel() {
-
- FacesContext context = getFacesContext();
- boolean needToUpdateBinding = false;
- ValueBinding valueExpression = getValueBinding("visualModel");
- if (valueExpression != null) {
-
- ScrollableGridVisualModel viModel = (ScrollableGridVisualModel)
valueExpression.getValue(context);
- if(viModel == null) {
- needToUpdateBinding = true;
- } else {
- setUpVisualModel(viModel);
- return viModel;
- }
- }
-
- if (visualModel == null) {
- visualModel = new DefaultGridVisualModel();
- setUpVisualModel(visualModel);
-
- if (needToUpdateBinding) {
- valueExpression.setValue(context, visualModel);
- }
- }
-
- return visualModel;
- }
-
- private void setUpVisualModel(ScrollableGridVisualModel visualModel) {
-
- }
-
- public void setVisualModel(ScrollableGridVisualModel visualModel) {
- if (visualModel != null) {
- ValueBinding valueExpression = getValueBinding("visualModel");
- if (valueExpression != null) {
- ScrollableGridVisualModel anotherModel =
- (ScrollableGridVisualModel) valueExpression.getValue(getFacesContext());
- if (anotherModel == null) {
- valueExpression.setValue(getFacesContext(), visualModel);
- }
- }
- }
- this.visualModel = visualModel;
-
- }
-
- public void setSortOrder(SortOrder sortOrder) {
- getVisualModel().setSortOrder(sortOrder);
- Object value = getValue();
- if (value instanceof ScrollableGridDataModel) {
- ScrollableGridDataModel gridDataModel = (ScrollableGridDataModel) value;
- gridDataModel.setSortOrder(sortOrder);
- }
- }
-
- public SortOrder getSortOrder() {
- return getVisualModel().getSortOrder();
- }
-
public Integer getDataIndex() {
return _dataIndex;
}
@@ -211,6 +153,7 @@
values[2] = _startRow;
values[3] = _dataIndex;
values[4] = responseData;
+ values[5] = saveAttachedState(context, sortOrder);
return (Object)values;
@@ -224,6 +167,7 @@
_startRow = (Integer)values[2];
_dataIndex = (Integer)values[3];
responseData = (Collection)values[4];
+ sortOrder = (SortOrder) restoreAttachedState(context, values[5]);
}
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGridColumn.java
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGridColumn.java 2007-06-04
15:52:18 UTC (rev 1002)
+++
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGridColumn.java 2007-06-04
16:52:20 UTC (rev 1003)
@@ -5,13 +5,8 @@
import java.util.Iterator;
-import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-
import org.richfaces.event.sort.SortListener;
import org.richfaces.event.sort.SortSource;
-import org.richfaces.model.visual.ColumnVisualModel;
-import org.richfaces.model.visual.DefaultColumnVisualModel;
/**
* @author Anton Belevich
@@ -19,12 +14,7 @@
*/
public abstract class UIScrollableGridColumn extends UIColumn implements SortSource{
- private ColumnVisualModel visualModel;
- static final class AutoCreatedVisualModel extends DefaultColumnVisualModel{
- private static final long serialVersionUID = 8528834472198966115L;
- }
-
public Iterator getChildIterator(){
return getChildren().iterator();
}
@@ -45,31 +35,6 @@
removeFacesListener(listener);
}
- /**
- * @return the visualModel
- */
- public ColumnVisualModel getVisualModel() {
-
- ValueBinding valueExpression = getValueBinding("visualModel");
- if (valueExpression != null) {
- return (ColumnVisualModel)
valueExpression.getValue(FacesContext.getCurrentInstance());
- }
-
- if (visualModel == null) {
- visualModel = new AutoCreatedVisualModel();
- }
-
- return visualModel;
- }
-
- /**
- * @param visualModel the visualModel to set
- */
- public void setVisualModel(ColumnVisualModel visualModel) {
- this.visualModel = visualModel;
- }
-
-
public abstract boolean isSortable();
public abstract void setSortable(boolean sortable);
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/model/ScrollableGridDataModel.java
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/model/ScrollableGridDataModel.java 2007-06-04
15:52:18 UTC (rev 1002)
+++
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/model/ScrollableGridDataModel.java 2007-06-04
16:52:20 UTC (rev 1003)
@@ -184,18 +184,6 @@
}
}
-// public Collection getSelectedObjects() {
-// return SelectionExtractor.extractSelection(this);
-// }
-//
-// public void setSelection(Selection selection) {
-// this.selection = selection;
-// }
-//
-// public Selection getSelection() {
-// return selection;
-// }
-
public SerializableDataModel getSerializableModel(Range range) {
BufferedSequenceRange sequenceRange = (BufferedSequenceRange) range;
ObjectLocator locator = getObjectLocator();
@@ -205,11 +193,4 @@
return super.getSerializableModel(range);
}
- public SortOrder getSortOrder() {
- return sortOrder;
- }
-
- public void setSortOrder(SortOrder sortOrder) {
- this.sortOrder = sortOrder;
- }
}
\ No newline at end of file
Show replies by date