You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2014/04/16 14:47:15 UTC
svn commit: r1587894 - in /pivot/branches/2.0.x:
wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java
wtk/src/org/apache/pivot/wtk/TabPane.java
wtk/src/org/apache/pivot/wtk/skin/TabPaneSkin.java
Author: smartini
Date: Wed Apr 16 12:47:14 2014
New Revision: 1587894
URL: http://svn.apache.org/r1587894
Log:
PIVOT-942, the patch revised (like in TablePane, move skin in its own class even if near-empty here)
Added:
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TabPaneSkin.java
Modified:
pivot/branches/2.0.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/TabPane.java
Modified: pivot/branches/2.0.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java?rev=1587894&r1=1587893&r2=1587894&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java (original)
+++ pivot/branches/2.0.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java Wed Apr 16 12:47:14 2014
@@ -30,7 +30,6 @@ import org.apache.pivot.collections.Sequ
import org.apache.pivot.util.Vote;
import org.apache.pivot.wtk.ApplicationContext;
import org.apache.pivot.wtk.Bounds;
-import org.apache.pivot.wtk.BoxPane;
import org.apache.pivot.wtk.Button;
import org.apache.pivot.wtk.ButtonGroup;
import org.apache.pivot.wtk.ButtonGroupListener;
@@ -59,12 +58,12 @@ import org.apache.pivot.wtk.effects.Tran
import org.apache.pivot.wtk.effects.easing.Easing;
import org.apache.pivot.wtk.effects.easing.Quadratic;
import org.apache.pivot.wtk.skin.ButtonSkin;
-import org.apache.pivot.wtk.skin.ContainerSkin;
+import org.apache.pivot.wtk.skin.TabPaneSkin;
/**
* Tab pane skin.
*/
-public class TerraTabPaneSkin extends ContainerSkin
+public class TerraTabPaneSkin extends TabPaneSkin
implements TabPaneListener, TabPaneSelectionListener, TabPaneAttributeListener {
/**
* Tab button component.
@@ -530,7 +529,7 @@ public class TerraTabPaneSkin extends Co
}
private Panorama tabButtonPanorama = new Panorama();
- private BoxPane tabButtonBoxPane = new BoxPane();
+ // private BoxPane tabButtonBoxPane = new BoxPane();
private ButtonGroup tabButtonGroup = new ButtonGroup();
private Color activeTabColor;
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/TabPane.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/TabPane.java?rev=1587894&r1=1587893&r2=1587894&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/TabPane.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/TabPane.java Wed Apr 16 12:47:14 2014
@@ -25,6 +25,7 @@ import org.apache.pivot.util.ImmutableIt
import org.apache.pivot.util.ListenerList;
import org.apache.pivot.util.Vote;
import org.apache.pivot.wtk.content.ButtonDataRenderer;
+import org.apache.pivot.wtk.skin.TabPaneSkin;
/**
* Container that provides access to a set of components via selectable tabs,
@@ -150,6 +151,16 @@ public class TabPane extends Container {
}
}
+ /**
+ * Tab pane skin interface. Tab pane skins must implement
+ * this interface to facilitate additional communication between the
+ * component and the skin.
+ */
+ public interface Skin {
+ boolean isVisible(int index);
+ void setVisible(int index, boolean value);
+ }
+
private enum Attribute {
TAB_DATA,
TOOLTIP_TEXT;
@@ -415,6 +426,21 @@ public class TabPane extends Container {
}
}
+ public boolean isTabVisible(int index) {
+ TabPane.Skin tabPaneSkin = (TabPane.Skin)getSkin();
+ if (tabPaneSkin instanceof TabPaneSkin) {
+ return ((TabPaneSkin)tabPaneSkin).isVisible(index);
+ }
+ return true;
+ }
+
+ public void setTabVisible(int index, boolean value) {
+ TabPane.Skin tabPaneSkin = (TabPane.Skin)getSkin();
+ if (tabPaneSkin instanceof TabPaneSkin) {
+ ((TabPaneSkin)tabPaneSkin).setVisible(index, value);
+ }
+ }
+
@Override
public Sequence<Component> remove(int index, int count) {
for (int i = index, n = index + count; i < n; i++) {
Added: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TabPaneSkin.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TabPaneSkin.java?rev=1587894&view=auto
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TabPaneSkin.java (added)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TabPaneSkin.java Wed Apr 16 12:47:14 2014
@@ -0,0 +1,44 @@
+/*
+ * 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.pivot.wtk.skin;
+
+import org.apache.pivot.wtk.BoxPane;
+import org.apache.pivot.wtk.TabPane;
+
+
+/**
+ * Tab pane skin.
+ *
+ * Note that this class is abstract but only because in layout method there are many things
+ * already defined that uses the original skin implementation (TerraTabPaneSkin).
+ */
+public abstract class TabPaneSkin extends ContainerSkin
+ implements TabPane.Skin {
+
+ protected BoxPane tabButtonBoxPane = new BoxPane();
+
+ @Override
+ public boolean isVisible(int index) {
+ return tabButtonBoxPane.get(index).isVisible();
+ }
+
+ @Override
+ public void setVisible(int index, boolean value) {
+ tabButtonBoxPane.get(index).setVisible(value);
+ }
+
+}