com.viaoa.html.OATabbedPane Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of oa Show documentation
Show all versions of oa Show documentation
Object Automation library
The newest version!
/*
This software and documentation is the confidential and proprietary
information of ViaOA, Inc. ("Confidential Information").
You shall not disclose such Confidential Information and shall use
it only in accordance with the terms of the license agreement you
entered into with ViaOA, Inc..
ViaOA, Inc. MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, OR NON-INFRINGEMENT. ViaOA, Inc. SHALL NOT BE LIABLE FOR ANY DAMAGES
SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
THIS SOFTWARE OR ITS DERIVATIVES.
Copyright (c) 2001 ViaOA, Inc.
All rights reserved.
*/
package com.viaoa.html;
import java.util.Vector;
import com.viaoa.hub.*;
import com.viaoa.util.*;
/*
OATabbedPane tab = new OATabbedPane();
tab.add("Title");
tab.add("Title", "page.jsp");
tab.add("Title1", "page.jsp", "image.gif");
tab.add("Title1", "page.jsp", "image.gif", "selected.gif", "mouseOver.gif");
tab.setHtml("","","");
form.add("tab", tab);
--- Html ----
<% OATabbedPane tab = form.getTabbedPane("tab"); %>
<%= tab.getHtml() %>
<% switch(tab.getSelectedIndex()) {
case 0:
%>
HTML...
<%
break;
case 1:
%>
HTML...
<%
break;
%>
*/
public class OATabbedPane extends OAHtmlComponent {
private static final long serialVersionUID = 1L;
protected OAButtonGroup buttonGroup = new OAButtonGroup();
protected Vector vec = new Vector(5,5);
public void add(String title, OAToggleButton cmd) {
buttonGroup.add(cmd);
if (title == null) title = "";
if (cmd == null) cmd = new OAToggleButton("invisible.gif");
buttonGroup.add(cmd);
OALink link = new OALink("nowhere");
link.setText(title);
link.setTargetCommand(cmd); // so that link will "act" like a toggleButton
vec.addElement( new Object[] {title,link});
}
public void add(OAToggleButton cmd) {
this.add("", cmd);
}
public void add(String title, String imageName, String selectedImageName, String mouseOverImage) {
OAToggleButton cmd = new OAToggleButton(imageName, selectedImageName, mouseOverImage);
this.add(title, cmd);
}
public void add(String title, String imageName, String selectedImageName) {
this.add(title, imageName,selectedImageName,null);
}
public void add(String title, String imageName) {
this.add(title, imageName, null, null);
}
public void add(String title) {
this.add(title, (OAToggleButton) null);
}
public int getSelectedIndex() {
return buttonGroup.getSelectedIndex();
}
public void setSelectedIndex(int i) {
buttonGroup.setSelectedIndex(i);
}
/*
htmlBefore, htmlAfter are used for each tab.
Example:
OATabbedPane pane = new OATabbedPane();
---
<%= form.getTabbedPane("tabpane").getHtml() %>
*/
public String getHtml(String htmlTags) {
String s = "";
s += "";
s += "";
buttonGroup.getSelectedIndex();
int x = vec.size();
for (int i=0; i";
s += "";
s += "";
s += "";
if ( htmlBefore != null) s += " " + htmlBefore;
s += " ";
s += tog.getHtml();
s += link.getHtml();
s += " ";
if ( htmlAfter != null) s += " " + htmlAfter;
s += " ";
s += "";
s += "";
s += " ";
}
else {
s += "";
s += "";
s += "";
s += "";
s += "";
s += " ";
s += "";
if ( htmlBefore != null) s += " " + htmlBefore;
s += " ";
s += tog.getHtml();
s += ""+link.getHtml()+"";
s += " ";
if ( htmlAfter != null) s += " " + htmlAfter;
s += " ";
s += "";
s += "";
s += " ";
s += " ";
s += "
";
s += " ";
}
}
s += "";
s += "";
s += "";
s += "";
s += "";
s += " ";
s += "";
s += " ";
s += " ";
s += " ";
s += "
";
s += " ";
s += " ";
s += "
";
return s;
}
}