You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2020/06/17 10:52:48 UTC

[myfaces-tobago] branch master updated: Demo: clean up

This is an automated email from the ASF dual-hosted git repository.

lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/master by this push:
     new 8183d7f  Demo: clean up
8183d7f is described below

commit 8183d7fd195e181687be3ecf0ea1e0cc294893c0
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Wed Jun 17 12:52:28 2020 +0200

    Demo: clean up
---
 .../tobago/example/demo/CurrencyController.java    |  55 +++++
 .../tobago/example/demo/DemoController.java        | 226 ---------------------
 .../030-select/30-selectOneRadio/Radio.xhtml       |   2 +-
 .../50-selectManyCheckbox/Multi_Checkbox.xhtml     |   2 +-
 .../20-component/050-container/60-bar/Bar.xhtml    |   4 +-
 5 files changed, 59 insertions(+), 230 deletions(-)

diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CurrencyController.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CurrencyController.java
new file mode 100644
index 0000000..86cc45f
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CurrencyController.java
@@ -0,0 +1,55 @@
+/*
+ * 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.tobago.example.demo;
+
+import org.apache.deltaspike.core.api.scope.WindowScoped;
+import javax.inject.Named;
+import java.io.Serializable;
+import java.util.Currency;
+
+@WindowScoped
+@Named
+public class CurrencyController implements Serializable {
+
+  private String radioValue;
+  private final Currency[] currencyItems;
+
+  public CurrencyController() {
+    radioValue = "JPY";
+    currencyItems = new Currency[]{
+        Currency.getInstance("JPY"),
+        Currency.getInstance("TTD"),
+        Currency.getInstance("USD"),
+        Currency.getInstance("EUR")
+    };
+  }
+
+  public Currency[] getCurrencyItems() {
+    return currencyItems;
+  }
+
+  public String getRadioValue() {
+    return radioValue;
+  }
+
+  public void setRadioValue(final String radioValue) {
+    this.radioValue = radioValue;
+  }
+}
diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/DemoController.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/DemoController.java
deleted file mode 100644
index 6a3cb7b..0000000
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/DemoController.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * 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.tobago.example.demo;
-
-import org.apache.deltaspike.core.api.scope.WindowScoped;
-import org.apache.myfaces.tobago.component.UISheet;
-import org.apache.myfaces.tobago.model.Selectable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.event.ActionEvent;
-import javax.faces.validator.ValidatorException;
-import javax.inject.Named;
-import java.io.Serializable;
-import java.lang.invoke.MethodHandles;
-import java.util.ArrayList;
-import java.util.Currency;
-import java.util.Date;
-
-@WindowScoped
-@Named(value = "demoController")
-public class DemoController implements Serializable {
-
-  private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
-  private static final Selectable[] TREE_SELECT_MODE_KEYS = {
-      Selectable.none,
-      Selectable.single,
-      Selectable.singleLeafOnly,
-      Selectable.multi,
-      Selectable.multiLeafOnly,
-      Selectable.multiCascade
-  };
-
-  private static final Selectable[] TREELISTBOX_SELECT_MODE_KEYS = {
-      Selectable.single,
-      Selectable.singleLeafOnly,
-      Selectable.siblingLeafOnly
-  };
-
-  private String radioValue;
-  private Currency[] currencyItems;
-
-  /*
-    @Required
-  */
-  private String basicInput;
-
-  private String suggestInput;
-
-  private String placeholder;
-
-  private String basicArea = "";
-
-  private Date basicDate = new Date();
-
-  private Date basicTime = new Date();
-
-  private Selectable treeSelectMode;
-
-  private Selectable treeListboxSelectMode;
-
-  private String lastAction;
-
-  private SheetConfig sheetConfig;
-
-  public DemoController() {
-    radioValue = "JPY";
-    currencyItems = new Currency[]{
-        Currency.getInstance("JPY"),
-        Currency.getInstance("TTD"),
-        Currency.getInstance("USD"),
-        Currency.getInstance("EUR")
-    };
-    treeSelectMode = TREE_SELECT_MODE_KEYS[3];
-    treeListboxSelectMode = TREELISTBOX_SELECT_MODE_KEYS[0];
-    sheetConfig = new SheetConfig();
-  }
-
-  public void click(final ActionEvent actionEvent) {
-    LOG.info("click the action listener");
-    lastAction = actionEvent.getComponent().getId();
-  }
-
-  public void resetColumnWidths(final ActionEvent event) {
-    final UISheet sheet = (UISheet) event.getComponent().findComponent("sheet");
-    if (sheet != null) {
-      sheet.getState().setColumnWidths(new ArrayList<>());
-    } else {
-      LOG.warn("Didn't find sheet component!");
-    }
-  }
-
-  public String ping() {
-    LOG.debug("ping invoked");
-    return null;
-  }
-
-  public void customValidator(final FacesContext context, final UIComponent component, final Object value)
-      throws ValidatorException {
-    if (value == null) {
-      return;
-    }
-    if (!"tobago".equalsIgnoreCase(value.toString())) {
-      throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Please type in 'Tobago'",
-          "Please type in 'Tobago'"));
-    }
-  }
-
-  public boolean getShowPopup() {
-    return "popupButton".equals(lastAction) || "popupButton2".equals(lastAction);
-  }
-
-  public Currency[] getCurrencyItems() {
-    return currencyItems;
-  }
-
-  public String getRadioValue() {
-    return radioValue;
-  }
-
-  public void setRadioValue(final String radioValue) {
-    this.radioValue = radioValue;
-  }
-
-  public Date getBasicDate() {
-    return basicDate;
-  }
-
-  public void setBasicDate(final Date basicDate) {
-    this.basicDate = basicDate;
-  }
-
-  public Date getBasicTime() {
-    return basicTime;
-  }
-
-  public void setBasicTime(final Date basicTime) {
-    this.basicTime = basicTime;
-  }
-
-  public Selectable getTreeSelectMode() {
-    return treeSelectMode;
-  }
-
-  public void setTreeSelectMode(final Selectable treeSelectMode) {
-    this.treeSelectMode = treeSelectMode;
-  }
-
-  public Selectable getTreeListboxSelectMode() {
-    return treeListboxSelectMode;
-  }
-
-  public void setTreeListboxSelectMode(final Selectable treeListboxSelectMode) {
-    this.treeListboxSelectMode = treeListboxSelectMode;
-  }
-
-  public String getBasicInput() {
-    return basicInput;
-  }
-
-  public void setBasicInput(final String basicInput) {
-    this.basicInput = basicInput;
-  }
-
-  public String getSuggestInput() {
-    return suggestInput;
-  }
-
-  public void setSuggestInput(final String suggestInput) {
-    this.suggestInput = suggestInput;
-  }
-
-  public String getPlaceholder() {
-    return placeholder;
-  }
-
-  public void setPlaceholder(final String placeholder) {
-    this.placeholder = placeholder;
-  }
-
-  public String getBasicArea() {
-    return basicArea;
-  }
-
-  public void setBasicArea(final String basicArea) {
-    this.basicArea = basicArea;
-  }
-
-  public String getLastAction() {
-    return lastAction;
-  }
-
-  public SheetConfig getSheetConfig() {
-    return sheetConfig;
-  }
-
-  public void setSheetConfig(final SheetConfig sheetConfig) {
-    this.sheetConfig = sheetConfig;
-  }
-
-  public String noop() {
-    LOG.info("noop");
-    return null;
-  }
-}
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/30-selectOneRadio/Radio.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/30-selectOneRadio/Radio.xhtml
index 156d98c..1e80945 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/30-selectOneRadio/Radio.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/30-selectOneRadio/Radio.xhtml
@@ -73,7 +73,7 @@
 
   <tc:section label="Images">
     <tc:selectOneRadio>
