You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2007/08/09 22:01:10 UTC
svn commit: r564363 - in /myfaces/tobago/trunk:
contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/
contrib/facelets/src/main/resources/META-INF/
core/src/main/java/org/apache/myfaces/tobago/
core/src/main/java/org/apache/myfac...
Author: bommel
Date: Thu Aug 9 13:01:06 2007
New Revision: 564363
URL: http://svn.apache.org/viewvc?view=rev&rev=564363
Log:
(TOBAGO-460) Markup attribute for label
Added:
myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/
myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java
myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/FileExtensionHandler.java
myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/InExtensionHandler.java
myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/SelectBooleanCheckboxExtensionHandler.java
myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/SelectManyListboxExtensionHandler.java
myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/SelectOneChoiceExtensionHandler.java
myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/SelectOneListboxExtensionHandler.java
myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TextAreaExtensionHandler.java
myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoExtensionHandler.java
myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoExtensionTagLibrary.java
myfaces/tobago/trunk/contrib/facelets/src/main/resources/META-INF/tobago-facelet-extension.taglib.xml
- copied, changed from r561101, myfaces/tobago/trunk/contrib/facelets/src/main/resources/META-INF/tobago-extension.taglib.xml
Removed:
myfaces/tobago/trunk/contrib/facelets/src/main/resources/META-INF/tobago-extension.taglib.xml
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UILabel.java
Added: myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java?view=auto&rev=564363
==============================================================================
--- myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java (added)
+++ myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java Thu Aug 9 13:01:06 2007
@@ -0,0 +1,68 @@
+package org.apache.myfaces.tobago.facelets.extension;
+
+/*
+ * 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.
+ */
+
+import com.sun.facelets.FaceletContext;
+import com.sun.facelets.tag.jsf.ComponentConfig;
+import com.sun.facelets.tag.jsf.ComponentSupport;
+import org.apache.myfaces.tobago.TobagoConstants;
+import org.apache.myfaces.tobago.component.UIDateInput;
+import org.apache.myfaces.tobago.component.UIDatePicker;
+
+import javax.faces.application.Application;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+
+/*
+ * Date: Aug 8, 2007
+ * Time: 5:47:26 PM
+ */
+public class DateExtensionHandler extends TobagoExtensionHandler {
+
+ public DateExtensionHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ protected String getSubComponentType() {
+ return UIDateInput.COMPONENT_TYPE;
+ }
+
+ protected String getSubRendererType() {
+ return TobagoConstants.RENDERER_TYPE_DATE;
+ }
+
+ protected void onComponentPopulated(FaceletContext faceletContext, UIComponent panel, UIComponent parent) {
+ if (panel.getChildCount()==2) {
+ Application application = faceletContext.getFacesContext().getApplication();
+ UIDatePicker picker = (UIDatePicker) application.createComponent(UIDatePicker.COMPONENT_TYPE);
+ picker.setRendererType(TobagoConstants.RENDERER_TYPE_DATE_PICKER);
+ picker.setFor("@auto");
+ UIViewRoot root = ComponentSupport.getViewRoot(faceletContext, parent);
+ picker.setId(root.createUniqueId());
+ if (picker.getAttributes().get(TobagoConstants.TOBAGO_COMPONENT_CREATED) == null) {
+ picker.getAttributes().put(TobagoConstants.TOBAGO_COMPONENT_CREATED, Boolean.TRUE);
+ picker.onComponentCreated();
+ }
+ panel.getChildren().add(picker);
+ }
+ }
+
+ protected String getColumns(String first) {
+ return first + ";*;fixed";
+ }
+}
Added: myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/FileExtensionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/FileExtensionHandler.java?view=auto&rev=564363
==============================================================================
--- myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/FileExtensionHandler.java (added)
+++ myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/FileExtensionHandler.java Thu Aug 9 13:01:06 2007
@@ -0,0 +1,41 @@
+package org.apache.myfaces.tobago.facelets.extension;
+
+/*
+ * 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.
+ */
+
+import com.sun.facelets.tag.jsf.ComponentConfig;
+import org.apache.myfaces.tobago.TobagoConstants;
+import org.apache.myfaces.tobago.component.UIFileInput;
+
+/*
+ * Date: Aug 8, 2007
+ * Time: 5:45:16 PM
+ */
+public class FileExtensionHandler extends TobagoExtensionHandler {
+
+ public FileExtensionHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ protected String getSubComponentType() {
+ return UIFileInput.COMPONENT_TYPE;
+ }
+
+ protected String getSubRendererType() {
+ return TobagoConstants.RENDERER_TYPE_FILE;
+ }
+}
Added: myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/InExtensionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/InExtensionHandler.java?view=auto&rev=564363
==============================================================================
--- myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/InExtensionHandler.java (added)
+++ myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/InExtensionHandler.java Thu Aug 9 13:01:06 2007
@@ -0,0 +1,41 @@
+package org.apache.myfaces.tobago.facelets.extension;
+
+/*
+ * 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.
+ */
+
+import com.sun.facelets.tag.jsf.ComponentConfig;
+import org.apache.myfaces.tobago.TobagoConstants;
+import org.apache.myfaces.tobago.component.UIInput;
+
+/*
+ * Date: Aug 8, 2007
+ * Time: 5:43:10 PM
+ */
+public class InExtensionHandler extends TobagoExtensionHandler {
+
+ public InExtensionHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ protected String getSubComponentType() {
+ return UIInput.COMPONENT_TYPE;
+ }
+
+ protected String getSubRendererType() {
+ return TobagoConstants.RENDERER_TYPE_IN;
+ }
+}
Added: myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/SelectBooleanCheckboxExtensionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/SelectBooleanCheckboxExtensionHandler.java?view=auto&rev=564363
==============================================================================
--- myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/SelectBooleanCheckboxExtensionHandler.java (added)
+++ myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/SelectBooleanCheckboxExtensionHandler.java Thu Aug 9 13:01:06 2007
@@ -0,0 +1,41 @@
+package org.apache.myfaces.tobago.facelets.extension;
+
+/*
+ * 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.
+ */
+
+import com.sun.facelets.tag.jsf.ComponentConfig;
+import org.apache.myfaces.tobago.TobagoConstants;
+import org.apache.myfaces.tobago.component.UISelectBoolean;
+
+/*
+ * Date: Aug 9, 2007
+ * Time: 8:36:38 PM
+ */
+public class SelectBooleanCheckboxExtensionHandler extends TobagoExtensionHandler {
+
+ public SelectBooleanCheckboxExtensionHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ protected String getSubComponentType() {
+ return UISelectBoolean.COMPONENT_TYPE;
+ }
+
+ protected String getSubRendererType() {
+ return TobagoConstants.RENDERER_TYPE_SELECT_BOOLEAN_CHECKBOX;
+ }
+}
Added: myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/SelectManyListboxExtensionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/SelectManyListboxExtensionHandler.java?view=auto&rev=564363
==============================================================================
--- myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/SelectManyListboxExtensionHandler.java (added)
+++ myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/SelectManyListboxExtensionHandler.java Thu Aug 9 13:01:06 2007
@@ -0,0 +1,41 @@
+package org.apache.myfaces.tobago.facelets.extension;
+
+/*
+ * 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.
+ */
+
+import com.sun.facelets.tag.jsf.ComponentConfig;
+import org.apache.myfaces.tobago.TobagoConstants;
+import org.apache.myfaces.tobago.component.UISelectMany;
+
+/*
+ * Date: Aug 9, 2007
+ * Time: 8:37:36 PM
+ */
+public class SelectManyListboxExtensionHandler extends TobagoExtensionHandler {
+
+ public SelectManyListboxExtensionHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ protected String getSubComponentType() {
+ return UISelectMany.COMPONENT_TYPE;
+ }
+
+ protected String getSubRendererType() {
+ return TobagoConstants.RENDERER_TYPE_SELECT_MANY_LISTBOX;
+ }
+}
Added: myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/SelectOneChoiceExtensionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/SelectOneChoiceExtensionHandler.java?view=auto&rev=564363
==============================================================================
--- myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/SelectOneChoiceExtensionHandler.java (added)
+++ myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/SelectOneChoiceExtensionHandler.java Thu Aug 9 13:01:06 2007
@@ -0,0 +1,41 @@
+package org.apache.myfaces.tobago.facelets.extension;
+
+/*
+ * 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.
+ */
+
+import com.sun.facelets.tag.jsf.ComponentConfig;
+import org.apache.myfaces.tobago.TobagoConstants;
+import org.apache.myfaces.tobago.component.UISelectOne;
+
+/*
+ * Date: Aug 9, 2007
+ * Time: 8:38:28 PM
+ */
+public class SelectOneChoiceExtensionHandler extends TobagoExtensionHandler {
+
+ public SelectOneChoiceExtensionHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ protected String getSubComponentType() {
+ return UISelectOne.COMPONENT_TYPE;
+ }
+
+ protected String getSubRendererType() {
+ return TobagoConstants.RENDERER_TYPE_SELECT_ONE_CHOICE;
+ }
+}
Added: myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/SelectOneListboxExtensionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/SelectOneListboxExtensionHandler.java?view=auto&rev=564363
==============================================================================
--- myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/SelectOneListboxExtensionHandler.java (added)
+++ myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/SelectOneListboxExtensionHandler.java Thu Aug 9 13:01:06 2007
@@ -0,0 +1,41 @@
+package org.apache.myfaces.tobago.facelets.extension;
+
+/*
+ * 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.
+ */
+
+import com.sun.facelets.tag.jsf.ComponentConfig;
+import org.apache.myfaces.tobago.TobagoConstants;
+import org.apache.myfaces.tobago.component.UISelectOne;
+
+/*
+ * Date: Aug 9, 2007
+ * Time: 8:39:46 PM
+ */
+public class SelectOneListboxExtensionHandler extends TobagoExtensionHandler {
+
+ public SelectOneListboxExtensionHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ protected String getSubComponentType() {
+ return UISelectOne.COMPONENT_TYPE;
+ }
+
+ protected String getSubRendererType() {
+ return TobagoConstants.RENDERER_TYPE_SELECT_ONE_LISTBOX;
+ }
+}
Added: myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TextAreaExtensionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TextAreaExtensionHandler.java?view=auto&rev=564363
==============================================================================
--- myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TextAreaExtensionHandler.java (added)
+++ myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TextAreaExtensionHandler.java Thu Aug 9 13:01:06 2007
@@ -0,0 +1,41 @@
+package org.apache.myfaces.tobago.facelets.extension;
+
+/*
+ * 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.
+ */
+
+import com.sun.facelets.tag.jsf.ComponentConfig;
+import org.apache.myfaces.tobago.TobagoConstants;
+import org.apache.myfaces.tobago.component.UIInput;
+
+/*
+ * Date: Aug 8, 2007
+ * Time: 5:49:07 PM
+ */
+public class TextAreaExtensionHandler extends TobagoExtensionHandler {
+
+ public TextAreaExtensionHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ protected String getSubComponentType() {
+ return UIInput.COMPONENT_TYPE;
+ }
+
+ protected String getSubRendererType() {
+ return TobagoConstants.RENDERER_TYPE_TEXT_AREA;
+ }
+}
Added: myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoExtensionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoExtensionHandler.java?view=auto&rev=564363
==============================================================================
--- myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoExtensionHandler.java (added)
+++ myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoExtensionHandler.java Thu Aug 9 13:01:06 2007
@@ -0,0 +1,136 @@
+package org.apache.myfaces.tobago.facelets.extension;
+
+/*
+ * 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.
+ */
+
+import com.sun.facelets.FaceletContext;
+import com.sun.facelets.tag.MetaRuleset;
+import com.sun.facelets.tag.TagAttribute;
+import com.sun.facelets.tag.jsf.ComponentConfig;
+import com.sun.facelets.tag.jsf.ComponentHandler;
+import com.sun.facelets.tag.jsf.ComponentSupport;
+import org.apache.myfaces.tobago.TobagoConstants;
+import org.apache.myfaces.tobago.component.SupportsMarkup;
+import org.apache.myfaces.tobago.component.UIGridLayout;
+import org.apache.myfaces.tobago.component.UILabel;
+import org.apache.myfaces.tobago.component.UIPanel;
+import org.apache.myfaces.tobago.facelets.SupportsMarkupRule;
+
+import javax.el.ELException;
+import javax.faces.FacesException;
+import javax.faces.application.Application;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+import java.io.IOException;
+
+/*
+ * Date: Jul 31, 2007
+ * Time: 6:14:34 PM
+ */
+public abstract class TobagoExtensionHandler extends ComponentHandler {
+ private TagAttribute labelWidthAttribute;
+ private TagAttribute tipAttribute;
+ private TagAttribute labelAttribute;
+
+ public TobagoExtensionHandler(ComponentConfig config) {
+ super(config);
+ labelWidthAttribute = getAttribute("labelWidth");
+ tipAttribute = getAttribute(TobagoConstants.ATTR_TIP);
+ labelAttribute = getAttribute(TobagoConstants.ATTR_LABEL);
+ }
+
+ protected abstract String getSubComponentType();
+
+ protected abstract String getSubRendererType();
+
+ protected String getColumns(String first) {
+ return first + ";*";
+ }
+
+ protected void applyNextHandler(FaceletContext ctx, UIComponent panel)
+ throws IOException, FacesException, ELException {
+ nextHandler.apply(ctx, (UIComponent) panel.getChildren().get(1));
+ }
+
+ protected void onComponentCreated(FaceletContext faceletContext, UIComponent panel, UIComponent parent) {
+
+ Application application = faceletContext.getFacesContext().getApplication();
+ UIViewRoot root = ComponentSupport.getViewRoot(faceletContext, parent);
+
+ addGridLayout(faceletContext, panel, root);
+
+ addLabel(faceletContext, panel, root);
+
+ UIComponent input = application.createComponent(getSubComponentType());
+ input.setRendererType(getSubRendererType());
+ String uid = root.createUniqueId();
+ input.setId(uid);
+
+ setAttributes(faceletContext, input);
+
+ panel.getChildren().add(input);
+ }
+
+
+ private void addLabel(FaceletContext faceletContext, UIComponent panel, UIViewRoot root) {
+ Application application = faceletContext.getFacesContext().getApplication();
+ UILabel label = (UILabel) application.createComponent(UILabel.COMPONENT_TYPE);
+ label.setRendererType(TobagoConstants.RENDERER_TYPE_LABEL);
+ label.setId(root.createUniqueId());
+ if (tipAttribute != null) {
+ label.setTip(tipAttribute.getValue(faceletContext));
+ }
+ if (labelAttribute != null) {
+ label.setValue(labelAttribute.getValue(faceletContext));
+ }
+ panel.getChildren().add(label);
+ }
+
+ private void addGridLayout(FaceletContext faceletContext, UIComponent panel, UIViewRoot root) {
+ Application application = faceletContext.getFacesContext().getApplication();
+ UIGridLayout gridLayout = (UIGridLayout) application.createComponent(UIGridLayout.COMPONENT_TYPE);
+ gridLayout.setRendererType(TobagoConstants.RENDERER_TYPE_GRID_LAYOUT);
+ if (labelWidthAttribute != null) {
+ gridLayout.setColumns(getColumns(labelWidthAttribute.getValue(faceletContext)));
+ } else {
+ gridLayout.setColumns(getColumns("fixed"));
+ }
+
+ gridLayout.setId(root.createUniqueId());
+ panel.getFacets().put(TobagoConstants.FACET_LAYOUT, gridLayout);
+ }
+
+ protected MetaRuleset createMetaRuleset(Class aClass) {
+ MetaRuleset metaRuleset = super.createMetaRuleset(aClass);
+ if (UIPanel.class.isAssignableFrom(aClass)) {
+ for (TagAttribute attr: tag.getAttributes().getAll()) {
+ if (!attr.getLocalName().equals("rendered")) {
+ metaRuleset.ignore(attr.getLocalName());
+ }
+ }
+ return metaRuleset;
+ } else {
+ metaRuleset.ignore(TobagoConstants.ATTR_LABEL);
+ metaRuleset.ignore(TobagoConstants.ATTR_TIP);
+ metaRuleset.ignore("labelWidth");
+ }
+ if (SupportsMarkup.class.isAssignableFrom(aClass)) {
+ metaRuleset.addRule(SupportsMarkupRule.INSTANCE);
+ }
+ return metaRuleset;
+ }
+}
Added: myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoExtensionTagLibrary.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoExtensionTagLibrary.java?view=auto&rev=564363
==============================================================================
--- myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoExtensionTagLibrary.java (added)
+++ myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoExtensionTagLibrary.java Thu Aug 9 13:01:06 2007
@@ -0,0 +1,44 @@
+package org.apache.myfaces.tobago.facelets.extension;
+
+/*
+ * 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.
+ */
+
+import com.sun.facelets.tag.AbstractTagLibrary;
+
+/*
+ * Date: Jul 31, 2007
+ * Time: 6:04:32 PM
+ */
+public class TobagoExtensionTagLibrary extends AbstractTagLibrary {
+
+ public static final String NAMESPACE = "http://myfaces.apache.org/tobago/extension";
+
+ public TobagoExtensionTagLibrary() {
+ super(NAMESPACE);
+ addComponent("in", "org.apache.myfaces.tobago.Panel", "Panel", InExtensionHandler.class);
+ addComponent("file", "org.apache.myfaces.tobago.Panel", "Panel", FileExtensionHandler.class);
+ addComponent("date", "org.apache.myfaces.tobago.Panel", "Panel", DateExtensionHandler.class);
+ addComponent("selectBooleanCheckbox", "org.apache.myfaces.tobago.Panel", "Panel", SelectBooleanCheckboxExtensionHandler.class);
+ addComponent("selectManyListbox", "org.apache.myfaces.tobago.Panel", "Panel", SelectManyListboxExtensionHandler.class);
+ addComponent("selectOneChoice", "org.apache.myfaces.tobago.Panel", "Panel", SelectOneChoiceExtensionHandler.class);
+ addComponent("selectOneListbox", "org.apache.myfaces.tobago.Panel", "Panel", SelectOneListboxExtensionHandler.class);
+
+
+ }
+
+
+}
Copied: myfaces/tobago/trunk/contrib/facelets/src/main/resources/META-INF/tobago-facelet-extension.taglib.xml (from r561101, myfaces/tobago/trunk/contrib/facelets/src/main/resources/META-INF/tobago-extension.taglib.xml)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/contrib/facelets/src/main/resources/META-INF/tobago-facelet-extension.taglib.xml?view=diff&rev=564363&p1=myfaces/tobago/trunk/contrib/facelets/src/main/resources/META-INF/tobago-extension.taglib.xml&r1=561101&p2=myfaces/tobago/trunk/contrib/facelets/src/main/resources/META-INF/tobago-facelet-extension.taglib.xml&r2=564363
==============================================================================
--- myfaces/tobago/trunk/contrib/facelets/src/main/resources/META-INF/tobago-extension.taglib.xml (original)
+++ myfaces/tobago/trunk/contrib/facelets/src/main/resources/META-INF/tobago-facelet-extension.taglib.xml Thu Aug 9 13:01:06 2007
@@ -57,4 +57,8 @@
<tag-name>selectManyListbox</tag-name>
<source>selectManyListbox.xml</source>
</tag>
+ <tag>
+ <tag-name>menuRadio</tag-name>
+ <source>menuRadio.xml</source>
+ </tag>
</facelet-taglib>
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java?view=diff&rev=564363&r1=564362&r2=564363
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java Thu Aug 9 13:01:06 2007
@@ -202,6 +202,7 @@
public static final String RENDERER_TYPE_CALENDAR = "Calendar";
public static final String RENDERER_TYPE_DATE = "Date";
public static final String RENDERER_TYPE_DEFAULT_LAYOUT = "DefaultLayout";
+ public static final String RENDERER_TYPE_FILE = "File";
public static final String RENDERER_TYPE_GRID_LAYOUT = "GridLayout";
public static final String RENDERER_TYPE_HIDDEN = "Hidden";
public static final String RENDERER_TYPE_IN = "In";
@@ -214,9 +215,13 @@
public static final String RENDERER_TYPE_PANEL = "Panel";
public static final String RENDERER_TYPE_POPUP = "Popup";
public static final String RENDERER_TYPE_DATE_PICKER = "DatePicker";
+ public static final String RENDERER_TYPE_SELECT_BOOLEAN_CHECKBOX = "SelectBooleanCheckbox";
+ public static final String RENDERER_TYPE_SELECT_MANY_CHECKBOX = "SelectManyCheckbox";
+ public static final String RENDERER_TYPE_SELECT_MANY_LISTBOX = "SelectManyListbox";
public static final String RENDERER_TYPE_SELECT_ONE_CHOICE = "SelectOneChoice";
public static final String RENDERER_TYPE_SELECT_ONE_RADIO = "SelectOneRadio";
- public static final String RENDERER_TYPE_SELECT_BOOLEAN_CHECKBOX = "SelectBooleanCheckbox";
+ public static final String RENDERER_TYPE_SELECT_ONE_LISTBOX = "SelectOneListbox";
+ public static final String RENDERER_TYPE_TEXT_AREA = "TextArea";
public static final String RENDERER_TYPE_TIME = "Time";
public static final String RENDERER_TYPE_TOOL_BAR = "ToolBar";
public static final String RENDERER_TYPE_TREE_NODE = "TreeNode";
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UILabel.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UILabel.java?view=diff&rev=564363&r1=564362&r2=564363
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UILabel.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UILabel.java Thu Aug 9 13:01:06 2007
@@ -20,10 +20,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.TobagoConstants;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
import javax.faces.component.UIComponent;
import javax.faces.component.UIOutput;
import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
import java.io.IOException;
public class UILabel extends UIOutput implements SupportsMarkup {
@@ -33,17 +35,38 @@
public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Label";
private String[] markup;
+ private String tip;
- public void restoreState(FacesContext context, Object state) {
+
+ public String getTip() {
+ if (tip != null) {
+ return tip;
+ }
+ ValueBinding vb = getValueBinding(ATTR_TIP);
+ if (vb != null) {
+ return (String) vb.getValue(getFacesContext());
+ } else {
+ return null;
+ }
+ }
+
+ public void setTip(String tip) {
+ this.tip = tip;
+ }
+
+
+ public void restoreState(FacesContext context, Object state) {
Object[] values = (Object[]) state;
super.restoreState(context, values[0]);
markup = (String[]) values[1];
+ tip = (String) values[2];
}
public Object saveState(FacesContext context) {
- Object[] values = new Object[2];
+ Object[] values = new Object[3];
values[0] = super.saveState(context);
values[1] = markup;
+ values[2] = tip;
return values;
}
@@ -74,8 +97,6 @@
}
}
}
-
super.encodeBegin(facesContext);
}
-
}