com.dlsc.flexgantt.swing.mac

## Class MacComponentFactory

- java.lang.Object
- - com.dlsc.flexgantt.swing.DefaultComponentFactory
  - - com.dlsc.flexgantt.swing.mac.MacComponentFactory

- All Implemented Interfaces:
    IComponentFactory

      public class MacComponentFactory
      extends DefaultComponentFactory

  A specialized component factory for Mac OS X. Adds a glossy background to the tree table header and the timeline. Also fills the standard splitpane dividers with a nice gradient.
  Since:
    2.0
  Author:
    Dirk Lemmermann

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `MacComponentFactory()` Constructs a new factory.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Dateline` | `createDateline(Timeline timeline)` Creates a new `Dateline` for the given Gantt chart and timeline.
    `static JLabel` | `createEmphasizedLabel(String text)` Creates an emphasized label with the given text.
    `Eventline` | `createEventline(Timeline timeline, Dateline dateline)` Creates a new `Eventline` for the given Gantt chart and timeline.
    `LayerContainer` | `createLayerContainer(AbstractGanttChart gc, TreeTable table, IGanttChartModel model)` Creates a `LayerContainer` for the given Gantt chart and tree table combination.
    `JComponent` | `createLayerContainerCorner(LayerContainer lc, String corner)` Creates a new component that will be placed in the specified corner of the layer container scrollpane.
    `LayerContainerRowHeader` | `createLayerContainerRowHeader(LayerContainer lc)` Creates a new `LayerContainerRowHeader` that will be used for the given layer container.
    `LayerContainerScrollPane` | `createLayerContainerScrollPane(LayerContainer lc, LayerContainerRowHeader rowHeader, Timeline timeline, boolean primary)` Returns the scrollpane used for the given layer container.
    `JSplitPane` | `createSplitPane()` Creates the splitpane used by the Gantt chart for changing the sizes of the left-hand side and the right-hand side.
    `Timeline` | `createTimeline(AbstractGanttChart gc)` Creates a new `Timeline` for the given Gantt chart.
    `TreeTable` | `createTreeTable(AbstractGanttChart gc, ITreeTableModel model)` Creates a `TreeTable` for the given Gantt chart.
    `JComponent` | `createTreeTableCorner(TreeTable table, String corner)` Creates a component that will be placed in the upper left corner of the scrollpane that contains the tree table.
    `TreeTableHeader` | `createTreeTableHeader(AbstractGanttChart gc)` Creates a `TreeTableHeader` for the given Gantt chart.
    `TreeTableRowHeader` | `createTreeTableRowHeader(TreeTable table)` Creates a new `TreeTableRowHeader` that will be used for the given tree table.
    `TreeTableScrollPane` | `createTreeTableScrollPane(TreeTable table, TreeTableRowHeader rowHeader, TreeTableHeader header, boolean primary)` Creates the scrollpane used for scrolling the given tree table.
    `static MacComponentFactory` | `getInstance()` Always returns the same instance of the factory.
    `static JLabel` | `makeEmphasizedLabel(JLabel label)` Turns the given label into an emphasized label.
    `static JLabel` | `makeEmphasizedLabel(JLabel label, Color focusedColor, Color unfocusedColor, Color emphasisColor)` Turns the given label into an emphasized label.
    `static void` | `makeEmphasizedLabelsRecursively(Component comp)` Turns all labels in the container hierarchy of the given component into emphasized labels.
    `static void` | `paintGlossyBackground(Component comp, Graphics g, int w, int h)` A utility method for filling a component with a glossy background.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MacComponentFactory

          protected MacComponentFactory()

      Constructs a new factory. The constructor is protected due to the singleton pattern.
      Since:
        1.0

  - ### Method Detail

    - #### getInstance

          public static MacComponentFactory getInstance()

      Always returns the same instance of the factory. An instance will be created if no instance is available, yet.
      Returns:
        a factory instance
      Since:
        1.0

    - #### createLayerContainer

          public LayerContainer createLayerContainer(AbstractGanttChart gc,
                                                     TreeTable table,
                                                     IGanttChartModel model)

      Description copied from interface: `IComponentFactory`
      Creates a `LayerContainer` for the given Gantt chart and tree table combination. The layer container can utilize the given Gantt chart model to determine how many layers and spreadsheets it has to add to itself.
      Specified by:
        `createLayerContainer` in interface `IComponentFactory`
      Overrides:
        `createLayerContainer` in class `DefaultComponentFactory`
      Parameters:
        `gc` - the owner Gantt chart of the layer container
        `table` - the table to the left of the layer container
        `model` - the model represented by the layer container
      Returns:
        a layer container that visualizes the various types of layers supported by the framework (system, timeline, custom)

    - #### createLayerContainerCorner

          public JComponent createLayerContainerCorner(LayerContainer lc,
                                                       String corner)

      Description copied from interface: `IComponentFactory`
      Creates a new component that will be placed in the specified corner of the layer container scrollpane.
      Specified by:
        `createLayerContainerCorner` in interface `IComponentFactory`
      Overrides:
        `createLayerContainerCorner` in class `DefaultComponentFactory`
      Parameters:
        `lc` - the layer container
        `corner` - the corner in which to place the component (UPPER_LEFT, UPPER_RIGHT, LOWER_LEFT, LOWER_RIGHT)
      Returns:
        a user interface component for use in combination with the timeline
      See Also:
        `NavigationControlPanel`

    - #### createLayerContainerRowHeader

          public LayerContainerRowHeader createLayerContainerRowHeader(LayerContainer lc)

      Description copied from interface: `IComponentFactory`
      Creates a new `LayerContainerRowHeader` that will be used for the given layer container. Layer container row headers can be used for things like the display of a scale for a resource capacity.
      Specified by:
        `createLayerContainerRowHeader` in interface `IComponentFactory`
      Overrides:
        `createLayerContainerRowHeader` in class `DefaultComponentFactory`
      Parameters:
        `lc` - the layer container that uses the row header for things like capacity scales
      Returns:
        a row header that will be used in combination with the given layer container

    - #### createTreeTable

          public TreeTable createTreeTable(AbstractGanttChart gc,
                                           ITreeTableModel model)

      Description copied from interface: `IComponentFactory`
      Creates a `TreeTable` for the given Gantt chart. The table can use the given model to populate itself with date.
      Specified by:
        `createTreeTable` in interface `IComponentFactory`
      Overrides:
        `createTreeTable` in class `DefaultComponentFactory`
      Parameters:
        `gc` - the owner Gantt chart / parent container of the table
        `model` - the date source for the table
      Returns:
        a tree table that visualizes the given data source

    - #### createDateline

          public Dateline createDateline(Timeline timeline)

      Description copied from interface: `IComponentFactory`
      Creates a new `Dateline` for the given Gantt chart and timeline. The dateline will show times / dates for the given time zone and it will allow the user to scroll across the given time span.
      Specified by:
        `createDateline` in interface `IComponentFactory`
      Overrides:
        `createDateline` in class `DefaultComponentFactory`
      Parameters:
        `timeline` - the parent timeline
      Returns:
        a dateline that covers the given time span and time zone
      See Also:
        `IComponentFactory.createTimeline(AbstractGanttChart)`, `IComponentFactory.createEventline(Timeline, Dateline)`

    - #### createEventline

          public Eventline createEventline(Timeline timeline,
                                           Dateline dateline)

      Description copied from interface: `IComponentFactory`
      Creates a new `Eventline` for the given Gantt chart and timeline. The eventline will show global events and activities.
      Specified by:
        `createEventline` in interface `IComponentFactory`
      Overrides:
        `createEventline` in class `DefaultComponentFactory`
      Parameters:
        `timeline` - the parent timeline
        `dateline` - the dateline that is used in the same timeline
      Returns:
        an eventline for displaying global events and activities
      See Also:
        `IComponentFactory.createDateline(Timeline)`, `IComponentFactory.createTimeline(AbstractGanttChart)`

    - #### createTreeTableRowHeader

          public TreeTableRowHeader createTreeTableRowHeader(TreeTable table)

      Description copied from interface: `IComponentFactory`
      Creates a new `TreeTableRowHeader` that will be used for the given tree table. Row headers display toggles for expanding/collapsing tree nodes and also row numbers / outline numbers for each row.
      Specified by:
        `createTreeTableRowHeader` in interface `IComponentFactory`
      Overrides:
        `createTreeTableRowHeader` in class `DefaultComponentFactory`
      Parameters:
        `table` - the tree table that uses the row header for visualizing row numbers
      Returns:
        a row header that will be used in combination with the given table

    - #### createTreeTableHeader

          public TreeTableHeader createTreeTableHeader(AbstractGanttChart gc)

      Description copied from interface: `IComponentFactory`
      Creates a `TreeTableHeader` for the given Gantt chart. A Gantt chart only uses a single column header even if it displays more than one table at a time.
      Specified by:
        `createTreeTableHeader` in interface `IComponentFactory`
      Overrides:
        `createTreeTableHeader` in class `DefaultComponentFactory`
      Parameters:
        `gc` - the owner Gantt chart of the header
      Returns:
        a column header for the left-hand side of the Gantt chart (the table side)
      See Also:
        `AbstractGanttChart.getTreeTableHeader()`

    - #### createTreeTableCorner

          public JComponent createTreeTableCorner(TreeTable table,
                                                  String corner)

      Description copied from interface: `IComponentFactory`
      Creates a component that will be placed in the upper left corner of the scrollpane that contains the tree table.
      Specified by:
        `createTreeTableCorner` in interface `IComponentFactory`
      Overrides:
        `createTreeTableCorner` in class `DefaultComponentFactory`
      Parameters:
        `table` - the table that is wrapped by the scrollpane
        `corner` - the corner where the component will be placed (UPPER_LEFT, UPPER_RIGHT, LOWER_LEFT, LOWER_RIGHT)
      Returns:
        a component that will be placed in the upper left corner of the tree table scrollpane
      See Also:
        `TreeTableScrollPane`, `JScrollPane.setCorner(String, java.awt.Component)`

    - #### createTimeline

          public Timeline createTimeline(AbstractGanttChart gc)

      Description copied from interface: `IComponentFactory`
      Creates a new `Timeline` for the given Gantt chart. The timeline will forward the given time span and time zone to the dateline that it will also create via the same component factory.
      Specified by:
        `createTimeline` in interface `IComponentFactory`
      Overrides:
        `createTimeline` in class `DefaultComponentFactory`
      Parameters:
        `gc` - the owner Gantt chart
      Returns:
        a timeline that covers the given time span and time zone
      See Also:
        `IComponentFactory.createDateline(Timeline)`, `IComponentFactory.createEventline(Timeline, Dateline)`

    - #### makeEmphasizedLabelsRecursively

          public static void makeEmphasizedLabelsRecursively(Component comp)

      Turns all labels in the container hierarchy of the given component into emphasized labels.
      Parameters:
        `comp` - the root from where to start
      Since:
        2.0
      See Also:
        `EmphasizedLabelUI`

    - #### createEmphasizedLabel

          public static JLabel createEmphasizedLabel(String text)

      Creates an emphasized label with the given text.
      Parameters:
        `text` - the text to use for the new label
      Returns:
        a label component
      Since:
        2.0
      See Also:
        `EmphasizedLabelUI`

    - #### makeEmphasizedLabel

          public static JLabel makeEmphasizedLabel(JLabel label)

      Turns the given label into an emphasized label.
      Parameters:
        `label` - the label to convert
      Returns:
        a label component
      Since:
        2.0
      See Also:
        `EmphasizedLabelUI`

    - #### makeEmphasizedLabel

          public static JLabel makeEmphasizedLabel(JLabel label,
                                                   Color focusedColor,
                                                   Color unfocusedColor,
                                                   Color emphasisColor)

      Turns the given label into an emphasized label.
      Parameters:
        `label` - the label to convert
        `focusedColor` - the color to use when the label is in a focused window
        `unfocusedColor` - the color to use when the label is in an unfocused window
        `emphasisColor` - the second foreground color for emphasizing the label
      Returns:
        the converted label
      Since:
        2.0

    - #### createLayerContainerScrollPane

          public LayerContainerScrollPane createLayerContainerScrollPane(LayerContainer lc,
                                                                         LayerContainerRowHeader rowHeader,
                                                                         Timeline timeline,
                                                                         boolean primary)

      Description copied from interface: `IComponentFactory`
      Returns the scrollpane used for the given layer container.
      Specified by:
        `createLayerContainerScrollPane` in interface `IComponentFactory`
      Overrides:
        `createLayerContainerScrollPane` in class `DefaultComponentFactory`
      Parameters:
        `lc` - the "view" of the scrollpane
        `rowHeader` - the row header component (e.g. for showing capacity numbers)
        `timeline` - the timeline component shown above the view
        `primary` - a flag used to signal the top-most layer container
      Returns:
        the scrollpane for the given layer container

    - #### createTreeTableScrollPane

          public TreeTableScrollPane createTreeTableScrollPane(TreeTable table,
                                                               TreeTableRowHeader rowHeader,
                                                               TreeTableHeader header,
                                                               boolean primary)

      Description copied from interface: `IComponentFactory`
      Creates the scrollpane used for scrolling the given tree table.
      Specified by:
        `createTreeTableScrollPane` in interface `IComponentFactory`
      Overrides:
        `createTreeTableScrollPane` in class `DefaultComponentFactory`
      Parameters:
        `table` - the "view" of the scrollpane
        `rowHeader` - the row header component (e.g. for showing row numbers)
        `header` - the tree table header (column names)
        `primary` - flag used for the top-most tree table
      Returns:
        the scrollpane for the given tree table

    - #### createSplitPane

          public JSplitPane createSplitPane()

      Description copied from interface: `IComponentFactory`
      Creates the splitpane used by the Gantt chart for changing the sizes of the left-hand side and the right-hand side.
      Specified by:
        `createSplitPane` in interface `IComponentFactory`
      Overrides:
        `createSplitPane` in class `DefaultComponentFactory`
      Returns:
        a splitpane for dividing the Gantt chart into its left and right side

    - #### paintGlossyBackground

          public static void paintGlossyBackground(Component comp,
                                                   Graphics g,
                                                   int w,
                                                   int h)

      A utility method for filling a component with a glossy background.
      Parameters:
        `comp` - the component to fill
        `g` - the graphics context into which to draw
        `w` - the width used for filling
        `h` - the height used for filling
      Since:
        2.0

Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.