You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-commits@incubator.apache.org by ma...@apache.org on 2007/03/29 07:51:08 UTC
svn commit: r523607 [3/14] - in /incubator/adffaces/trunk/trinidad:
trinidad-assembly/ trinidad-assembly/src/ trinidad-assembly/src/main/
trinidad-assembly/src/main/assembly/ trinidad-assembly/src/main/resources/
trinidad-examples/ trinidad-examples/bl...
Added: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentEditorHandler.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentEditorHandler.java?view=auto&rev=523607
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentEditorHandler.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentEditorHandler.java Thu Mar 29 00:50:53 2007
@@ -0,0 +1,322 @@
+/*
+ * 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.trinidaddemo;
+
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+
+import java.lang.reflect.Method;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import javax.faces.component.UIComponent;
+
+public class ComponentEditorHandler
+{
+ public String update()
+ {
+ List<PropertyOfComponent> list = _list;
+ if (list != null)
+ {
+ for(PropertyOfComponent prop : list)
+ {
+ prop.flushToComponent();
+ }
+ }
+
+ return null;
+ }
+
+ public void setComponent(UIComponent component)
+ {
+ _editedComponent = component;
+ }
+
+ public UIComponent getComponent()
+ {
+ return _editedComponent;
+ }
+
+ public boolean isJavascriptShown()
+ {
+ return _javascriptShown;
+ }
+
+ public void setJavascriptShown(boolean javascriptShown)
+ {
+ _javascriptShown = javascriptShown;
+ }
+
+ public List<PropertyOfComponent> getAttributes()
+ {
+ if (_list != null)
+ return _list;
+
+ UIComponent comp = getComponent();
+ if (comp == null)
+ return null;
+
+ List<PropertyOfComponent> list = new ArrayList<PropertyOfComponent>();
+ try
+ {
+ BeanInfo beanInfo = Introspector.getBeanInfo(comp.getClass());
+ PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
+ for (int i = 0; i < descriptors.length; i++)
+ {
+ PropertyDescriptor descriptor = descriptors[i];
+ // "Write-only" properties - no go
+ if (descriptor.getReadMethod() == null)
+ continue;
+
+ PropertyOfComponent poc = null;
+
+ boolean readOnly = descriptor.getWriteMethod() == null;
+ if (readOnly)
+ continue;
+
+ // For now, skip any attributes with ValueBindings
+ String name = descriptor.getName();
+ if (comp.getValueBinding(name) != null)
+ continue;
+
+
+ Class<?> type = descriptor.getPropertyType();
+ if ((type == String.class) ||
+ (type == Object.class))
+ {
+ if (!isJavascriptShown() &&
+ name.startsWith("on"))
+ continue;
+
+ poc = new StringProperty(comp, descriptor);
+ }
+ else if ((type == Integer.class) ||
+ (type == Integer.TYPE))
+ {
+ poc = new IntegerProperty(comp, descriptor);
+ }
+ else if ((type == Boolean.class) ||
+ (type == Boolean.TYPE))
+ {
+ poc = new BooleanProperty(comp, descriptor);
+ }
+ else if (type == Date.class)
+ {
+ poc = new DateProperty(comp, descriptor);
+ }
+
+ if (poc != null)
+ list.add(poc);
+ }
+
+ // Sort the list by property name
+ Collections.sort(list);
+
+ _list = list;
+
+ return list;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ static public class PropertyOfComponent implements Comparable<PropertyOfComponent>
+ {
+ public PropertyOfComponent(UIComponent component,
+ PropertyDescriptor descriptor)
+ {
+ _component = component;
+ _descriptor = descriptor;
+ }
+
+ // Sort by the name of the property
+ public int compareTo(PropertyOfComponent poc)
+ {
+ return getName().compareTo(poc.getName());
+ }
+
+ public String getName()
+ {
+ return _descriptor.getName();
+ }
+
+ public String getType()
+ {
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void flushToComponent()
+ {
+ if (_valueSet)
+ _component.getAttributes().put(getName(), _value);
+ }
+
+ protected Object getBeanProperty()
+ {
+ Method method = _descriptor.getReadMethod();
+ try
+ {
+ return method.invoke(_component, (Object[])null);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ return getProperty();
+ }
+
+
+ protected Object getProperty()
+ {
+ return _component.getAttributes().get(getName());
+ }
+
+ protected void setProperty(Object value)
+ {
+ if ("".equals(value))
+ value = null;
+
+ _valueSet = true;
+ _value = value;
+ }
+
+ private boolean _valueSet = false;
+ private Object _value = null;
+ private final PropertyDescriptor _descriptor;
+ private final UIComponent _component;
+ }
+
+ static public class IntegerProperty extends PropertyOfComponent
+ {
+ public IntegerProperty(UIComponent component, PropertyDescriptor descriptor)
+ {
+ super(component, descriptor);
+ }
+
+ public Integer getValue()
+ {
+ return (Integer) getProperty();
+ }
+
+ public void setValue(Integer i)
+ {
+ setProperty(i);
+ }
+
+ @Override
+ public String getType()
+ {
+ return "integer";
+ }
+ }
+
+
+ static public class DateProperty extends PropertyOfComponent
+ {
+ public DateProperty(UIComponent component, PropertyDescriptor descriptor)
+ {
+ super(component, descriptor);
+ }
+
+ public Date getValue()
+ {
+ return (Date) getProperty();
+ }
+
+ public void setValue(Date i)
+ {
+ setProperty(i);
+ }
+
+ @Override
+ public String getType()
+ {
+ return "date";
+ }
+ }
+
+
+ static public class StringProperty extends PropertyOfComponent
+ {
+ public StringProperty(UIComponent component, PropertyDescriptor descriptor)
+ {
+ super(component, descriptor);
+ }
+
+ public String getValue()
+ {
+ Object o = getProperty();
+ if (o == null)
+ return null;
+ return o.toString();
+ }
+
+ public void setValue(String s)
+ {
+ setProperty(s);
+ }
+
+ @Override
+ public String getType()
+ {
+ return "string";
+ }
+ }
+
+
+
+ static public class BooleanProperty extends PropertyOfComponent
+ {
+ public BooleanProperty(UIComponent component, PropertyDescriptor descriptor)
+ {
+ super(component, descriptor);
+ }
+
+ public Boolean getValue()
+ {
+ return (Boolean) getBeanProperty();
+ }
+
+ public void setValue(Boolean b)
+ {
+ setProperty(b);
+ }
+
+ @Override
+ public String getType()
+ {
+ return "boolean";
+ }
+ }
+
+
+ private UIComponent _editedComponent;
+ private boolean _javascriptShown = true;
+ private List<PropertyOfComponent> _list;
+}
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentEditorHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentEditorHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentTree.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentTree.java?view=auto&rev=523607
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentTree.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentTree.java Thu Mar 29 00:50:53 2007
@@ -0,0 +1,276 @@
+/*
+ * 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.trinidaddemo;
+
+import java.io.Serializable;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.StringTokenizer;
+
+import javax.faces.component.UIComponent;
+
+import org.apache.myfaces.trinidad.component.UIXTree;
+import org.apache.myfaces.trinidad.model.RowKeySetTreeImpl;
+
+/**
+ * Creates a tree of components from a flat list of jspx files in a folder.
+ * @author Arjuna Wijeyekoon
+ */
+public class ComponentTree
+{
+ // public no-arg constructor needed for managed-bean.
+ public ComponentTree()
+ {
+ }
+
+ public List<Bean> getComponents()
+ {
+ if (_components == null)
+ {
+ Node root = new Node();
+ List<String> files = getFileList();
+ for(int i=0; i<files.size(); i++)
+ {
+ String file = files.get(i);
+ try
+ {
+ _processFile(root, file);
+ }
+ catch(RuntimeException e)
+ {
+ throw new RuntimeException("error with filename:"+file, e);
+ }
+ }
+ setFileList(null);
+ _components = _createChildList(root, "");
+ }
+ return _components;
+ }
+
+ public List<String> getFileList()
+ {
+ return _fileList;
+ }
+
+ public void setFileList(List<String> files)
+ {
+ _fileList = files;
+ }
+
+ public UIComponent getTree()
+ {
+ // this bean's lifecycle is application. this method is called
+ // per user, so don't change any state on this bean.
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void setTree(UIComponent treeComp)
+ {
+ // this bean's lifecycle is application. this method is called
+ // per user, so don't change any state on this bean.
+ UIXTree tree = (UIXTree) treeComp;
+ Map<String, Object> attrs = tree.getAttributes();
+ final String _key = "org.apache.myfaces.trinidaddemo.vuew.faces.ComponentTree";
+ // has this tree been initialized?
+ if (attrs.get(_key) == null)
+ {
+ // tree has not been initialized.
+ attrs.put(_key, Boolean.TRUE); // mark as initialized
+ RowKeySetTreeImpl state = new RowKeySetTreeImpl(true);
+ tree.setDisclosedRowKeys(state);
+ }
+ }
+
+// private static File _getFile(String path)
+// {
+// if (path == null)
+// throw new NullPointerException("path");
+// FacesContext fContext = FacesContext.getCurrentInstance();
+// ServletContext sContext =
+// (ServletContext) fContext.getExternalContext().getContext();
+// String pathString = sContext.getRealPath(path);
+// return new File(pathString);
+// }
+
+ private static void _processFile(Node node, String filename)
+ {
+ StringTokenizer tokens = _getTokens(filename);
+ while(tokens.hasMoreTokens())
+ {
+ String token = tokens.nextToken();
+ // check to see if the token is a delimiter. Delimiters are a single char:
+ if (token.length() == 1)
+ {
+ char ch = token.charAt(0);
+ if (ch == '.')
+ {
+ node.filename = filename;
+ break;
+ }
+ String next = tokens.nextToken();
+ token += next;
+ }
+ node = _procureChildNode(node, token);
+ }
+ }
+
+ // Create or get a child node, under the specified parent node.
+ // the specified token string is used as the key to store the child
+ // under.
+ private static Node _procureChildNode(Node parent, String token)
+ {
+ Map<String, Node> parentMap = parent.kids;
+ if (parentMap == null)
+ {
+ parentMap = new HashMap<String, Node>(3);
+ parent.kids = parentMap;
+ }
+
+ Node childNode = parentMap.get(token);
+ if (childNode == null)
+ {
+ childNode = new Node();
+ parentMap.put(token, childNode);
+ }
+ return childNode;
+ }
+
+ private static StringTokenizer _getTokens(String filename)
+ {
+ StringTokenizer tokens =
+ new StringTokenizer(filename, "ABCDEFGHIJKLMNOPQRSTUVWXYZ._", true);
+ return tokens;
+ }
+
+ private static List<Bean> _createChildList(Node root, String label)
+ {
+ Map<String, Node> kids = root.kids;
+ if (kids == null)
+ {
+ return null;
+ }
+ else
+ {
+ List<Bean> kidList = new ArrayList<Bean>(kids.size());
+ for(Entry<String, Node> entry : kids.entrySet())
+ {
+ kidList.add(new Bean(label + entry.getKey(), entry.getValue()));
+ }
+
+ Collections.sort(kidList);
+ return kidList;
+ }
+ }
+
+ // must be public for introspection; must be serializable
+ // for storing on the session.
+ public static final class Bean implements Comparable<Bean>, Serializable
+ {
+ // No-arg constructor just for serialization
+ public Bean()
+ {
+ }
+
+ public Bean(String label, Node node)
+ {
+ String fn = node.filename;
+ List<Bean> kids = _createChildList(node, label);
+ // if this bean has no demo, and it has only one child, then pull
+ // the child up to this bean's level:
+ if ((fn==null) && (kids != null) && (kids.size() == 1))
+ {
+ Bean child = kids.get(0);
+ fn = child.getFilename();
+ _token = child.getLabel();
+ kids = null;
+ }
+ else
+ {
+ _token = label;
+ }
+
+ _filename = fn;
+ _kids = kids;
+ }
+
+ public int compareTo(Bean obj)
+ {
+ return getLabel().compareTo(obj.getLabel());
+ }
+
+ /**
+ * Some demos are not components. They are additional demos of
+ * other components. EG: table_selection.jspx
+ */
+ public boolean isExample()
+ {
+ if (_filename == null)
+ return false;
+ return (_filename.indexOf('_') > 0);
+ }
+
+ public String getFilename()
+ {
+ return _filename;
+ }
+
+ public String getViewId()
+ {
+ return "/components/" +_filename;
+ }
+
+ public String getLabel()
+ {
+ return _token;
+ }
+
+ public List<Bean> getComponents()
+ {
+ return _kids;
+ }
+
+ public String view()
+ {
+ if (_filename == null)
+ return null;
+
+ String action = _filename.substring(0, _filename.lastIndexOf('.'));
+ return "guide."+action;
+ }
+
+ private String _filename;
+ private String _token;
+ private List<Bean> _kids;
+ }
+
+ private static final class Node
+ {
+ public String filename = null;
+ public Map<String, Node> kids = null;
+ }
+
+ private List<Bean> _components = null;
+ private List<String> _fileList = null;
+}
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentTree.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentTree.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ConverterValidatorBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ConverterValidatorBean.java?view=auto&rev=523607
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ConverterValidatorBean.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ConverterValidatorBean.java Thu Mar 29 00:50:53 2007
@@ -0,0 +1,76 @@
+/*
+ * 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.trinidaddemo;
+
+import java.io.Serializable;
+
+public class ConverterValidatorBean implements Serializable
+{
+ public ConverterValidatorBean()
+ {
+ }
+
+ public Number getCurrencyValue()
+ {
+ return _currencyValue;
+ }
+
+ public void setCurrencyValue(Number value)
+ {
+ _currencyValue = value;
+ }
+
+ public Number getIntegerOnlyValue()
+ {
+ return _intOnlyValue;
+ }
+
+ public void setIntegerOnlyValue(Number value)
+ {
+ _intOnlyValue = value;
+ }
+
+ public void setPercentValue(Number value)
+ {
+ _percentValue = value;
+ }
+
+ public Number getPercentValue()
+ {
+ return _percentValue;
+ }
+
+ public Number getGroupValue()
+ {
+ return _groupValue;
+ }
+
+ public void setGroupValue(Number value)
+ {
+ _groupValue = value;
+ }
+
+ private Number _currencyValue = new Double(78.57);
+
+ private Number _intOnlyValue = new Double(99.99);
+
+ private Number _percentValue = new Double(0.55);
+
+ private Number _groupValue = new Double(77777.89);
+}
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ConverterValidatorBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ConverterValidatorBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CustomMessageConvertValidateBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CustomMessageConvertValidateBean.java?view=auto&rev=523607
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CustomMessageConvertValidateBean.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CustomMessageConvertValidateBean.java Thu Mar 29 00:50:53 2007
@@ -0,0 +1,169 @@
+/*
+ * 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.trinidaddemo;
+
+import java.awt.Color;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+public class CustomMessageConvertValidateBean implements java.io.Serializable
+{
+ public CustomMessageConvertValidateBean()
+ {
+ _date1 = new Date();
+ _date2 = new Date();
+ _minDate = new Date(System.currentTimeMillis() - 24 * 60 * 60 * 1000);
+ _maxDate = new Date();
+
+ _messages.put("DOB_REQD_ID","You should specify \"{0}\" to apply for license");
+ _messages.put("PIN_NO_MATCH_ID","Value \"{1}\" is not a valid \"{0}\". It should be a valid three digit number, first digit not being zero. The expected pattern is \"{2}\".");
+ }
+
+
+ public String action()
+ {
+ return "success";
+ }
+
+ public Date getDate1()
+ {
+ return _date1;
+ }
+
+ public void setDate1(Date date)
+ {
+ _date1 = date;
+ }
+
+ public Date getDate2()
+ {
+ return _date2;
+ }
+
+ public void setDate2(Date date)
+ {
+ _date2 = date;
+ }
+
+ public void setMinDate(Date minDate)
+ {
+ _minDate = minDate;
+ }
+
+ public Date getMinDate()
+ {
+ return _minDate;
+ }
+
+ public void setMaxDate(Date maxDate)
+ {
+ _maxDate = maxDate;
+ }
+
+ public Date getMaxDate()
+ {
+ return _maxDate;
+ }
+
+ public Date getCurrentDate()
+ {
+ return new Date();
+ }
+
+ public void setCurrentDate(Date date)
+ {
+ return;
+ }
+
+ public String getRegExpValue()
+ {
+ return _regExpValue;
+ }
+
+ public void setRegExpValue(String regExpValue)
+ {
+ _regExpValue = regExpValue;
+ }
+
+ public String getByteLengthValue()
+ {
+ return _byteLegthValue;
+ }
+
+ public void setByteLengthValue(String value)
+ {
+ _byteLegthValue = value;
+ }
+
+ public Color getColor()
+ {
+ return _color;
+ }
+
+ public void setColor(Color colorValue)
+ {
+ _color = colorValue;
+ }
+
+ public Map<String, String> getMessages()
+ {
+ return _messages;
+ }
+
+ public String getMinDateTip()
+ {
+ if (_dft instanceof SimpleDateFormat)
+ {
+ ((SimpleDateFormat)_dft).applyPattern("M/d/yyyy");
+ }
+ return _dft.format(_minDate);
+ }
+
+ public String getMaxDateTip()
+ {
+ if (_dft instanceof SimpleDateFormat)
+ {
+ ((SimpleDateFormat)_dft).applyPattern("M/d/yyyy");
+ }
+ return _dft.format(_maxDate);
+ }
+
+
+ private DateFormat _dft = DateFormat.getDateInstance();
+
+ private Map<String, String> _messages = new HashMap<String, String>();
+
+ private Color _color = new Color(255,0,0);
+
+ private String _byteLegthValue = null;
+
+ private String _regExpValue = null;
+
+ private Date _date1;
+
+ private Date _date2;
+
+ private Date _minDate;
+
+ private Date _maxDate;
+
+}
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CustomMessageConvertValidateBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CustomMessageConvertValidateBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DataBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DataBean.java?view=auto&rev=523607
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DataBean.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DataBean.java Thu Mar 29 00:50:53 2007
@@ -0,0 +1,88 @@
+/*
+ * 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.trinidaddemo;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.trinidad.context.RequestContext;
+
+public class DataBean implements java.io.Serializable
+{
+ public DataBean()
+ {
+ // This isn't thread-safe. I don't care. :)
+ _int = _sCount++;
+ _string = "String " + _int;
+ _boolean = ((_int % 2) == 0);
+ }
+
+ public String action()
+ {
+ FacesContext context = FacesContext.getCurrentInstance();
+ FacesMessage message = new FacesMessage("CLICKED ON ROW " + _int + ", " +
+ _string);
+ context.addMessage(null, message);
+ return null;
+ }
+
+ public String showDetail()
+ {
+ RequestContext.getCurrentInstance().
+ getPageFlowScope().put("detail", this);
+ return "showDetail";
+ }
+
+ public boolean getBoolean()
+ {
+ return _boolean;
+ }
+
+ public void setBoolean(boolean aBoolean)
+ {
+ _boolean = aBoolean;
+ }
+
+
+ public int getInt()
+ {
+ return _int;
+ }
+
+ public void setInt(int anInt)
+ {
+ _int = anInt;
+ }
+
+ public String getString()
+ {
+ return _string;
+ }
+
+ public void setString(String aString)
+ {
+ _string = aString;
+ }
+
+ private int _int;
+ private boolean _boolean;
+ private String _string;
+
+ static private int _sCount = 0;
+}
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DataBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DataBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateBean.java?view=auto&rev=523607
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateBean.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateBean.java Thu Mar 29 00:50:53 2007
@@ -0,0 +1,118 @@
+/*
+ * 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.trinidaddemo;
+
+import java.util.Date;
+
+public class DateBean implements java.io.Serializable
+{
+ public DateBean()
+ {
+
+ _date1 = new Date();
+ _date2 = new Date();
+ _date3 = new Date();
+ _date4 = new Date();
+ _minDate = new Date(System.currentTimeMillis() - 24 * 60 * 60 * 1000);
+ _maxDate = new Date();
+ }
+
+ public String action()
+ {
+ return "success";
+ }
+
+ public Date getDate1()
+ {
+ return _date1;
+ }
+
+ public void setDate1(Date date)
+ {
+ _date1 = date;
+ }
+
+ public Date getDate2()
+ {
+ return _date2;
+ }
+
+ public void setDate2(Date date)
+ {
+ _date2 = date;
+ }
+
+ public Date getDate3()
+ {
+ return _date3;
+ }
+
+ public void setDate3(Date date)
+ {
+ _date3 = date;
+ }
+
+ public Date getDate4()
+ {
+ return _date4;
+ }
+
+ public void setDate4(Date date)
+ {
+ _date4 = date;
+ }
+
+ public void setMinDate(Date minDate)
+ {
+ _minDate = minDate;
+ }
+
+ public Date getMinDate()
+ {
+ return _minDate;
+ }
+
+ public void setMaxDate(Date maxDate)
+ {
+ _maxDate = maxDate;
+ }
+
+ public Date getMaxDate()
+ {
+ return _maxDate;
+ }
+
+ public Date getCurrentDate()
+ {
+ return new Date();
+ }
+
+ public void setCurrentDate(Date date)
+ {
+ return;
+ }
+
+ private Date _date1;
+ private Date _date2;
+ private Date _date3;
+ private Date _date4;
+ private Date _minDate;
+ private Date _maxDate;
+
+}
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateRestrictionValidatorBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateRestrictionValidatorBean.java?view=auto&rev=523607
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateRestrictionValidatorBean.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateRestrictionValidatorBean.java Thu Mar 29 00:50:53 2007
@@ -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.trinidaddemo;
+
+import java.util.Date;
+
+import org.apache.myfaces.trinidad.model.DateListProvider;
+
+public class DateRestrictionValidatorBean
+{
+
+ public String getCountry()
+ {
+ return _country;
+ }
+ public void setCountry(String country)
+ {
+ this._country = country;
+ }
+ public DateListProvider getNationalHolidays()
+ {
+ return _nationalHolidays;
+ }
+ public void setNationalHolidays(DateListProvider nationalHolidays)
+ {
+ this._nationalHolidays = nationalHolidays;
+ }
+ public Date getTestInvalidDays()
+ {
+ return _testInvalidDays;
+ }
+ public void setTestInvalidDays(Date testInvalidDays)
+ {
+ this._testInvalidDays = testInvalidDays;
+ }
+ public Date getTestInvalidDaysOfWeek()
+ {
+ return _testInvalidDaysOfWeek;
+ }
+ public void setTestInvalidDaysOfWeek(Date testInvalidDaysOfWeek)
+ {
+ this._testInvalidDaysOfWeek = testInvalidDaysOfWeek;
+ }
+ public Date getTestInvalidMonth()
+ {
+ return _testInvalidMonth;
+ }
+ public void setTestInvalidMonth(Date testInvalidMonth)
+ {
+ this._testInvalidMonth = testInvalidMonth;
+ }
+
+ private DateListProvider _nationalHolidays = null;
+ private String _country = null;
+ private Date _testInvalidDays = null;
+ private Date _testInvalidDaysOfWeek = null;
+ private Date _testInvalidMonth = null;
+
+}
\ No newline at end of file
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateRestrictionValidatorBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateRestrictionValidatorBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoCommandNavigationItemBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoCommandNavigationItemBean.java?view=auto&rev=523607
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoCommandNavigationItemBean.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoCommandNavigationItemBean.java Thu Mar 29 00:50:53 2007
@@ -0,0 +1,71 @@
+/*
+ * 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.trinidaddemo;
+
+import java.util.List;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.ActionEvent;
+
+import org.apache.myfaces.trinidad.bean.FacesBean;
+import org.apache.myfaces.trinidad.bean.PropertyKey;
+import org.apache.myfaces.trinidad.component.UIXCommand;
+import org.apache.myfaces.trinidad.component.UIXNavigationHierarchy;
+import org.apache.myfaces.trinidad.context.RequestContext;
+
+public class DemoCommandNavigationItemBean
+{
+ /**
+ * Changes the selected state of all of the navigation items in the
+ * parent component so that the clicked navigation item becomes
+ * selected and the others become deselected.
+ * @param event the ActionEvent associated with the action
+ */
+ @SuppressWarnings("unchecked")
+ public void navigationItemAction(ActionEvent event)
+ {
+ UIComponent actionItem = event.getComponent();
+ UIComponent parent = actionItem.getParent();
+ while (! (parent instanceof UIXNavigationHierarchy) )
+ {
+ parent = parent.getParent();
+ if (parent == null)
+ {
+ System.err.println(
+ "Unexpected component hierarchy, no UIXNavigationHierarchy found.");
+ return;
+ }
+ }
+
+ List<UIXCommand> children = parent.getChildren();
+ for (UIXCommand child : children)
+ {
+ FacesBean childFacesBean = child.getFacesBean();
+ FacesBean.Type type = childFacesBean.getType();
+ PropertyKey selectedKey = type.findKey("selected");
+ if (selectedKey != null)
+ {
+ childFacesBean.setProperty(selectedKey, (child == actionItem));
+ }
+ }
+
+ RequestContext adfContext = RequestContext.getCurrentInstance();
+ adfContext.addPartialTarget(parent);
+ }
+}
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoCommandNavigationItemBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoCommandNavigationItemBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoTreeData.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoTreeData.java?view=auto&rev=523607
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoTreeData.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoTreeData.java Thu Mar 29 00:50:53 2007
@@ -0,0 +1,87 @@
+/*
+ * 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.trinidaddemo;
+
+import java.util.ArrayList;
+
+/**
+ *
+ * @version $Name: $ ($Revision$) $Date$
+ * @author ADF Faces Team
+ */
+
+public class DemoTreeData extends ArrayList<TreeNodeImpl>
+{
+
+ // data
+
+ /**
+ * @param text the text label of the tree node
+ */
+ private static TreeNodeImpl _createNode(
+ String text
+ )
+ {
+ TreeNodeImpl data = new TreeNodeImpl();
+ data.setText(text);
+ data.setDestination( "http://www.oracle.com");
+ return data;
+ }
+
+ public DemoTreeData()
+ {
+ TreeNodeImpl node_0 = _createNode("node_0");
+ TreeNodeImpl node_0_0 = _createNode("node_0_0");
+ TreeNodeImpl node_0_0_0 = _createNode("node_0_0_0");
+ TreeNodeImpl node_0_0_0_0 = _createNode("node_0_0_0_0");
+ TreeNodeImpl node_0_0_1 = _createNode("node_0_0_1");
+ TreeNodeImpl node_0_1 = _createNode("node_0_1");
+ TreeNodeImpl node_0_1_0 = _createNode("node_0_1_0");
+ TreeNodeImpl node_0_1_1 = _createNode("node_0_1_1");
+ TreeNodeImpl node_0_2 = _createNode("node_0_2");
+ TreeNodeImpl node_0_3 = _createNode("node_0_3");
+ TreeNodeImpl node_0_4 = _createNode("node_0_4");
+ TreeNodeImpl node_0_5 = _createNode("node_0_5");
+
+ add(node_0);
+
+ ArrayList<TreeNodeImpl> list_0 = new ArrayList<TreeNodeImpl>();
+ list_0.add(node_0_0);
+ list_0.add(node_0_1);
+ list_0.add(node_0_2);
+ list_0.add(node_0_3);
+ list_0.add(node_0_4);
+ list_0.add(node_0_5);
+ node_0.setChildren(list_0);
+
+ ArrayList<TreeNodeImpl> list_0_0 = new ArrayList<TreeNodeImpl>();
+ list_0_0.add(node_0_0_0);
+ list_0_0.add(node_0_0_1);
+ node_0_0.setChildren(list_0_0);
+
+ ArrayList<TreeNodeImpl> list_0_0_0 = new ArrayList<TreeNodeImpl>();
+ list_0_0_0.add(node_0_0_0_0);
+ node_0_0_0.setChildren(list_0_0_0);
+
+ ArrayList<TreeNodeImpl> list_0_1 = new ArrayList<TreeNodeImpl>();
+ list_0_1.add(node_0_1_0);
+ list_0_1.add(node_0_1_1);
+ node_0_1.setChildren(list_0_1);
+ }
+}
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoTreeData.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoTreeData.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/GermanHolidayDateListProvider.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/GermanHolidayDateListProvider.java?view=auto&rev=523607
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/GermanHolidayDateListProvider.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/GermanHolidayDateListProvider.java Thu Mar 29 00:50:53 2007
@@ -0,0 +1,83 @@
+/*
+ * 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.trinidaddemo;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.trinidad.model.DateListProvider;
+
+public class GermanHolidayDateListProvider implements DateListProvider
+{
+
+ public GermanHolidayDateListProvider()
+ {
+ _germanHolidays = new ArrayList<Date>();
+ _germanHolidays.add(_newDate("01.01.2007"));
+ _germanHolidays.add(_newDate("06.04.2007"));
+ _germanHolidays.add(_newDate("09.04.2007"));
+ _germanHolidays.add(_newDate("01.05.2007"));
+ _germanHolidays.add(_newDate("17.05.2007"));
+ _germanHolidays.add(_newDate("07.06.2007"));
+ _germanHolidays.add(_newDate("03.10.2007"));
+ _germanHolidays.add(_newDate("01.11.2007"));
+ _germanHolidays.add(_newDate("25.12.2007"));
+ _germanHolidays.add(_newDate("26.12.2007"));
+ }
+
+ public List<Date> getDateList(FacesContext context, Calendar base,
+ Date rangeStart, Date rangeEnd)
+ {
+
+ List<Date> returnDates = new ArrayList<Date>();
+
+ for (Date it : _germanHolidays)
+ {
+ if(!it.before(rangeStart) && !it.after(rangeEnd)){
+ base.setTime(it);
+ returnDates.add(base.getTime());
+ }
+ }
+
+ return returnDates;
+ }
+
+ private Date _newDate(String string)
+ {
+ SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy");
+ Date ret = null;
+ try
+ {
+ ret = sdf.parse(string);
+ } catch (ParseException e)
+ {
+ e.printStackTrace();
+ }
+ return ret;
+ }
+
+
+ private List<Date> _germanHolidays = null;
+}
\ No newline at end of file
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/GermanHolidayDateListProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/GermanHolidayDateListProvider.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/InfiniteTree.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/InfiniteTree.java?view=auto&rev=523607
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/InfiniteTree.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/InfiniteTree.java Thu Mar 29 00:50:53 2007
@@ -0,0 +1,98 @@
+/*
+ * 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.trinidaddemo;
+
+import java.io.Serializable;
+import java.util.AbstractList;
+import java.util.List;
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+
+public class InfiniteTree extends AbstractList<InfiniteTree.Bean> implements Serializable
+{
+ public InfiniteTree(String id)
+ {
+ _id = id;
+ }
+
+ public InfiniteTree()
+ {
+ this("");
+ }
+
+ @Override
+ public int size()
+ {
+ return _GENES.length;
+ }
+
+ @Override
+ public Bean get(int index)
+ {
+ return new Bean(index);
+ }
+
+ // must be public for bean introspection:
+ public final class Bean
+ {
+ public Bean(int index)
+ {
+ _index = index;
+ }
+
+ public String action()
+ {
+ FacesContext context = FacesContext.getCurrentInstance();
+ FacesMessage message = new FacesMessage("Clicked on Gene " + getLabel());
+ context.addMessage(null, message);
+ return null;
+ }
+
+ public String getLabel()
+ {
+ char ch = _GENES[_index];
+ return _id + ch;
+ }
+
+ public String getParentLabel()
+ {
+ return _id;
+ }
+
+ public int getIndex()
+ {
+ return _index;
+ }
+
+ public int getDepth()
+ {
+ return getLabel().length();
+ }
+
+ public List<InfiniteTree.Bean> getKids()
+ {
+ return new InfiniteTree(getLabel());
+ }
+
+ private final int _index;
+ }
+
+ private final String _id;
+ private static final char[] _GENES = {'A', 'C', 'G', 'T'};
+}
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/InfiniteTree.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/InfiniteTree.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ListTestBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ListTestBean.java?view=auto&rev=523607
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ListTestBean.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ListTestBean.java Thu Mar 29 00:50:53 2007
@@ -0,0 +1,263 @@
+/*
+ * 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.trinidaddemo;
+
+import java.lang.reflect.Array;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.model.SelectItem;
+
+public class ListTestBean implements java.io.Serializable
+{
+ public void valueChanged(ValueChangeEvent vce)
+ {
+ String oldValue = _toString(vce.getOldValue());
+ Object newValue = _toString(vce.getNewValue());
+ FacesContext context = FacesContext.getCurrentInstance();
+ String message =
+ "Value changed from " + oldValue + " to " + newValue;
+ context.addMessage(vce.getComponent().getClientId(context),
+ new FacesMessage(message));
+ }
+
+ public Integer getSingleInt()
+ {
+ return _int;
+ }
+
+ public void setSingleInt(Integer val)
+ {
+ _int = val;
+ }
+
+ public int[] getIntArray()
+ {
+ return _intArray;
+ }
+
+ public void setIntArray(int[] val)
+ {
+ _intArray = val;
+ }
+
+ public String getSingleString()
+ {
+ return _string;
+ }
+
+ public void setSingleString(String val)
+ {
+ _string = val;
+ }
+
+ public String[] getStringArray()
+ {
+ return _stringArray;
+ }
+
+ public void setStringArray(String[] val)
+ {
+ _stringArray = val;
+ }
+
+ public List<Object> getObjectList()
+ {
+ return _objectList;
+ }
+
+ public void setObjectList(List<Object> val)
+ {
+ _objectList = val;
+ }
+
+ public List<String> getStringList()
+ {
+ return _stringList;
+ }
+
+ public void setSelectedSelectItems(List<?> val)
+ {
+ _selectedSelectItems = val;
+ }
+
+ public List<?> getSelectedSelectItems()
+ {
+ return _selectedSelectItems;
+ }
+
+ public void setSelectedCars(List<?> selectedCars)
+ {
+ _selectedCars = selectedCars;
+ }
+
+ public List<?> getSelectedCars()
+ {
+ return _selectedCars;
+ }
+
+ public void setSelectedCars2(List<?> selectedCars)
+ {
+ _selectedCars2 = selectedCars;
+ }
+
+ public List<?> getSelectedCars2()
+ {
+ return _selectedCars2;
+ }
+
+ public List<SelectItem> getMakes()
+ {
+ return _MAKE_ITEMS;
+ }
+
+ public SelectItem getFirstSelectItemString()
+ {
+ return _FIRST_CAR;
+ }
+
+ public SelectItem getSecondSelectItemString()
+ {
+ return _SECOND_CAR;
+ }
+
+ public SelectItem getThirdSelectItemString()
+ {
+ return _THIRD_CAR;
+ }
+
+ public SelectItem getFirstSelectItemCar()
+ {
+ return _FIRST_SELECT_ITEM_CAR;
+ }
+
+ public SelectItem getSecondSelectItemCar()
+ {
+ return _SECOND_SELECT_ITEM_CAR;
+ }
+
+ public SelectItem getThirdSelectItemCar()
+ {
+ return _THIRD_SELECT_ITEM_CAR;
+ }
+
+ static private String _toString(Object o)
+ {
+ if (o == null)
+ return "null";
+
+ if (o instanceof List)
+ {
+ String s = "List[";
+ for (int i = 0; i < ((List) o).size(); i++)
+ {
+ if (i != 0)
+ s += ",";
+
+ s += _toString(((List) o).get(i));
+ }
+
+ return s + "]";
+ }
+ else if (o.getClass().isArray())
+ {
+ String s = "Array[";
+ int size = Array.getLength(o);
+ for (int i = 0; i < size; i++)
+ {
+ if (i != 0)
+ s += ",";
+
+ s += _toString(Array.get(o, i));
+ }
+
+ return s + "]";
+ }
+
+ if (o instanceof Car)
+ return "\"" + ((Car)o).getName() + "\"";
+
+ if (o instanceof String)
+ return "\"" + o.toString() + "\"";
+
+ return o.toString();
+ }
+
+ // this is used to test a Car Object instead of a String in SelectItem
+ // when we use this, we also need to set "useIndexValue" attribute to true.
+ static public class Car implements java.io.Serializable
+ {
+ public Car(){}
+
+ public Car (String name)
+ {
+ _name = name;
+ }
+ public String getName()
+ {
+ return _name;
+ }
+ private String _name;
+ }
+
+ static private final List<SelectItem> _MAKE_ITEMS = new ArrayList<SelectItem>();
+
+ static private final SelectItem _FIRST_CAR =
+ new SelectItem("cordera", "Cordera Ltd.");
+ static private final SelectItem _SECOND_CAR =
+ new SelectItem("automno", "Autumno Inc.");
+ static private final SelectItem _THIRD_CAR =
+ new SelectItem("grabowski", "Grabowski Motors");
+
+ static private final SelectItem _FIRST_SELECT_ITEM_CAR =
+ new SelectItem(new Car("cordera"), "Cordera Ltd.");
+ static private final SelectItem _SECOND_SELECT_ITEM_CAR =
+ new SelectItem(new Car("automno"), "Autumno Inc.");
+ static private final SelectItem _THIRD_SELECT_ITEM_CAR =
+ new SelectItem(new Car("grabowski"), "Grabowski Motors");
+
+
+ static
+ {
+ // test a Car Object instead of a String in SelectItem.
+ // If you do not have a converter,
+ // make sure to use "useIndexValue='true'" in selectOne/selectMany
+ // component.
+ _MAKE_ITEMS.add(_FIRST_SELECT_ITEM_CAR);
+ _MAKE_ITEMS.add(_SECOND_SELECT_ITEM_CAR);
+ _MAKE_ITEMS.add(_THIRD_SELECT_ITEM_CAR);
+ }
+
+ private List<?> _selectedCars;
+ private List<?> _selectedCars2;
+ private List<?> _selectedSelectItems;
+
+ private Integer _int = 1;
+ private int[] _intArray;
+
+ private String _string;
+ private String[] _stringArray;
+
+ private List<String> _stringList;
+ private List<Object> _objectList;
+}
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ListTestBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ListTestBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoStatusBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoStatusBean.java?view=auto&rev=523607
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoStatusBean.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoStatusBean.java Thu Mar 29 00:50:53 2007
@@ -0,0 +1,173 @@
+/*
+ * 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.trinidaddemo;
+
+import java.text.SimpleDateFormat;
+
+import java.util.Date;
+
+public class PartialDemoStatusBean implements java.io.Serializable
+{
+ public PartialDemoStatusBean()
+ {
+ reset();
+ }
+
+ public boolean getChecked()
+ {
+ return Boolean.TRUE.equals(_checkBoxState);
+ }
+
+ public int getCheckBoxUpdateCount()
+ {
+ return _checkBoxUpdateCount;
+ }
+
+ public String getCheckBoxStateText()
+ {
+ if (_checkBoxState == null)
+ return _DEFAULT_CHECK_STATE;
+
+ if (Boolean.TRUE.equals(_checkBoxState))
+ return _CHECKED_STATE;
+
+ return _NOT_CHECKED_STATE;
+ }
+
+ public String getChoiceInt()
+ {
+ if (_choiceInt == null)
+ return "1";
+ return _choiceInt.toString();
+ }
+
+ public String getChoiceText()
+ {
+ if (_choiceInt == null)
+ return _DEFAULT_CHOICE_TEXT;
+
+ return "value #" + _choiceInt;
+ }
+
+ public String getLinkUpdate()
+ {
+ return _linkUpdate;
+ }
+
+ public String getRadioStateText()
+ {
+ return _radioState;
+ }
+
+ public String getTextStateText()
+ {
+ if (_DEFAULT_TEXT_VALUE.equals(_textValue))
+ return _DEFAULT_TEXT_STATE;
+ return _textValue;
+ }
+
+ public String getTextValue()
+ {
+ return _textValue;
+ }
+
+ public void setChecked(boolean checked)
+ {
+ _checkBoxState = (checked ? Boolean.TRUE : Boolean.FALSE);
+ }
+
+ public void setChecked(Boolean checked)
+ {
+ _checkBoxState = checked;
+ }
+
+ public void setChoiceText(String txt)
+ {
+ // does nothing
+ }
+
+ public void setChoiceInt(String ci)
+ {
+ _choiceInt = new Integer(ci);
+ }
+
+ public void setLinkUpdate()
+ {
+ SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
+ _linkUpdate = sdf.format(new Date());
+ }
+
+ public void setRadioStateText(String t)
+ {
+ _radioState = t;
+ }
+
+ void setSelectBooleanState(String value)
+ {
+ _radioState = "selectBoolean set, " + value;
+ }
+
+ void setSelectOneState(String value)
+ {
+ _radioState = "selectOne set, item " + value;
+ }
+
+ public void setTextValue(String t)
+ {
+ _textValue = t;
+ }
+
+ public void resetCheckBox()
+ {
+ _checkBoxUpdateCount = 0;
+ _checkBoxState = null;
+ }
+
+ public void incrementCheckBoxUpdateCount()
+ {
+ _checkBoxUpdateCount++;
+ }
+
+ public void reset()
+ {
+ resetCheckBox();
+ _choiceInt = null;
+ _linkUpdate = _DEFAULT_LINK_UPDATE;
+ _radioState = _DEFAULT_RADIO_STATE;
+ _textValue = _DEFAULT_TEXT_VALUE;
+ }
+
+ private int _checkBoxUpdateCount;
+ // This is kept as a Boolean so we can reset to the default value.
+ private Boolean _checkBoxState;
+ private Integer _choiceInt;
+ private String _linkUpdate;
+ private String _radioState;
+ private String _textValue;
+
+ private static String _NOTHING = "nothing yet.";
+ private static String _DEFAULT_CHECK_STATE = "updates this text.";
+ private static String _CHECKED_STATE = "is checked.";
+ private static String _NOT_CHECKED_STATE = "is not checked.";
+ private static String _DEFAULT_CHOICE_TEXT = _NOTHING;
+ private static String _DEFAULT_LINK_UPDATE = "never.";
+ private static String _DEFAULT_RADIO_STATE = "no selection yet.";
+ private static String _DEFAULT_TEXT_STATE = _NOTHING;
+ private static String _DEFAULT_TEXT_VALUE = "Change this text";
+}
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoStatusBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoStatusBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoUtilBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoUtilBean.java?view=auto&rev=523607
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoUtilBean.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoUtilBean.java Thu Mar 29 00:50:53 2007
@@ -0,0 +1,123 @@
+/*
+ * 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.trinidaddemo;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ValueChangeEvent;
+
+import org.apache.myfaces.trinidad.component.UIXOutput;
+import org.apache.myfaces.trinidad.context.RequestContext;
+
+public class PartialDemoUtilBean
+{
+ public void action(ActionEvent action)
+ {
+ // Just update the string which says when the last update was.
+ _status.setLinkUpdate();
+ }
+
+ // This is called for the resetButton
+ public void reset(ActionEvent action)
+ {
+ _status.reset();
+ _resetList();
+ }
+
+ public void valueChanged(ValueChangeEvent vce)
+ {
+ Object newValue = vce.getNewValue();
+ UIComponent component = vce.getComponent();
+
+ String rendererType = component.getRendererType();
+
+ // For these first components the listeners have registered themselves
+ // by setting the partialTriggers attribute. So we just update the model.
+ if (rendererType.equals("org.apache.myfaces.trinidad.Checkbox"))
+ {
+ _status.setChecked((Boolean) newValue);
+ _status.incrementCheckBoxUpdateCount();
+ }
+ else if (rendererType.equals("org.apache.myfaces.trinidad.Radio"))
+ {
+ if (Boolean.TRUE.equals(newValue))
+ {
+ String text = (String) component.getAttributes().get("text");
+ _status.setSelectBooleanState(text);
+ }
+ else if (newValue instanceof String)
+ _status.setSelectOneState((String) newValue);
+ }
+ else if (rendererType.equals("org.apache.myfaces.trinidad.Text"))
+ {
+ if (newValue instanceof String)
+ _status.setTextValue((String) newValue);
+ }
+ else if (rendererType.equals("org.apache.myfaces.trinidad.Choice"))
+ {
+ if (newValue instanceof String)
+ _status.setChoiceInt((String) newValue);
+ }
+
+ // This component illustrates a method of dynamically adding a
+ // partialTarget (i.e. without setting the partialTriggers attribute). It
+ // updates a component binding and adds the updated component directly to
+ // the list of partial targets.
+ else if (rendererType.equals("org.apache.myfaces.trinidad.Listbox"))
+ {
+ _listUpdate.setValue(component.getAttributes().get("value"));
+ _addTarget(_listUpdate);
+ }
+ }
+
+ public UIXOutput getListUpdate()
+ {
+ return _listUpdate;
+ }
+
+ public void setListUpdate(UIXOutput listUpdate)
+ {
+ _listUpdate = listUpdate;
+ }
+
+ public PartialDemoStatusBean getStatus()
+ {
+ return _status;
+ }
+
+ public void setStatus(PartialDemoStatusBean status)
+ {
+ _status = status;
+ }
+
+ private void _resetList()
+ {
+ _listUpdate.setValue("nothing yet.");
+ _addTarget(_listUpdate);
+ }
+
+ private void _addTarget(UIComponent target)
+ {
+ RequestContext adfContext = RequestContext.getCurrentInstance();
+ adfContext.addPartialTarget(target);
+ }
+
+ private PartialDemoStatusBean _status;
+ private UIXOutput _listUpdate;
+}
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoUtilBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoUtilBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PollBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PollBean.java?view=auto&rev=523607
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PollBean.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PollBean.java Thu Mar 29 00:50:53 2007
@@ -0,0 +1,53 @@
+/*
+ * 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.trinidaddemo;
+
+import javax.faces.event.ActionEvent;
+import org.apache.myfaces.trinidad.event.PollEvent;
+
+/**
+ * Bean for poll component demos.
+ *
+ * @version $Name: $ ($Revision$) $Date$
+ */
+
+public class PollBean implements java.io.Serializable
+{
+ public PollBean()
+ {
+ _POLL_COUNT = 0;
+ }
+
+ public void onPoll(PollEvent event)
+ {
+ ++_POLL_COUNT;
+ }
+
+ public int getPollCount()
+ {
+ return _POLL_COUNT;
+ }
+
+ public void resetPoll(ActionEvent event)
+ {
+ _POLL_COUNT = 0;
+ }
+
+ private static int _POLL_COUNT;
+}
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PollBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PollBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PreferencesProxy.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PreferencesProxy.java?view=auto&rev=523607
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PreferencesProxy.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PreferencesProxy.java Thu Mar 29 00:50:53 2007
@@ -0,0 +1,57 @@
+/*
+ * 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.trinidaddemo;
+
+import java.util.Collections;
+
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+
+/**
+ * A proxy class to ask the e-mail demo for preferences information,
+ * but only when we're inside the e-mail demo!
+ */
+public class PreferencesProxy
+{
+ public Object getProxy()
+ {
+ // If we're in the e-mail demo, use its preferences
+ FacesContext context = FacesContext.getCurrentInstance();
+ if ((context.getViewRoot() != null) &&
+ (context.getViewRoot().getViewId().indexOf("/email/") >= 0))
+ {
+ ValueBinding vb =
+ context.getApplication().createValueBinding("#{email.preferences}");
+ return vb.getValue(context);
+ }
+ // If we are showing the SkinDemo page, get the skinFamily from the
+ // sessionScope.
+ else if ((context.getViewRoot() != null) &&
+ (context.getViewRoot().getViewId().indexOf("SkinDemo") >= 0))
+ {
+ ValueBinding vb =
+ context.getApplication().createValueBinding("#{sessionScope}");
+ return vb.getValue(context);
+ }
+ // Otherwise, go to an empty map (blank preferences)
+ else
+ return Collections.EMPTY_MAP;
+
+ }
+}
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PreferencesProxy.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PreferencesProxy.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressBean.java?view=auto&rev=523607
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressBean.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressBean.java Thu Mar 29 00:50:53 2007
@@ -0,0 +1,121 @@
+/*
+ * 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.trinidaddemo;
+
+import java.io.Serializable;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.faces.event.ActionEvent;
+
+import org.apache.myfaces.trinidad.model.BoundedRangeModel;
+import org.apache.myfaces.trinidad.model.DefaultBoundedRangeModel;
+
+/**
+ * Bean for progress component demos.
+ *
+ * @version $Name: $ ($Revision$) $Date$
+ */
+public class ProgressBean implements Serializable
+{
+ public BoundedRangeModel getProgressModel()
+ {
+ if (null == __model)
+ {
+ prepare();
+ }
+ return __model;
+ }
+
+ public void cancelProcess(ActionEvent event)
+ {
+ endProcess();
+ }
+
+ protected void prepare()
+ {
+ __model = new DefaultBoundedRangeModel(-1, 125);
+ //pu: simulate asynchronous model updates on a different thread
+ __processThread = new ProcessThread(500, 0);
+ __processThread.start();
+ }
+
+ protected void endProcess()
+ {
+ __processThread = null;
+ __model = null;
+ }
+
+ protected class ProcessThread extends Thread implements Serializable
+ {
+ /**
+ * @param updateIntervalFactor - controls the speed of the thread
+ * @param updateValueFactor - The value by which the 'value' from the
+ * model should be incremented for every cycle. Randomizes the increment
+ * if updateValueFactor supplied is '0'.
+ */
+ ProcessThread(long updateIntervalFactor, long updateValueFactor)
+ {
+ _updateIntervalFactor = updateIntervalFactor;
+ _updateValueFactor = updateValueFactor;
+ }
+
+ @Override
+ public void run()
+ {
+ try
+ {
+ //pu: Be in indeterminate mode for some time to start with
+ sleep(3000);
+ //pu: Take care to get out if we are the discarded thread upon endProcess()
+ while ( (__processThread == Thread.currentThread()) &&
+ (__model != null) &&
+ (__model.getValue() < __model.getMaximum())
+ )
+ {
+ long sleepFactor = Math.round(Math.random()*10);
+ long updatedValue = __model.getValue() +
+ ((_updateValueFactor == 0) ? sleepFactor:_updateValueFactor);
+ long maximum = __model.getMaximum();
+ if (updatedValue > maximum)
+ {
+ updatedValue = maximum;
+ }
+ __model.setValue(updatedValue);
+ sleep(sleepFactor * _updateIntervalFactor);
+ }
+ }
+ catch (InterruptedException ie)
+ {
+ _LOG.log(Level.WARNING, "Background task thread interrupted", ie);
+ }
+ __model = null;
+ }
+ private long _updateIntervalFactor;
+ private long _updateValueFactor;
+ }
+
+ protected volatile DefaultBoundedRangeModel __model;
+ protected volatile ProcessThread __processThread;
+
+ static private final Logger _LOG = Logger.getLogger(
+ ProgressBean.class.getName());
+
+}
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressStepsBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressStepsBean.java?view=auto&rev=523607
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressStepsBean.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressStepsBean.java Thu Mar 29 00:50:53 2007
@@ -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.trinidaddemo;
+
+import java.io.IOException;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.trinidad.event.PollEvent;
+import org.apache.myfaces.trinidad.model.DefaultBoundedRangeModel;
+
+/**
+ * Bean for progress steps demos.
+ *
+ * @version $Name: $ ($Revision$) $Date$
+ */
+public class ProgressStepsBean extends ProgressBean
+{
+ public List<String> getProgressSteps()
+ {
+ return _PROGRESS_STEPS;
+ }
+
+ public void onPoll(PollEvent event)
+ {
+ if ( __model != null && (__model.getMaximum() <= __model.getValue()) )
+ {
+ //pu: This means the background task is complete.
+ // End the task and navigate off to a different page.
+ endProcess();
+ try
+ {
+ ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
+ ec.redirect("../components/progressEnd.jspx?taskStatus=completed");
+ }
+ catch(IOException ioe)
+ {
+ _LOG.log(Level.WARNING, "Could not redirect", ioe);
+ }
+ catch (RuntimeException re)
+ {
+ _LOG.log(Level.SEVERE, "Could not redirect", re);
+ throw re;
+ }
+ }
+ }
+
+ @Override
+ protected void prepare()
+ {
+ __model = new DefaultBoundedRangeModel(-1, 6);
+ //pu: simulate asynchronous model updates on a different thread
+ __processThread = new ProcessThread(1500, 1);
+ __processThread.start();
+ }
+
+ static private List<String> _PROGRESS_STEPS;
+
+ static private final Logger _LOG = Logger.getLogger(
+ ProgressStepsBean.class.getName());
+
+ static
+ {
+ _PROGRESS_STEPS = new ArrayList<String>();
+ _PROGRESS_STEPS.add("Checking for latest version");
+ _PROGRESS_STEPS.add("Checking available disk space");
+ _PROGRESS_STEPS.add("Copying files");
+ _PROGRESS_STEPS.add("Analyzing dependencies");
+ _PROGRESS_STEPS.add("Install in progress");
+ _PROGRESS_STEPS.add("Building icons and shortcuts");
+ }
+
+}
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressStepsBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressStepsBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ReorderTest.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ReorderTest.java?view=auto&rev=523607
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ReorderTest.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ReorderTest.java Thu Mar 29 00:50:53 2007
@@ -0,0 +1,84 @@
+/*
+ * 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.trinidaddemo;
+
+import java.util.List;
+import javax.faces.component.UIComponent;
+import javax.faces.event.ActionEvent;
+import org.apache.myfaces.trinidad.component.core.output.CoreOutputText;
+
+public class ReorderTest
+{
+ public void setPanel(UIComponent panel)
+ {
+ _panel = panel;
+ }
+
+ public UIComponent getPanel()
+ {
+ return _panel;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void add(ActionEvent event)
+ {
+ List<UIComponent> children = _panel.getChildren();
+ CoreOutputText output = new CoreOutputText();
+ output.setValue("Item " + (children.size() + 1));
+ children.add(0, output);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void remove(ActionEvent event)
+ {
+ List<UIComponent> children = _panel.getChildren();
+ children.remove(children.size() - 1);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void removeFirst(ActionEvent event)
+ {
+ List<UIComponent> children = _panel.getChildren();
+ children.remove(0);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void rotate(ActionEvent event)
+ {
+ List<UIComponent> children = _panel.getChildren();
+ UIComponent o = children.get(0);
+ children.remove(0);
+ children.add(o);
+ }
+
+ public void removeSeparator(ActionEvent event)
+ {
+ _panel.getFacets().remove("separator");
+ }
+
+ @SuppressWarnings("unchecked")
+ public void setSeparator(ActionEvent event)
+ {
+ CoreOutputText output = new CoreOutputText();
+ output.setValue("New Separator");
+ _panel.getFacets().put("separator", output);
+ }
+
+ private UIComponent _panel;
+}
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ReorderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ReorderTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL