You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ha...@apache.org on 2008/07/01 15:04:19 UTC
svn commit: r673078 - in
/myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow:
./ SelectOneRowList.java SimpleCar.java
Author: hazems
Date: Tue Jul 1 06:04:19 2008
New Revision: 673078
URL: http://svn.apache.org/viewvc?rev=673078&view=rev
Log:
promoting the selectOneRow component to Tomahawk
http://issues.apache.org/jira/browse/TOMAHAWK-1293
Added:
myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow/
myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow/SelectOneRowList.java
myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow/SimpleCar.java
Added: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow/SelectOneRowList.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow/SelectOneRowList.java?rev=673078&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow/SelectOneRowList.java (added)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow/SelectOneRowList.java Tue Jul 1 06:04:19 2008
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.examples.selectOneRow;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ValueChangeEvent;
+
+import org.apache.myfaces.custom.datascroller.ScrollerActionEvent;
+
+/**
+ * DOCUMENT ME!
+ * @author Ernst Fastl
+ * @version
+ */
+public class SelectOneRowList
+{
+ private List _list = new ArrayList();
+
+ private Long _selectedRowIndex;
+
+ public Long getSelectedRowIndex()
+ {
+ return _selectedRowIndex;
+ }
+
+ public void setSelectedRowIndex(Long selectedRowIndex)
+ {
+ _selectedRowIndex = selectedRowIndex;
+ }
+
+ public String getSelectionMessage()
+ {
+ if(getSelectedRowIndex()==null)
+ {
+ return "Currently there is no Row selected!";
+ }
+ else
+ {
+ return "Row number: " + _selectedRowIndex.toString() + " selected!";
+ }
+ }
+
+ public SelectOneRowList()
+ {
+ for (int i = 1; i < 10; i++)
+ {
+ _list.add(new SimpleCar(i, "Car Type " + i, "blue"));
+ _list.add(new SimpleCar(i, "Car Type " + i, "red"));
+ _list.add(new SimpleCar(i, "Car Type " + i, "green"));
+ _list.add(new SimpleCar(i, "Car Type " + i, "black"));
+ _list.add(new SimpleCar(i, "Car Type " + i, "white"));
+ }
+ }
+
+ public List getList()
+ {
+ return _list;
+ }
+
+ public void scrollerAction(ActionEvent event)
+ {
+ ScrollerActionEvent scrollerEvent = (ScrollerActionEvent) event;
+ FacesContext.getCurrentInstance().getExternalContext().log(
+ "scrollerAction: facet: "
+ + scrollerEvent.getScrollerfacet()
+ + ", pageindex: "
+ + scrollerEvent.getPageIndex());
+ }
+
+ public void processRowSelection(ValueChangeEvent event)
+ {
+ Long newVal = (Long) event.getNewValue();
+ }
+
+}
Added: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow/SimpleCar.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow/SimpleCar.java?rev=673078&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow/SimpleCar.java (added)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/selectOneRow/SimpleCar.java Tue Jul 1 06:04:19 2008
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.examples.selectOneRow;
+
+import java.io.Serializable;
+
+/**
+ * DOCUMENT ME!
+ * @author Thomas Spiegl (latest modification by $Author: werpu $)
+ * @version $Revision: 371731 $ $Date: 2006-01-24 01:18:44 +0100 (Di, 24 Jän 2006) $
+ */
+public class SimpleCar
+ implements Serializable
+{
+ /**
+ * serial id for serialisation versioning
+ */
+ private static final long serialVersionUID = 1L;
+ private int _id;
+ private String _type;
+ private String _color;
+
+ public SimpleCar(int id, String type, String color)
+ {
+ _id = id;
+ _type = type;
+ _color = color;
+ }
+
+ public int getId()
+ {
+ return _id;
+ }
+
+ public void setId(int id)
+ {
+ _id = id;
+ }
+
+ public String getType()
+ {
+ return _type;
+ }
+
+ public void setType(String type)
+ {
+ _type = type;
+ }
+
+ public String getColor()
+ {
+ return _color;
+ }
+
+ public void setColor(String color)
+ {
+ _color = color;
+ }
+}