-      <tc:selectItems value="#{demoController.currencyItems}"
+      <tc:selectItems value="#{currencyController.currencyItems}"
                       var="currency" itemValue="#{currency.currencyCode}" itemLabel="#{currency.displayName}"
                       itemImage="#{request.contextPath}/image/#{currency.currencyCode}-14.png"/>
     </tc:selectOneRadio>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/Multi_Checkbox.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/Multi_Checkbox.xhtml
index bec54f7..a0f2b4d 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/Multi_Checkbox.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/030-select/50-selectManyCheckbox/Multi_Checkbox.xhtml
@@ -67,7 +67,7 @@
 
   <tc:section label="Images">
     <tc:selectManyCheckbox>
-      <tc:selectItems value="#{demoController.currencyItems}"
+      <tc:selectItems value="#{currencyController.currencyItems}"
                       var="currency" itemValue="#{currency.currencyCode}" itemLabel="#{currency.displayName}"
                       itemImage="#{request.contextPath}/image/#{currency.currencyCode}-14.png"/>
     </tc:selectManyCheckbox>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/050-container/60-bar/Bar.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/050-container/60-bar/Bar.xhtml
index 5df1b26..3770351 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/050-container/60-bar/Bar.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/050-container/60-bar/Bar.xhtml
@@ -110,8 +110,8 @@
       </f:facet>
       <tc:links>
         <tc:link omit="true" label="Radio">
-          <tc:selectOneRadio value="#{demoController.radioValue}">
-            <tc:selectItems value="#{demoController.currencyItems}"
+          <tc:selectOneRadio value="#{currencyController.radioValue}">
+            <tc:selectItems value="#{currencyController.currencyItems}"
                             var="currency" itemValue="#{currency.currencyCode}" itemLabel="#{currency.displayName}"
                             itemImage="#{request.contextPath}/data/#{currency.currencyCode}-14.png"/>
           </tc:selectOneRadio>