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/07 14:44:48 UTC
svn commit: r515587 [2/19] - in
/incubator/adffaces/branches/matzew-core-1.0.0-incubation: ./ examples/
examples/trinidad-demo/ examples/trinidad-demo/src/
examples/trinidad-demo/src/conf/ examples/trinidad-demo/src/main/
examples/trinidad-demo/src/mai...
Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CarBackingBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CarBackingBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CarBackingBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CarBackingBean.java Wed Mar 7 06:44:35 2007
@@ -0,0 +1,176 @@
+/*
+ * 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;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.component.UISelectItems;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.model.SelectItem;
+
+import org.apache.myfaces.trinidad.component.UIXOutput;
+import org.apache.myfaces.trinidad.component.core.nav.CoreCommandLink;
+
+import org.apache.myfaces.trinidad.event.ReturnEvent;
+
+public class CarBackingBean
+{
+ public List<SelectItem> getMakes()
+ {
+ return _MAKE_ITEMS;
+ }
+
+ public void makeChanged(ValueChangeEvent vce)
+ {
+
+ if ("".equals(vce.getNewValue()))
+ _modelItems.setValue(Collections.EMPTY_LIST);
+
+ Object newValue = vce.getNewValue();
+ if (newValue instanceof Car)
+ {
+ String newCar = ((Car)newValue).getName();
+ if ("cordera".equals(newCar))
+ _modelItems.setValue(_CORDERA_MODELS);
+ else if ("autumno".equals(newCar))
+ _modelItems.setValue(_AUTUMNO_MODELS);
+ else if ("grabowski".equals(newCar))
+ _modelItems.setValue(_GRABOWSKI_MODELS);
+ }
+
+ _options.setValue(null);
+ _price.setValue(null);
+ _launchOptions.setDisabled(true);
+ }
+
+ public void modelChanged(ValueChangeEvent vce)
+ {
+ _price.setValue(_getPriceOfCar(vce.getNewValue()));
+ _options.setValue(null);
+ _launchOptions.setDisabled("".equals(vce.getNewValue()));
+ }
+
+ public UISelectItems getModelItems() { return _modelItems; }
+ public void setModelItems(UISelectItems modelItems) { _modelItems = modelItems; }
+
+ public UIXOutput getPrice() { return _price; }
+ public void setPrice(UIXOutput price) { _price = price; }
+
+ public UIXOutput getOptions() { return _options; }
+ public void setOptions(UIXOutput options) { _options = options; }
+
+ public CoreCommandLink getLaunchOptions() { return _launchOptions; }
+ public void setLaunchOptions(CoreCommandLink launchOptions) { _launchOptions = launchOptions; }
+
+ public Object _getPriceOfCar(Object model)
+ {
+ return _PRICES.get(model);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void returnOptions(ReturnEvent event)
+ {
+ Object value = event.getReturnValue();
+ StringBuffer buffer = new StringBuffer();
+ int addedPrice = 0;
+ if (value instanceof List)
+ {
+ for(CarOption option : (List<CarOption>) value)
+ {
+ addedPrice = addedPrice + option.getPrice();
+ if (buffer.length() != 0)
+ buffer.append(", ");
+ buffer.append(option.getName());
+ }
+ }
+
+ _options.setValue(buffer.toString());
+
+ Integer price = (Integer) _price.getValue();
+ _price.setValue(new Integer(price.intValue() + addedPrice));
+ }
+
+ private UIXOutput _price;
+ private UIXOutput _options;
+ private CoreCommandLink _launchOptions;
+ private UISelectItems _modelItems;
+
+ static private final List<SelectItem> _MAKE_ITEMS = new ArrayList<SelectItem>();
+ static private final List<SelectItem> _CORDERA_MODELS = new ArrayList<SelectItem>();
+ static private final List<SelectItem> _AUTUMNO_MODELS = new ArrayList<SelectItem>();
+ static private final List<SelectItem> _GRABOWSKI_MODELS = new ArrayList<SelectItem>();
+
+ static private final Map<String, Integer> _PRICES = new HashMap<String, Integer>();
+
+ static private final SelectItem _NULL_SELECT_ITEM = new SelectItem("");
+
+ static
+ {
+ _MAKE_ITEMS.add(_NULL_SELECT_ITEM);
+ // 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(new SelectItem(new Car("cordera"), "Cordera Ltd."));
+ _MAKE_ITEMS.add(new SelectItem(new Car("autumno"), "Autumno Inc."));
+ _MAKE_ITEMS.add(new SelectItem(new Car("grabowski"), "Grabowski Motors"));
+
+ _CORDERA_MODELS.add(_NULL_SELECT_ITEM);
+ _CORDERA_MODELS.add(new SelectItem("XL", "XL"));
+ _CORDERA_MODELS.add(new SelectItem("SV", "SV"));
+ _CORDERA_MODELS.add(new SelectItem("DUH", "DUH"));
+
+ _AUTUMNO_MODELS.add(_NULL_SELECT_ITEM);
+ _AUTUMNO_MODELS.add(new SelectItem("390"));
+ _AUTUMNO_MODELS.add(new SelectItem("490"));
+ _AUTUMNO_MODELS.add(new SelectItem("585"));
+
+ _GRABOWSKI_MODELS.add(_NULL_SELECT_ITEM);
+ _GRABOWSKI_MODELS.add(new SelectItem("OneAndOnly"));
+
+ _PRICES.put("XL", new Integer(25000));
+ _PRICES.put("SV", new Integer(17000));
+ _PRICES.put("DUH", new Integer(12000));
+ _PRICES.put("390", new Integer(29500));
+ _PRICES.put("490", new Integer(39500));
+ _PRICES.put("585", new Integer(49500));
+ _PRICES.put("OneAndOnly", new Integer(116500));
+ }
+
+ // this is used to test a Car Object instead of a String in SelectItem
+ static private class Car
+ {
+ public Car (String name)
+ {
+ _name = name;
+ }
+ public String getName()
+ {
+ return _name;
+ }
+
+ private String _name;
+
+ }
+
+}
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CarBackingBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CarBackingBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CarOption.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CarOption.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CarOption.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CarOption.java Wed Mar 7 06:44:35 2007
@@ -0,0 +1,41 @@
+/*
+ * 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;
+
+public class CarOption
+{
+ public CarOption(String name, int price)
+ {
+ _name = name;
+ _price = price;
+ }
+
+ public String getName()
+ {
+ return _name;
+ }
+
+ public int getPrice()
+ {
+ return _price;
+ }
+
+ private final String _name;
+ private final int _price;
+}
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CarOption.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CarOption.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CarOptionsBackingBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CarOptionsBackingBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CarOptionsBackingBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CarOptionsBackingBean.java Wed Mar 7 06:44:35 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.ArrayList;
+import java.util.List;
+
+import javax.faces.model.SelectItem;
+
+import org.apache.myfaces.trinidad.context.RequestContext;
+
+
+public class CarOptionsBackingBean
+{
+ public List<String> getOptions() { return _options; }
+ public void setOptions(List<String> options) { _options = options; }
+
+ public String pickOptions()
+ {
+ List<String> options = getOptions();
+ List<CarOption> realOptionObjects = new ArrayList<CarOption>();
+ for (int i = 0; i < _AVAILABLE_OPTIONS.length; i++)
+ {
+ if (options.contains("" + i))
+ realOptionObjects.add(_AVAILABLE_OPTIONS[i]);
+ }
+
+ RequestContext.getCurrentInstance().returnFromDialog(realOptionObjects,
+ null);
+ return null;
+ }
+
+ public List<SelectItem> getOptionsItems()
+ {
+ return _OPTIONS_ITEMS;
+ }
+
+ private List<String> _options;
+
+ static private final List<SelectItem> _OPTIONS_ITEMS = new ArrayList<SelectItem>();
+
+ static private final CarOption[] _AVAILABLE_OPTIONS =
+ {
+ new CarOption("Power windows", 350),
+ new CarOption("Automatic transmission", 990),
+ new CarOption("Side-curtain air bags", 600)
+ };
+
+ static
+ {
+ _OPTIONS_ITEMS.add(new SelectItem("0",
+ "Power windows ($350)"));
+ _OPTIONS_ITEMS.add(new SelectItem("1",
+ "Automatic transmission ($990)"));
+ _OPTIONS_ITEMS.add(new SelectItem("2",
+ "Side-curtain air-bags ($600)"));
+
+ }
+}
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CarOptionsBackingBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CarOptionsBackingBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ChartBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ChartBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ChartBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ChartBean.java Wed Mar 7 06:44:35 2007
@@ -0,0 +1,368 @@
+/*
+ * 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.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringWriter;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.trinidad.component.core.data.CoreChart;
+import org.apache.myfaces.trinidad.context.RequestContext;
+import org.apache.myfaces.trinidad.event.ChartDrillDownEvent;
+import org.apache.myfaces.trinidad.model.ChartModel;
+import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
+import org.apache.myfaces.trinidad.util.Service;
+
+
+/**
+ * Managed bean for chat component demos.
+ * @version $Name: $ ($Revision$) $Date$
+ */
+public class ChartBean implements java.io.Serializable
+{
+ public ChartModel getValue()
+ {
+ return _chartModel;
+ }
+
+ public ComponentEditorHandler getEditor()
+ {
+ return _editorBean;
+ }
+
+ public String updatePartial()
+ {
+ _editorBean.update();
+ RequestContext afContext = RequestContext.getCurrentInstance();
+ afContext.addPartialTarget(_editorBean.getComponent());
+ return null;
+ }
+
+ public boolean isLargerDataSet()
+ {
+ return _largerDataSet;
+ }
+
+ public void setLargerDataSet(boolean b)
+ {
+ _largerDataSet = b;
+ CoreChart chart = (CoreChart)_editorBean.getComponent();
+ if(_largerDataSet)
+ chart.setXMajorGridLineCount(1);
+ else
+ chart.setXMajorGridLineCount(-1);
+ }
+
+ public void drillDown(ChartDrillDownEvent event)
+ {
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ String message = "seriesIndices : " + _getEventIntsAsString(event.getSeriesIndices()) +
+ " yValueIndices : " + _getEventIntsAsString(event.getYValueIndices()) +
+ " yValues :" + _getEventDoublesAsString(event.getYValues()) +
+ " xValues :" + _getEventDoublesAsString(event.getXValues());
+ ExtendedRenderKitService erks =
+ Service.getRenderKitService(context,
+ ExtendedRenderKitService.class);
+ erks.addScript(context,
+ "alert('Confirmation from ChartBean: " +
+ message +
+ "');");
+ }
+
+ private String _getEventIntsAsString(int[] intArray)
+ {
+ if(intArray!=null)
+ {
+ StringWriter sw = new StringWriter();
+ for(int i=0; i<intArray.length; ++i)
+ {
+ if(i!=0)
+ sw.append(',');
+ sw.append(String.valueOf(intArray[i]));
+ }
+ return sw.toString();
+ }
+ else
+ return null;
+ }
+
+ private String _getEventDoublesAsString(double[] intArray)
+ {
+ if(intArray!=null)
+ {
+ StringWriter sw = new StringWriter();
+ for(int i=0; i<intArray.length; ++i)
+ {
+ if(i!=0)
+ sw.append(',');
+ sw.append(String.valueOf(intArray[i]));
+ }
+ return sw.toString();
+ }
+ else
+ return null;
+ }
+
+
+ private class MyChartModel extends ChartModel
+ {
+ @Override
+ public List<String> getSeriesLabels()
+ {
+ if(_largerDataSet)
+ return _largeSeriesLabels;
+ else
+ return _seriesLabels;
+ }
+
+ @Override
+ public List<String> getGroupLabels()
+ {
+ CoreChart chart = (CoreChart)_editorBean.getComponent();
+ if("circularGauge".equals(chart.getType()) ||
+ "semiCircularGauge".equals(chart.getType()) ||
+ !_largerDataSet)
+ return _groupLabels;
+ else
+ return _largeGroupLabels;
+ }
+
+ @Override
+ public List<List<Double>> getXValues()
+ {
+ CoreChart chart = (CoreChart)_editorBean.getComponent();
+ if("XYLine".equals(chart.getType()) || "scatterPlot".equals(chart.getType()))
+ {
+ if(_largerDataSet)
+ {
+ if(_largerXValues == null)
+ {
+ _largerXValues = new ArrayList<List<Double>>();
+ _loadLargerValues(_largerXValues, "/components/chartData/NasdaqXData.txt");
+ }
+ return _largerXValues;
+ }
+ return _chartXValues;
+ }
+ else
+ return null;
+ }
+
+ @Override
+ public List<List<Double>> getYValues()
+ {
+ CoreChart chart = (CoreChart)_editorBean.getComponent();
+ if("circularGauge".equals(chart.getType()) ||
+ "semiCircularGauge".equals(chart.getType()))
+ return _dialchartYValues;
+ else
+ {
+ if(_largerDataSet)
+ {
+ if(_largerYValues == null)
+ {
+ _largerYValues = new ArrayList<List<Double>>();
+ _loadLargerValues(_largerYValues, "/components/chartData/NasdaqData.txt");
+ }
+ return _largerYValues;
+ }
+ return _chartYValues;
+ }
+ }
+
+ private void _loadLargerValues(ArrayList<List<Double>> valuesList, String file)
+ {
+ FacesContext context = FacesContext.getCurrentInstance();
+ InputStream in = context.getExternalContext().getResourceAsStream(file);
+ if(in != null)
+ {
+
+ BufferedReader rd
+ = new BufferedReader(new InputStreamReader(in));
+
+ String line;
+ try
+ {
+ while((line = rd.readLine())!=null)
+ {
+ String[] strings = line.split("\t");
+ ArrayList<Double> values = new ArrayList<Double>(strings.length);
+ for(String s:strings)
+ {
+ values.add(Double.parseDouble(s));
+ }
+ valuesList.add(values);
+ }
+ }
+ catch(IOException ioe)
+ {
+ System.out.println("error reading chart data");
+ }
+ }
+ }
+
+ @Override
+ public Double getMaxYValue()
+ {
+ CoreChart chart = (CoreChart)_editorBean.getComponent();
+ if("circularGauge".equals(chart.getType()) ||
+ "semiCircularGauge".equals(chart.getType()))
+ return 200.0;
+ else if("stackedVerticalBar".equals(chart.getType()) ||
+ "stackedHorizontalBar".equals(chart.getType()) ||
+ "stackedArea".equals(chart.getType()))
+ {
+ if(_largerDataSet)
+ return 7500.0;
+ else
+ return 500000.0;
+ }
+ else
+ {
+ if(_largerDataSet)
+ return 2500.0;
+ else
+ return 200000.0;
+ }
+ }
+
+ @Override
+ public Double getMinYValue()
+ {
+ CoreChart chart = (CoreChart)_editorBean.getComponent();
+ if(!"circularGauge".equals(chart.getType()) &&
+ !"semiCircularGauge".equals(chart.getType()) &&
+ !"stackedVerticalBar".equals(chart.getType()) &&
+ !"stackedHorizontalBar".equals(chart.getType()) &&
+ !"stackedArea".equals(chart.getType()) &&
+ _largerDataSet)
+ {
+ return 2000.0;
+ }
+ return 0.0;
+ }
+
+ @Override
+ public Double getMaxXValue()
+ {
+ if(_largerDataSet)
+ return 54.0;
+ else
+ return 10.0;
+ }
+
+ @Override
+ public Double getMinXValue()
+ {
+ if(_largerDataSet)
+ return 0.0;
+ else
+ return 6.0;
+ }
+
+ @Override
+ public String getTitle()
+ {
+ CoreChart chart = (CoreChart)_editorBean.getComponent();
+ if("circularGauge".equals(chart.getType()) ||
+ "semiCircularGauge".equals(chart.getType()))
+ return "Values in 1000s";
+ else
+ {
+ if(_largerDataSet)
+ return "NASDAQ Q4 2005 - Q3 2006";
+ else
+ return "Title";
+ }
+ }
+
+ @Override
+ public String getSubTitle()
+ {
+ CoreChart chart = (CoreChart)_editorBean.getComponent();
+ if("circularGauge".equals(chart.getType()) ||
+ "semiCircularGauge".equals(chart.getType()) || _largerDataSet)
+ return null;
+ else
+ return "SubTitle";
+ }
+
+ @Override
+ public String getFootNote()
+ {
+ CoreChart chart = (CoreChart)_editorBean.getComponent();
+ if("circularGauge".equals(chart.getType()) ||
+ "semiCircularGauge".equals(chart.getType()) || _largerDataSet)
+ return null;
+ else
+ return "FootNote";
+ }
+
+ private final List<String> _groupLabels =
+ Arrays.asList(new String[]{"June", "July", "August", "September","October"});
+
+ private final List<String> _largeGroupLabels =
+ Arrays.asList(new String[]{"Q4-2005", "Q1-2006", "Q2-2006", "Q3-2006"});
+
+ private final List<String> _seriesLabels =
+ Arrays.asList(new String[]{"Previous", "Target", "Actual"});
+
+ private final List<String> _largeSeriesLabels =
+ Arrays.asList(new String[]{"Opening", "Low", "High"});
+
+ private final ArrayList<List<Double>> _chartYValues;
+ private final ArrayList<List<Double>> _chartXValues;
+ private final ArrayList<List<Double>> _dialchartYValues;
+ private ArrayList<List<Double>> _largerYValues;
+ private ArrayList<List<Double>> _largerXValues;
+ {
+ _chartYValues = new ArrayList<List<Double>>();
+ _chartYValues.add(Arrays.asList(new Double[]{135235.0, 155535.0, 141725.0}));
+ _chartYValues.add(Arrays.asList(new Double[]{106765., 131725., 127868.}));
+ _chartYValues.add(Arrays.asList(new Double[]{108456., 119326., 139326.}));
+ _chartYValues.add(Arrays.asList(new Double[]{136765., 147265., 184349.}));
+ _chartYValues.add(Arrays.asList(new Double[]{107868., 113968., 174349.}));
+
+ _dialchartYValues = new ArrayList<List<Double>>();
+ _dialchartYValues.add(Arrays.asList(new Double[]{135.}));
+ _dialchartYValues.add(Arrays.asList(new Double[]{106.}));
+
+ _chartXValues = new ArrayList<List<Double>>();
+ _chartXValues.add(Arrays.asList(new Double[]{6.1, 6.3, 6.5}));
+ _chartXValues.add(Arrays.asList(new Double[]{6.8, 7.1, 7.3}));
+ _chartXValues.add(Arrays.asList(new Double[]{7.6, 7.8, 8.0}));
+ _chartXValues.add(Arrays.asList(new Double[]{8.25, 8.55, 8.78}));
+ _chartXValues.add(Arrays.asList(new Double[]{9.23, 9.48, 9.88}));
+ }
+
+ }
+
+ private boolean _largerDataSet = false;
+ private final ChartModel _chartModel = new MyChartModel();
+ private final ComponentEditorHandler _editorBean = new ComponentEditorHandler();
+}
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ChartBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ChartBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ClientValidationBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ClientValidationBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ClientValidationBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ClientValidationBean.java Wed Mar 7 06:44:35 2007
@@ -0,0 +1,230 @@
+/*
+ * 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.math.BigDecimal;
+import java.util.Date;
+
+public class ClientValidationBean implements java.io.Serializable
+{
+
+ public ClientValidationBean()
+ {
+ }
+
+ public BigDecimal getBigDecimal()
+ {
+ return _bigDecimal ;
+ }
+
+ public void setBigDecimal(BigDecimal bigDecimal)
+ {
+ _bigDecimal = bigDecimal;
+ }
+
+
+ public Integer getInteger()
+ {
+ return _integer ;
+ }
+
+ public void setInteger(Integer integer)
+ {
+ _integer = integer;
+ }
+
+ public Short getShort()
+ {
+ return _short ;
+ }
+
+ public void setShort(Short shortObj)
+ {
+ _short = shortObj;
+ }
+
+ public Byte getByte()
+ {
+ return _byte ;
+ }
+
+ public void setByte(Byte byteObj)
+ {
+ _byte = byteObj;
+ }
+
+ public Long getLong()
+ {
+ return _long ;
+ }
+
+ public void setLong(Long longObj)
+ {
+ _long = longObj;
+ }
+
+ public Long getLong2()
+ {
+ return _long2 ;
+ }
+
+ public void setLong2(Long longObj)
+ {
+ _long2 = longObj;
+ }
+
+ public Long getLongValue()
+ {
+ return _longValue ;
+ }
+
+ public void setLongValue(Long longObj)
+ {
+ _longValue = longObj;
+ }
+
+ public Float getFloat()
+ {
+ return _float ;
+ }
+
+ public void setFloat(Float floatObj)
+ {
+ _float = floatObj;
+ }
+
+ public Double getDouble()
+ {
+ return _double ;
+ }
+
+ public void setDouble(Double doubleObj)
+ {
+ _double = doubleObj;
+ }
+
+
+ public Double getDouble2()
+ {
+ return _double2 ;
+ }
+
+ public void setDouble2(Double doubleObj)
+ {
+ _double2 = doubleObj;
+ }
+
+
+ public Double getDouble3()
+ {
+ return _double3 ;
+ }
+
+ public void setDouble3(Double doubleObj)
+ {
+ _double3 = doubleObj;
+ }
+
+
+ public String getText()
+ {
+ return _text ;
+ }
+
+ public void setText(String text)
+ {
+ _text = text;
+ }
+
+ public Integer getSsn()
+ {
+ return _ssn ;
+ }
+
+ public void setSsn(Integer ssn)
+ {
+ _ssn = ssn;
+ }
+
+
+ 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 String getLengthValue()
+ {
+ return _legthValue;
+ }
+
+ public void setLengthValue(String value)
+ {
+ _legthValue = value;
+ }
+
+ public Date getDate()
+ {
+ return _date;
+ }
+
+ public void setDate(Date date)
+ {
+ _date = date;
+ }
+
+
+ private Integer _ssn = null;
+ private String _text = "This is bound text";
+ private Integer _integer = null;
+ private BigDecimal _bigDecimal = null;
+ private Long _long = null;
+ private Long _longValue = null;
+ private Long _long2 = null;
+ private Short _short = null;
+ private Byte _byte = null;
+ private Double _double = null;
+ private Double _double2 = null;
+ private Double _double3 = null;
+ private Float _float = null;
+
+ private String _regExpValue = null;
+
+ private String _byteLegthValue = null;
+ private String _legthValue = null;
+ private Date _date = new Date();
+
+
+}
+
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ClientValidationBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ClientValidationBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ColorBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ColorBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ColorBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ColorBean.java Wed Mar 7 06:44:35 2007
@@ -0,0 +1,97 @@
+/*
+ * 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.util.ArrayList;
+import java.util.List;
+
+/**
+ * Managed bean for color component demos.
+ * @version $Name: $ ($Revision$) $Date$
+ */
+public class ColorBean implements java.io.Serializable
+{
+ public Color getColorValue1()
+ {
+ return _colorValue1;
+ }
+
+ public void setColorValue1(Color colorValue)
+ {
+ _colorValue1 = colorValue;
+ }
+
+ public Color getColorValue2()
+ {
+ return _colorValue2;
+ }
+
+ public void setColorValue2(Color colorValue)
+ {
+ _colorValue2 = colorValue;
+ }
+
+ public Color getColorValue3()
+ {
+ return _colorValue3;
+ }
+
+ public void setColorValue3(Color colorValue)
+ {
+ _colorValue3 = colorValue;
+ }
+
+ public Color getColorValue4()
+ {
+ return _colorValue4;
+ }
+
+ public void setColorValue4(Color colorValue)
+ {
+ _colorValue4 = colorValue;
+ }
+
+ public Color[] getColorArray()
+ {
+ Color[] colorArray = new Color[4];
+ colorArray[0] = _colorValue1;
+ colorArray[1] = _colorValue2;
+ colorArray[2] = _colorValue3;
+ colorArray[3] = _colorValue4;
+ return colorArray;
+ }
+
+ public List<Color> getColorList()
+ {
+ List<Color> colorList = new ArrayList<Color>();
+ colorList.add(_colorValue3);
+ colorList.add(_colorValue1);
+ colorList.add(_colorValue4);
+ colorList.add(_colorValue2);
+ return colorList;
+ }
+
+ private Color _colorValue1 = new Color(255, 0, 0);
+ private Color _colorValue2 = new Color(0, 255, 0);
+ private Color _colorValue3 = new Color(0, 0, 255);
+ private Color _colorValue4 = new Color(255, 255, 0);
+
+}
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ColorBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ColorBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentEditorHandler.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentEditorHandler.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentEditorHandler.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentEditorHandler.java Wed Mar 7 06:44:35 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/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentEditorHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentEditorHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentTree.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentTree.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentTree.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentTree.java Wed Mar 7 06:44:35 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/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentTree.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ComponentTree.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ConverterValidatorBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ConverterValidatorBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ConverterValidatorBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ConverterValidatorBean.java Wed Mar 7 06:44:35 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/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ConverterValidatorBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ConverterValidatorBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CustomMessageConvertValidateBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CustomMessageConvertValidateBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CustomMessageConvertValidateBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CustomMessageConvertValidateBean.java Wed Mar 7 06:44:35 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/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CustomMessageConvertValidateBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/CustomMessageConvertValidateBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DataBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DataBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DataBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DataBean.java Wed Mar 7 06:44:35 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/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DataBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DataBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateBean.java Wed Mar 7 06:44:35 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/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateRestrictionValidatorBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateRestrictionValidatorBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateRestrictionValidatorBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateRestrictionValidatorBean.java Wed Mar 7 06:44:35 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/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateRestrictionValidatorBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DateRestrictionValidatorBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoCommandNavigationItemBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoCommandNavigationItemBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoCommandNavigationItemBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoCommandNavigationItemBean.java Wed Mar 7 06:44:35 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/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoCommandNavigationItemBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoCommandNavigationItemBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoTreeData.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoTreeData.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoTreeData.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoTreeData.java Wed Mar 7 06:44:35 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/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoTreeData.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/DemoTreeData.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/GermanHolidayDateListProvider.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/GermanHolidayDateListProvider.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/GermanHolidayDateListProvider.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/GermanHolidayDateListProvider.java Wed Mar 7 06:44:35 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/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/GermanHolidayDateListProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/GermanHolidayDateListProvider.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/InfiniteTree.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/InfiniteTree.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/InfiniteTree.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/InfiniteTree.java Wed Mar 7 06:44:35 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/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/InfiniteTree.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/InfiniteTree.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL