You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by do...@apache.org on 2020/12/03 16:29:18 UTC

[empire-db] branch master updated: EMPIREDB-337 added attribute "hideTabBar"

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

doebele pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/empire-db.git


The following commit(s) were added to refs/heads/master by this push:
     new fd63d00  EMPIREDB-337 added attribute "hideTabBar"
fd63d00 is described below

commit fd63d00293aee2522ba7bff11ba09b19a557ccc7
Author: Rainer Döbele <do...@apache.org>
AuthorDate: Thu Dec 3 17:29:13 2020 +0100

    EMPIREDB-337
    added attribute "hideTabBar"
---
 .../apache/empire/jsf2/components/TabViewTag.java  | 61 +++++++++++++---------
 1 file changed, 35 insertions(+), 26 deletions(-)

diff --git a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/TabViewTag.java b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/TabViewTag.java
index d24204b..0901297 100644
--- a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/TabViewTag.java
+++ b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/TabViewTag.java
@@ -156,16 +156,23 @@ public class TabViewTag extends UIOutput implements NamingContainer
         this.helper.writeAttribute(writer, InputControl.HTML_ATTR_STYLE, this.helper.getTagAttributeString("style"));
 
         // The Tabs
-        writer.startElement(InputControl.HTML_TAG_TABLE, this);
-        writer.writeAttribute(InputControl.HTML_ATTR_CLASS, "eTabBar", null);
-        writer.startElement(InputControl.HTML_TAG_TR, this);
-        encodeTabs(context, writer);
-        writer.startElement(InputControl.HTML_TAG_TD, this);
-        writer.writeAttribute(InputControl.HTML_ATTR_CLASS, "eTabBarEmpty", null);
-        writer.endElement(InputControl.HTML_TAG_TD);
-        writer.endElement(InputControl.HTML_TAG_TR);
-        writer.endElement(InputControl.HTML_TAG_TABLE);
-
+        if (ObjectUtils.getBoolean(this.helper.getTagAttributeValue("hideTabBar")))
+        {   // hideTabs
+            encodeTabs(context, null);
+        }
+        else
+        {   // showTabs
+            writer.startElement(InputControl.HTML_TAG_TABLE, this);
+            writer.writeAttribute(InputControl.HTML_ATTR_CLASS, "eTabBar", null);
+            writer.startElement(InputControl.HTML_TAG_TR, this);
+            encodeTabs(context, writer);
+            writer.startElement(InputControl.HTML_TAG_TD, this);
+            writer.writeAttribute(InputControl.HTML_ATTR_CLASS, "eTabBarEmpty", null);
+            writer.endElement(InputControl.HTML_TAG_TD);
+            writer.endElement(InputControl.HTML_TAG_TR);
+            writer.endElement(InputControl.HTML_TAG_TABLE);
+        }
+        
         // The Pages
         writer.startElement(InputControl.HTML_TAG_TABLE, this);
         writer.writeAttribute(InputControl.HTML_ATTR_CLASS, "eTabPanel", null);
@@ -257,23 +264,25 @@ public class TabViewTag extends UIOutput implements NamingContainer
                 page.setRendered(false);
                 continue;
             }
-
-            boolean disabled = ObjectUtils.getBoolean(TagEncodingHelper.getTagAttributeValue(page, "disabled"));
-            writer.startElement(InputControl.HTML_TAG_TD, this);
-            // tab label
-            String styleClass = "eTabLabel";
-            if (active)
-            {
-                styleClass += " eTabActive";
+            if (writer!=null)
+            {   // encode Tab
+                boolean disabled = ObjectUtils.getBoolean(TagEncodingHelper.getTagAttributeValue(page, "disabled"));
+                writer.startElement(InputControl.HTML_TAG_TD, this);
+                // tab label
+                String styleClass = "eTabLabel";
+                if (active)
+                {
+                    styleClass += " eTabActive";
+                }
+                else if (disabled)
+                {
+                    styleClass += " eTabDisabled";
+                }
+                writer.writeAttribute(InputControl.HTML_ATTR_CLASS, styleClass, null);
+                // encode Link
+                encodeTabLink(context, writer, index, page, (active || disabled));
+                writer.endElement(InputControl.HTML_TAG_TD);
             }
-            else if (disabled)
-            {
-                styleClass += " eTabDisabled";
-            }
-            writer.writeAttribute(InputControl.HTML_ATTR_CLASS, styleClass, null);
-            // encode Link
-            encodeTabLink(context, writer, index, page, (active || disabled));
-            writer.endElement(InputControl.HTML_TAG_TD);
             // set rendered
             page.setRendered(active);
             // next