You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jd...@apache.org on 2009/04/08 09:12:40 UTC
svn commit: r763126 -
/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tabs/TabbedPanel.java
Author: jdonnerstag
Date: Wed Apr 8 07:12:40 2009
New Revision: 763126
URL: http://svn.apache.org/viewvc?rev=763126&view=rev
Log:
fixed WICKET-2153 TabbedPanel accepts only ITab(s)
Modified:
wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tabs/TabbedPanel.java
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tabs/TabbedPanel.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tabs/TabbedPanel.java?rev=763126&r1=763125&r2=763126&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tabs/TabbedPanel.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tabs/TabbedPanel.java Wed Apr 8 07:12:40 2009
@@ -35,49 +35,34 @@
/**
* TabbedPanel component represets a panel with tabs that are used to switch between different
* content panels inside the TabbedPanel panel.
- *
* <p>
- * <b>Note:</b> When the currently selected tab is replaced by changing the underlying list of
- * tabs, the change is not picked up unless a call is made to {@link #setSelectedTab(int)}.
+ * <b>Note:</b> When the currently selected tab is replaced by changing the underlying list of tabs,
+ * the change is not picked up unless a call is made to {@link #setSelectedTab(int)}.
* <p>
- *
* Example:
*
* <pre>
- *
* List tabs=new ArrayList();
- *
* tabs.add(new AbstractTab(new Model<String>("first tab")) {
- *
* public Panel getPanel(String panelId)
* {
* return new TabPanel1(panelId);
* }
- *
* });
*
* tabs.add(new AbstractTab(new Model<String>("second tab")) {
- *
* public Panel getPanel(String panelId)
* {
* return new TabPanel2(panelId);
* }
- *
* });
*
* add(new TabbedPanel("tabs", tabs));
*
- *
* <span wicket:id="tabs" class="tabpanel">[tabbed panel will be here]</span>
- *
- *
* </pre>
- *
- * </p>
- *
* <p>
* For a complete example see the component references in wicket-examples project
- * </p>
*
* @see org.apache.wicket.extensions.markup.html.tabs.ITab
*
@@ -88,13 +73,10 @@
{
private static final long serialVersionUID = 1L;
- /**
- * id used for child panels
- */
+ /** id used for child panels */
public static final String TAB_PANEL_ID = "panel";
-
- private final List<ITab> tabs;
+ private final List<? extends ITab> tabs;
private transient Boolean[] tabsVisibilityCache;
@@ -106,7 +88,7 @@
* @param tabs
* list of ITab objects used to represent tabs
*/
- public TabbedPanel(String id, List<ITab> tabs)
+ public TabbedPanel(String id, List<? extends ITab> tabs)
{
super(id, new Model<Integer>(new Integer(-1)));
@@ -163,11 +145,9 @@
{
return newTabContainer(iteration);
}
-
});
}
-
/**
* Generates a loop item used to represent a specific tab's <code>li</code> element.
*
@@ -207,12 +187,12 @@
{
return getTabs().get(tabIndex).isVisible();
}
-
};
}
-
- // @see org.apache.wicket.Component#onAttach()
+ /**
+ * @see org.apache.wicket.Component#onBeforeRender()
+ */
@Override
protected void onBeforeRender()
{
@@ -258,7 +238,7 @@
/**
* @return list of tabs that can be used by the user to add/remove/reorder tabs in the panel
*/
- public final List<ITab> getTabs()
+ public final List<? extends ITab> getTabs()
{
return tabs;
}
@@ -280,7 +260,6 @@
return new Label(titleId, titleModel);
}
-
/**
* Factory method for links used to switch between tabs.
*
@@ -347,7 +326,6 @@
final Component component;
-
if (tabs.size() == 0 || !isTabVisible(index))
{
// no tabs or the currently selected tab is not visible
@@ -366,7 +344,6 @@
}
}
-
if (!component.getId().equals(TAB_PANEL_ID))
{
throw new WicketRuntimeException(
@@ -409,5 +386,4 @@
tabsVisibilityCache = null;
super.onDetach();
}
-
}