webwork/src/main/webwork/view/taglib/ui TabbedPaneTag.java,1.1,1.2
[email protected] Thu, 30 May 2002 15:56:11 -0700
| Newsgroups | gmane.comp.java.webwork.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/webwork/webwork/src/main/webwork/view/taglib/ui
In directory usw-pr-cvs1:/tmp/cvs-serv28737
Modified Files:
TabbedPaneTag.java
Log Message:
need release() here to restore what state constructor establishes.
Index: TabbedPaneTag.java
===================================================================
RCS file: /cvsroot/webwork/webwork/src/main/webwork/view/taglib/ui/TabbedPaneTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- TabbedPaneTag.java 3 Mar 2002 04:11:48 -0000 1.1
+++ TabbedPaneTag.java 30 May 2002 22:56:08 -0000 1.2
@@ -7,16 +7,12 @@
package webwork.view.taglib.ui;
-import java.util.*;
-import javax.servlet.*;
-import javax.servlet.jsp.*;
-import javax.swing.*;
-import javax.swing.table.*;
-import webwork.action.SessionAware;
-import webwork.view.taglib.ui.*;
import webwork.util.TabbedPane;
-import webwork.util.*;
-import java.beans.*;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspTagException;
+import java.util.Map;
+import java.util.Vector;
/**
* TabbedPane tag.
@@ -26,107 +22,114 @@
public class TabbedPaneTag extends ComponentTag
{
- // Protected --------------------------------------------------------
- protected TabbedPane tabPane = new TabbedPane( 0 );
- protected String contentName = null;
+ // Protected --------------------------------------------------------
+ protected TabbedPane tabPane = new TabbedPane(0);
+ protected String contentName = null;
- protected String strVal( String objName )
- {
- try {
- return String.valueOf( findValue( objName ) );
- } catch ( Exception e ) {
- return objName;
- }
- }
+ protected String strVal(String objName)
+ {
+ try {
+ return String.valueOf(findValue(objName));
+ } catch (Exception e) {
+ return objName;
+ }
+ }
- // Public --------------------------------------------------------
- public TabbedPaneTag()
- {
- super.setTemplate("tabbedpane.jsp");
+ // Public --------------------------------------------------------
+ public TabbedPaneTag()
+ {
+ super.setTemplate("tabbedpane.jsp");
- this.setSelectedIndex( 0 );
+ this.setSelectedIndex(0);
- if( this.getTabAlign() == null )
- this.setTabAlign("'CENTER'");
- }
+ if (this.getTabAlign() == null)
+ this.setTabAlign("'CENTER'");
+ }
- public String getSelectedUrl()
- {
- Map.Entry me = (Map.Entry)this.getContent().elementAt( this.getSelectedIndex() );
- String str = me.getValue().toString();
- return str;
- }
+ public String getSelectedUrl()
+ {
+ Map.Entry me = (Map.Entry) this.getContent().elementAt(this.getSelectedIndex());
+ String str = me.getValue().toString();
+ return str;
+ }
- public int getColSpanLength()
- {
- return ( this.getTabAlign().compareToIgnoreCase("CENTER") == 0 ? this.getContent().size() + 2 : this.getContent().size() + 1 );
- }
+ public int getColSpanLength()
+ {
+ return (this.getTabAlign().compareToIgnoreCase("CENTER") == 0 ? this.getContent().size() + 2 : this.getContent().size() + 1);
+ }
- public String getIndexLink()
- {
- return ( "TABBEDPANE_" + getId() + "_INDEX" );
- }
+ public String getIndexLink()
+ {
+ return ("TABBEDPANE_" + getId() + "_INDEX");
+ }
- public String getContentName() { return this.contentName; }
+ public String getContentName()
+ {
+ return this.contentName;
+ }
- public void setContentName( String contentName )
- {
- this.contentName = strVal( contentName );
+ public void setContentName(String contentName)
+ {
+ this.contentName = strVal(contentName);
- Object obj = findValue( this.contentName );
- if( obj instanceof Vector )
- this.setContent( (Vector)obj );
- }
+ Object obj = findValue(this.contentName);
+ if (obj instanceof Vector)
+ this.setContent((Vector) obj);
+ }
- public int getSelectedIndex() { return tabPane.getSelectedIndex(); }
+ public int getSelectedIndex()
+ {
+ return tabPane.getSelectedIndex();
+ }
- public void setSelectedIndex( int selectedIndex )
- {
- tabPane.setSelectedIndex(selectedIndex);
- }
+ public void setSelectedIndex(int selectedIndex)
+ {
+ tabPane.setSelectedIndex(selectedIndex);
+ }
- public java.util.Vector getContent() { return tabPane.getContent(); }
+ public java.util.Vector getContent()
+ {
+ return tabPane.getContent();
+ }
- public void setContent( java.util.Vector content )
- {
- tabPane.setContent(content);
- }
+ public void setContent(java.util.Vector content)
+ {
+ tabPane.setContent(content);
+ }
- public String getTabAlign() { return tabPane.getTabAlign(); }
+ public String getTabAlign()
+ {
+ return tabPane.getTabAlign();
+ }
- public void setTabAlign( String tabAlign )
- {
- tabPane.setTabAlign(strVal( tabAlign ));
- }
+ public void setTabAlign(String tabAlign)
+ {
+ tabPane.setTabAlign(strVal(tabAlign));
+ }
// BodyTag implementation ----------------------------------------
- public int doStartTag() throws JspException
- {
- String indexStr = pageContext.getRequest().getParameter( getIndexLink() );
- if ( indexStr != null )
- {
- try
- {
- int index = Integer.parseInt( indexStr );
- this.setSelectedIndex( ( index < 0 ? 0 : index ) );
- }
- catch ( Exception e )
- {
- throw new JspTagException( "TabbedPane Error: " + e.toString() );
- }
- }
-
- return super.doStartTag();
- }
+ public int doStartTag() throws JspException
+ {
+ String indexStr = pageContext.getRequest().getParameter(getIndexLink());
+ if (indexStr != null) {
+ try {
+ int index = Integer.parseInt(indexStr);
+ this.setSelectedIndex((index < 0 ? 0 : index));
+ } catch (Exception e) {
+ throw new JspTagException("TabbedPane Error: " + e.toString());
+ }
+ }
- public void release()
- {
- this.setSelectedIndex( 0 );
+ return super.doStartTag();
+ }
- if( this.getTabAlign() == null )
- this.setTabAlign("'CENTER'");
+ // IncludeTag overrides ------------------------------------------
+ public void release()
+ {
+ this.setSelectedIndex(0);
- super.release();
- }
+ if (this.getTabAlign() == null)
+ this.setTabAlign("'CENTER'");
+ }
}
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm