Package com.ribs

Class Ribs

java.lang.Object
com.ribs.Ribs
Direct Known Subclasses:
RBApp

public class Ribs extends Object
This class helps to load and manage panels and windows of GUI components in the form of a rib file, which is a simple XML description of UI controls. A simple app might just do the following:

RJPanel ui = Ribs.getRib(this); ui.setWindowVisible(true); ui.reset(this);

This code will load a UI panel from a rib file called '.rib', create a window for it and make it visible and then have us reset all of the controls contained there in with our resetUI() method.

Copyright (c) 2004 ReportMill Software, Inc. All Rights Reserved. Contact ReportMill <info@reportmill.com>.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    An interface for objects that want notification about event processing.
    static interface 
    An interface for objects that want notification about event processing.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static Object
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Adds a RibsListener to listeners array.
    static RJAction
    Returns the last RJAction associated with the last control change (and resulting sendAction() call).
    static byte[]
    getBytes(String aName, Object anOwner)
    Returns a byte array for the given name and owner (tries to load from owner class resource dir or current dir).
    Returns the Ribs Event Listener.
    Returns the Ribs Event Queue.
    static RJHelper
    Returns the Ribs Helper object for a given object.
    static Image
    Returns the named image - tries to load from last owner class resource directory or current directory.
    static Image
    getImage(String aName, Object anOwner)
    Returns the named image - tries to load from given owner class resource directory or current directory.
    static ImageIcon
    Returns the named imageIcon - tries to load from last owner class resource directory or current directory.
    static ImageIcon
    getImageIcon(String aName, Object anOwner)
    Returns the named imageIcon - tries to load from given owner class resource directory or current directory.
    getInputStream(String aName, Object anOwner)
    Returns an input stream for the given name - tries to load from given owner class resource dir or current dir.
    getListener(int anIndex)
    Returns the individual listener at the given index.
    static int
    Returns the number of RibsListeners in listeners array.
    static RJPanel
    getRib(Object anOwner)
    This method tries to find, load and return a rib file using the name of the given owner's class.
    static RJPanel
    getRib(Object anOwner, Class aClass, Object aSource)
    This method tries to load a rib file from aSource.
    static boolean
    This method returns whether the last action sent by the last control was in the midst of a series of changes, like inside a mouse loop (or the dragging of the knob on a slider).
    static void
    Initializes Ribs functionality (installs an event queue and configures helper map).
    static boolean
    Returns whether the alt key is down for the current input event.
    static boolean
    Returns whether Ribs is currently loading a document.
    static boolean
    Returns whether the meta key is down for the current input event.
    static boolean
    Returns whehter mouse is down in mouse drag loop.
    static boolean
    Returns whether Ribs' send action facility is disabled (so controls can be updated without triggering response).
    static void
    Removes an Ribs.EventListener from the RibsEventQueue.
    static void
    reset(Object aTarget)
    This method registers the given object to be called "reset" at the end of the current event (using invokeLater).
    static void
    This method simply invokes the resetUI() method of aTarget (immediately).
    static void
    sendAction(Object anOwner, String aCallback, JComponent aComponent, RJAction anAction)
    This method sends a callback to the owner of a component, on behalf of that component.
    static void
    sendAction(JComponent aComponent, RJAction anAction)
    Conevenience to tell a component (via its helper) to fire its action.
    static void
    setLoadingRibsDocument(boolean aValue)
    Sets whether Ribs is currently loading a document.
    static boolean
    setSendActionDisabled(boolean aFlag)
    Sets whether Ribs' send action facility is disabled (so controls can be updated without triggering response).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • _lastControl

      public static Object _lastControl
  • Constructor Details

    • Ribs

      public Ribs()
  • Method Details

    • init

      public static void init()
      Initializes Ribs functionality (installs an event queue and configures helper map). This is called automatically when Ribs class is first touched.
    • getRib

      public static RJPanel getRib(Object anOwner)
      This method tries to find, load and return a rib file using the name of the given owner's class. For instance, calling Ribs.getRib(whatever), where whatever is of class Whatever.class, would essentially call getRib(whatever.getClass().getResource("Whatever.rib"). Once loaded, anOwner is set as the owner of the returned RJPanel (and its child components).
    • getRib

      public static RJPanel getRib(Object anOwner, Class aClass, Object aSource)
      This method tries to load a rib file from aSource. ASource can be a File, a String path, an InputStream or even a byte array. Once loaded, anOwner is set as the owner of the returned RJPanel (and its child components).
    • isLoadingRibsDocument

      public static boolean isLoadingRibsDocument()
      Returns whether Ribs is currently loading a document.
    • setLoadingRibsDocument

      public static void setLoadingRibsDocument(boolean aValue)
      Sets whether Ribs is currently loading a document.
    • getHelper

      public static RJHelper getHelper(Object anObj)
      Returns the Ribs Helper object for a given object.
    • getImage

      public static Image getImage(String aName)
      Returns the named image - tries to load from last owner class resource directory or current directory.
    • getImage

      public static Image getImage(String aName, Object anOwner)
      Returns the named image - tries to load from given owner class resource directory or current directory.
    • getImageIcon

      public static ImageIcon getImageIcon(String aName)
      Returns the named imageIcon - tries to load from last owner class resource directory or current directory.
    • getImageIcon

      public static ImageIcon getImageIcon(String aName, Object anOwner)
      Returns the named imageIcon - tries to load from given owner class resource directory or current directory.
    • getBytes

      public static byte[] getBytes(String aName, Object anOwner)
      Returns a byte array for the given name and owner (tries to load from owner class resource dir or current dir).
    • getInputStream

      public static InputStream getInputStream(String aName, Object anOwner)
      Returns an input stream for the given name - tries to load from given owner class resource dir or current dir.
    • reset

      public static void reset(Object aTarget)
      This method registers the given object to be called "reset" at the end of the current event (using invokeLater). This method coalesces multiple calls with the same target, so that they result in a single call to its reset method. This method uses resetImmediately() to actually send the reset message to currently registered targets.
    • resetImmediately

      public static void resetImmediately(Object aTarget)
      This method simply invokes the resetUI() method of aTarget (immediately). It also disables Ribs.sendAction() so that the resetting of the UI controls won't result in any sent actions.
    • sendAction

      public static void sendAction(JComponent aComponent, RJAction anAction)
      Conevenience to tell a component (via its helper) to fire its action.
    • sendAction

      public static void sendAction(Object anOwner, String aCallback, JComponent aComponent, RJAction anAction)
      This method sends a callback to the owner of a component, on behalf of that component. It conveniently disables sendAction() while doing its thing, so that any changes to other components, due to the current component's change won't result in them sending their actions (and a nasty cascade effect). This is mostly an internal method called by RJHelper.
    • isSendActionDisabled

      public static boolean isSendActionDisabled()
      Returns whether Ribs' send action facility is disabled (so controls can be updated without triggering response).
    • setSendActionDisabled

      public static boolean setSendActionDisabled(boolean aFlag)
      Sets whether Ribs' send action facility is disabled (so controls can be updated without triggering response).
    • getAction

      public static RJAction getAction()
      Returns the last RJAction associated with the last control change (and resulting sendAction() call).
    • getValueIsAdjusting

      public static boolean getValueIsAdjusting()
      This method returns whether the last action sent by the last control was in the midst of a series of changes, like inside a mouse loop (or the dragging of the knob on a slider).
    • isAltDown

      public static boolean isAltDown()
      Returns whether the alt key is down for the current input event.
    • isMetaDown

      public static boolean isMetaDown()
      Returns whether the meta key is down for the current input event.
    • isMouseDown

      public static boolean isMouseDown()
      Returns whehter mouse is down in mouse drag loop.
    • getEventListener

      public static RibsEventListener getEventListener()
      Returns the Ribs Event Listener.
    • getEventQueue

      public static RibsEventQueue getEventQueue()
      Returns the Ribs Event Queue.
    • getListenerCount

      public static int getListenerCount()
      Returns the number of RibsListeners in listeners array.
    • getListener

      public static Ribs.RibsListener getListener(int anIndex)
      Returns the individual listener at the given index.
    • addRibsListener

      public static void addRibsListener(Ribs.RibsListener aListener)
      Adds a RibsListener to listeners array.
    • removeRibsListener

      public static void removeRibsListener(Ribs.RibsListener aListener)
      Removes an Ribs.EventListener from the RibsEventQueue.