Class TLcyCommonWidgetFactory

java.lang.Object
com.luciad.lucy.gui.TLcyCommonWidgetFactory

public class TLcyCommonWidgetFactory extends Object

Factory to create some common user interface widgets. Use getSharedInstance() to retrieve an instance of this factory, for example like this:


 Component panel = TLcyCommonWidgetFactory.getSharedInstance().createTitledPanel(
    "MyTitle", new JScrollPane( new JTree() ), new Insets( 10, 10, 10, 10 ) );
 

By making an extension of this factory, GUI widgets can be replaced application wide. Those methods that are intended to replace or change widgets explicitly state in their comments they can be overridden. Settings your custom extension can be done using the setSharedInstance(TLcyCommonWidgetFactory) method.


   TLcyCommonWidgetFactory customExtension = ...;
   TLcyCommonWidgetFactory.setSharedInstance( customExtension );
 
See Also:
  • Constructor Details

    • TLcyCommonWidgetFactory

      protected TLcyCommonWidgetFactory()
      Creates a new TLcyCommonWidgetFactory. Only extensions of this class need to use this constructor, others should use getSharedInstance() to retrieve an instance.
  • Method Details

    • getSharedInstance

      public static TLcyCommonWidgetFactory getSharedInstance()
      Returns the shared TLcyCommonWidgetFactory instance that can be used to create some common GUI widgets.
      Returns:
      The shared TLcyCommonWidgetFactory instance.
      See Also:
    • setSharedInstance

      public static void setSharedInstance(TLcyCommonWidgetFactory aSharedInstance)
      Sets the shared TLcyCommonWidgetFactory instance. Setting (an extension of) TLcyCommonWidgetFactory allows to redefine, application wide, the behavior of certain methods of TLcyCommonWidgetFactory.
      Parameters:
      aSharedInstance - The shared instance to use.
      See Also:
    • createTitledPanel

      public Component createTitledPanel(String aTitle, Component aContent)
      Creates a new titled panel, with a left margin of 5 pixels and no outer spacing.
      Parameters:
      aTitle - The title for the titled panel.
      aContent - The content for the panel
      Returns:
      The created titled panel.
      See Also:
    • createTitledPanel

      public Component createTitledPanel(String aTitle, Component aContent, int aLeftMargin)
      Creates a new titled panel without outer spacing.
      Parameters:
      aTitle - The title for the titled panel.
      aContent - The content for the panel
      aLeftMargin - The left margin in pixels, used to have a horizontal shift between the left edge of the title and the left edge of the component.
      Returns:
      The created titled panel.
      See Also:
    • createTitledPanel

      public Component createTitledPanel(String aTitle, Component aContent, Insets aOuterSpacer)
      Creates a new titled panel with a left margin of 5 pixels.
      Parameters:
      aTitle - The title for the titled panel.
      aContent - The content for the panel
      aOuterSpacer - The empty space added around the titled panel.
      Returns:
      The created titled panel.
      See Also:
    • createTitledPanel

      public Component createTitledPanel(String aTitle, Component aContent, int aLeftMargin, Insets aOuterSpacer)
      Creates a new titled panel. It is composed of a title and seperator above the the given Component. It looks like this:
      
       aTitle ----------------
         aContent
       
      The shift between aTitle and aContent is specified by aLeftMargin. The spacing around the whole titled panel is specified by aOuterSpacer.

      Override this method to create a different look for titled panels.

      Parameters:
      aTitle - The title for the titled panel.
      aContent - The content for the panel
      aLeftMargin - The left margin in pixels, used to have a horizontal shift between the left edge of the title and the left edge of the component.
      aOuterSpacer - The empty space added around the titled panel.
      Returns:
      The created titled panel.
    • createTitledSeparator

      public Component createTitledSeparator(String aTitle)
      Creates a horizontal separator with the given title.

      Override this method to create a different look for titled separators.

      Parameters:
      aTitle - The title to put on the separator.
      Returns:
      The created horizontal titled separator.