Class PIATabPane

All Implemented Interfaces:
PAppComponent, PClientComponent, PComponent, PViewDataChangeListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener, SwingConstants

public class PIATabPane extends JTabbedPane implements PAppComponent, Serializable, ChangeListener
A JTabbedPane component that also allows switching panels within a particular Tab via a popup menu which can be activated on the Tab. This provides "virtual Tabs" in the JTabbedPane. Even though there may be only 2 or 3 tabs, it may be possible to switch to a number of "virtual" tabs by selecing one from the popup menu. The Tabs (and their contents) on the JTabbedPane are constructed dynamically by parsing a colon-separated String passed to the addTab() method. This String would consist of property 'names' which when combined with the 'base' property (see the setResourceName() method) would be used to determine the tab labels and Class names of the panels in the Tab. For example:
The code setResourceName("admin"); addTab("foo:bar");
would expect the following to be contained in one of the property files read in:
admin.foo.class=my.pkg.Comp1.class
admin.foo.label=Title 1
admin.bar.class=my.pkg.Comp2.class
admin.bar.label=Title 2
and would be broken down into one Tab named "Title 1" containing the component Comp1 and "virtual Tab" "Title 2" containing component Comp2.
This component issues a vetoable property change event before changing tabs (when a user clicks to switch tabs). Throwing a PropertyVetoException will prevent the tabs from actually switching. This is useful if you want to force the user to complete a task before leaving the current tab.
Version:
%version: 1 % %date_modified: Fri May 26 14:25:48 2000 %
Author:
larrylf
See Also:
  • Field Details

  • Constructor Details

    • PIATabPane

      public PIATabPane()
      Creates a PIATabbedPane component
    • PIATabPane

      public PIATabPane(int placement)
      Creates a PIATabbedPane component
  • Method Details

    • unregister

      public void unregister() throws RemoteException
      Used to disassociate this component from its delegate (controller)
      Specified by:
      unregister in interface PClientComponent
      Throws:
      RemoteException
    • setModelHandle

      public void setModelHandle(PModelHandle data) throws RemoteException
      Establishes the PModelHandle for this component. All tabs that specified a type that matches the type for this model handle are handed the model handle.
      Specified by:
      setModelHandle in interface PComponent
      Parameters:
      data - The new PModelHandle from which information will be extracted.
      Throws:
      RemoteException
    • getModelHandle

      public PModelHandle getModelHandle() throws RemoteException
      Retrieves the PModelHandle for this component
      Specified by:
      getModelHandle in interface PComponent
      Returns:
      The PModelHandle associated with this component
      Throws:
      RemoteException
    • isLight

      public boolean isLight() throws RemoteException
      Not a lightweight component as far as handling model handles goes
      Specified by:
      isLight in interface PComponent
      Returns:
      false
      Throws:
      RemoteException - thrown for errors
    • getControllerClassName

      public String getControllerClassName() throws RemoteException
      Retrieves the class name of this component's controller
      Specified by:
      getControllerClassName in interface PComponent
      Returns:
      "com.portal.bas.comp.PIAFieldController", the default controller for most PFieldComponents
      Throws:
      RemoteException
    • getTools

      public Vector getTools()
      Get a list of Actions supported by the visible tab.
      Specified by:
      getTools in interface PClientComponent
      Returns:
      a Vector containing Action objects for the topmost tab
    • getAllTools

      public Vector getAllTools()
      get all tools for every tab in this panel
      Returns:
      a vector containing the tools
    • setResourceName

      public void setResourceName(String name)
      Set the base resource name used in resource lookup. Basically, the resource name will be this base, followed by a dot, flowwed by the local name (label).
      Specified by:
      setResourceName in interface PClientComponent
      Parameters:
      name - The new base resource name.
    • getResourceName

      public String getResourceName()
      Get the base resource name used in resource lookup.
      Specified by:
      getResourceName in interface PClientComponent
      Returns:
      The base resource name
    • getRemoteComponent

      public Remote getRemoteComponent()
      Get a reference to the remote component for this object. The remote component is used when interfacing with this component's controller.
      Specified by:
      getRemoteComponent in interface PAppComponent
      Returns:
      a RemoteComponent
    • viewDataChange

      public void viewDataChange(PViewDataChangeEvent event) throws RemoteException
      ViewDataChangeListener override. Called by the controller to update the field data.
      Specified by:
      viewDataChange in interface PViewDataChangeListener
      Parameters:
      event - The ViewDataChange event describing the change
      Throws:
      RemoteException - thrown for errors
    • stateChanged

      public void stateChanged(ChangeEvent ce)
      Event handler called when tab selection changes
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      ce -
    • addTab

      public void addTab(String title, Icon icon, JComponent comp, String tip)
      Adds a component and tip represented by a title and/or icon, either of which can be null. Cover method for insertTab().
      Parameters:
      title - the title to be displayed in this tab
      icon - the icon to be displayed in this tab
      tip - the tooltip to be displayed for this tab
      component - The component to be displayed when this tab is clicked.
      See Also:
    • addTab

      public void addTab(String[] titles, Icon[] icons, PIAPanelGroup pg, String[] tips, String modelType, int frontPri)
      Adds a tab containing virtual tabs
      Parameters:
      modelType - The type of storable class this tab is interested in
      frontPri - The toFront priority for this tab
      title - the array of titles to be displayed in this tab
      icon - the array of icons to be displayed in this tab
      tip - the array of tooltips to be displayed for this tab
    • addTab

      public void addTab(String title, Icon icon, JComponent comp, String tip, String modelType, int frontPri)
      Adds a component and tip represented by a title and/or icon, either of which can be null. Cover method for insertTab().
      Parameters:
      title - the title to be displayed in this tab
      icon - the icon to be displayed in this tab
      tip - the tooltip to be displayed for this tab
      modelType - The model type this component this tab wants
      frontPri - The priority for bringing this tab to the front
      component - The component to be displayed when this tab is clicked.
      See Also:
    • insertTab

      public void insertTab(String title, Icon icon, JComponent comp, String tip, String modType, int frontPri, int index)
      Inserts a component and tip represented by a title and/or icon, either of which can be null, at the given location.
      Parameters:
      title - the title to be displayed in this tab
      icon - the icon to be displayed in this tab
      tip - the tooltip to be displayed for this tab
      frontPri - The priority for bringing this tab to the front
      index - The location to insert the tab
      component - The component to be displayed when this tab is clicked.
      modelType - The model type this component this tab wants
      See Also: