Class TipOfTheDay


  • public class TipOfTheDay
    extends java.lang.Object
    Instances of this class are a "Tip of Day" box, which is composed of

    A tip
    2 buttons to navigate between types
    A close button
    A checkbox "show tip on startup"
    (optional)
    A checkbox "remember the password"
    (optional)

    • Field Detail

      • YELLOW_LIGHT_BULB

        private static final java.lang.String YELLOW_LIGHT_BULB
        See Also:
        Constant Field Values
      • tips

        private final java.util.List<java.lang.String> tips
      • displayShowOnStartup

        private boolean displayShowOnStartup
      • showOnStartup

        private boolean showOnStartup
      • shell

        private org.eclipse.swt.widgets.Shell shell
      • close

        private org.eclipse.swt.widgets.Button close
      • index

        private int index
      • tipArea

        private org.eclipse.swt.browser.Browser tipArea
      • fontName

        private java.lang.String fontName
      • image

        private org.eclipse.swt.graphics.Image image
    • Constructor Detail

      • TipOfTheDay

        public TipOfTheDay()
        Constructor
    • Method Detail

      • open

        public void open​(org.eclipse.swt.widgets.Shell parent)
        Open the "tip of the day" box
        Parameters:
        parent - the parent shell
      • buildShell

        private void buildShell​(org.eclipse.swt.widgets.Shell parent)
        Build the shell
        Parameters:
        parent - parent shell
      • buildHeader

        private void buildHeader()
        Build the header
      • buildLeftColumn

        private void buildLeftColumn()
        Build the left column
      • buildTip

        private void buildTip()
        Build the tip area
      • fillTipArea

        private void fillTipArea()
        Fill the tip area with the selected tip
      • buildButtons

        private void buildButtons()
        Build the button (checkbox, previous tip, next tip, close)
      • buildShowOnStartup

        private void buildShowOnStartup​(org.eclipse.swt.widgets.Composite composite,
                                        org.eclipse.swt.layout.GridData gridData)
        Build the "show on startup" checkbox
        Parameters:
        composite - parent composite
        gridData - associated grid data
      • buildPreviousButton

        private void buildPreviousButton​(org.eclipse.swt.widgets.Composite composite,
                                         org.eclipse.swt.layout.GridData gridData)
        Build the "previous tip" button
        Parameters:
        composite - parent composite
        gridData - associated grid data
      • buildNextButton

        private void buildNextButton​(org.eclipse.swt.widgets.Composite composite,
                                     org.eclipse.swt.layout.GridData gridData)
        Build the "next tip" button
        Parameters:
        composite - parent composite
        gridData - associated grid data
      • buildCloseButton

        private void buildCloseButton​(org.eclipse.swt.widgets.Composite composite,
                                      org.eclipse.swt.layout.GridData gridData)
        Build the "close" button
        Parameters:
        composite - parent composite
        gridData - associated grid data
      • openShell

        private void openShell()
        Open the shell
      • addTip

        public TipOfTheDay addTip​(java.lang.String tip)
        Add a tip
        Parameters:
        tip - tip to add
        Returns:
        the current object
      • getImage

        public org.eclipse.swt.graphics.Image getImage()
        Returns:
        the image
      • getIndex

        public int getIndex()
        Returns:
        the index of the current tip
      • getTips

        public java.util.List<java.lang.String> getTips()
        Returns:
        all the the tips
      • isDisplayShowOnStartup

        public boolean isDisplayShowOnStartup()
        Returns:
        if true, the "Show On Startup" checkbox is displayed
      • isShowOnStartup

        public boolean isShowOnStartup()
        Returns:
        the value of the checkbox "Show On Startup"
      • setDisplayShowOnStartup

        public void setDisplayShowOnStartup​(boolean displayShowOnStartup)
        Parameters:
        if - true, the checkbox "Show on startup" is displayed
      • setIndex

        public void setIndex​(int index)
        Parameters:
        index - the index of the selected tip. By default, the tip is chosen randomly
      • setImage

        public void setImage​(org.eclipse.swt.graphics.Image image)
        Parameters:
        image - the image to set
      • setShowOnStartup

        public void setShowOnStartup​(boolean showOnStartup)
        Parameters:
        the - value of the checkbox "Show on startup"
      • setStyle

        public void setStyle​(TipOfTheDay.TipStyle style)
        Parameters:
        style - the style of the window
      • getShell

        public org.eclipse.swt.widgets.Shell getShell()
        Returns:
        the shell that contains the "tip of the day" box