JIDE 3.5.15

com.jidesoft.tipoftheday
Class TipOfTheDayDialog

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Dialog
                  extended by javax.swing.JDialog
                      extended by com.jidesoft.dialog.StandardDialog
                          extended by com.jidesoft.tipoftheday.TipOfTheDayDialog
All Implemented Interfaces:
ButtonNames, ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class TipOfTheDayDialog
extends StandardDialog

Tip of the Day dialog. Here is a sample code of how to use it.

  ResourceBundleTipOfTheDaySource tipOfTheDaySource = new ResourceBundleTipOfTheDaySource(ResourceBundle.getBundle("tips"));
  tipOfTheDaySource.setCurrentTipIndex(-1);
  java.net.URL styleSheet = TipOfTheDayDialog.class.getResource("/tips.css");
  JDialog dialog = new TipOfTheDayDialog(frame, tipOfTheDaySource, new AbstractAction("Show Tip
 of
 the Day the Next Time"){
      public void actionPerformed(ActionEvent e) {
          // change your user preference
      }
  }, styleSheet);
  dialog.pack();
  dialog.show();
 

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.jidesoft.dialog.StandardDialog
StandardDialog.DefaultStandardDialogPane
 
Nested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialog
 
Nested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityType
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class com.jidesoft.dialog.StandardDialog
_propertyChangeListener, _standardDialogPane, RESULT_AFFIRMED, RESULT_CANCELLED
 
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Dialog
DEFAULT_MODALITY_TYPE
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface com.jidesoft.dialog.ButtonNames
APPLY, BACK, BROWSE, CANCEL, CLEAR, CLOSE, DETAILS, EDIT, EXIT, FIND, FIND_NEXT, FINISH, FORWARD, HELP, NEW, NEXT, NO, OK, OPEN, PRINT, REPLACE, RESET, RETRY, RUN, SAVE, SAVE_AS, STOP, YES
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TipOfTheDayDialog(Dialog owner, TipOfTheDaySource tipOfTheDaySource, Action showTipAction, URL optionalStyleSheet)
           
TipOfTheDayDialog(Frame owner, TipOfTheDaySource tipOfTheDaySource, Action showTipAction, URL optionalStyleSheet)
           
 
Method Summary
protected  void createActions()
          Subclass can override to create actions for buttons.
 JComponent createBannerPanel()
          Subclasses should implement this method to create the banner panel.
 ButtonPanel createButtonPanel()
          Subclasses should implement this method to create the button panel.
 JComponent createContentPanel()
          Subclasses should implement this method to create the content panel.
protected  Component createHtmlBrowser(URL optionalStyleSheet)
          Creates the html browser component.
protected  JComponent createScrollPaneForHtmlBrowser(Component htmlBrowser)
          Creates a scroll pane for the html browser.
protected  StandardDialogPane createStandardDialogPane()
           
protected  void displayHtmlBrowser(String content, String url)
          Displays the content in the html browser.
protected  Action getCloseAction()
          Gets the action used by close button.
 int getCurrentTipIndex()
          Gets the current tip index.
protected  Action getNextTipAction()
          Gets the action used by next tip button.
protected  Action getPreviousTipAction()
          Gets the action used by prev tip button.
 String getResourceString(String key)
          Gets the resource string used in JideTabbedPane.
 JCheckBox getShowTipCheckBox()
           
 TipOfTheDaySource getTipOfTheDaySource()
          Gets the TipOfTheDaySource.
 boolean isShowTooltip()
           
 void nextTip()
          Displays next tip.
 void pack()
           
 void previousTip()
          Displays previous tip.
 void setCurrentTipIndex(int currentTipIndex)
          Sets the current tip index.
 void setShowTooltip(boolean showTooltip)
           
 
Methods inherited from class com.jidesoft.dialog.StandardDialog
createOKCancelButtonPanel, getBannerPanel, getButtonPanel, getContentPanel, getDefaultAction, getDefaultCancelAction, getDialogResult, getInitFocusedComponent, getStandardDialogPane, initComponents, initialize, setDefaultAction, setDefaultCancelAction, setDialogResult, setInitFocusedComponent, show
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setModalityType, setResizable, setTitle, setUndecorated, setVisible, toBack
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TipOfTheDayDialog

public TipOfTheDayDialog(Frame owner,
                         TipOfTheDaySource tipOfTheDaySource,
                         Action showTipAction,
                         URL optionalStyleSheet)

TipOfTheDayDialog

public TipOfTheDayDialog(Dialog owner,
                         TipOfTheDaySource tipOfTheDaySource,
                         Action showTipAction,
                         URL optionalStyleSheet)
Method Detail

createStandardDialogPane

protected StandardDialogPane createStandardDialogPane()
Overrides:
createStandardDialogPane in class StandardDialog

pack

public void pack()
Overrides:
pack in class StandardDialog

createHtmlBrowser

protected Component createHtmlBrowser(URL optionalStyleSheet)
Creates the html browser component. By default, we will create a JEditorPane.

Parameters:
optionalStyleSheet - a stylesheet file
Returns:
a html browser component.

createScrollPaneForHtmlBrowser

protected JComponent createScrollPaneForHtmlBrowser(Component htmlBrowser)
Creates a scroll pane for the html browser. By default, we will create a JScrollPane. You may override it to create your own scroll pane or even just return the html browser itself if the browser already has its own scroll pane.

Parameters:
htmlBrowser - the html browser
Returns:
scroll pane.

displayHtmlBrowser

protected void displayHtmlBrowser(String content,
                                  String url)
Displays the content in the html browser.

Parameters:
content - the html content
url - the url of the html content if any. By default, we didn't use this parameter as JEditorPane doesn't need it. If you write your own component for html browser, you might need it.

createButtonPanel

public ButtonPanel createButtonPanel()
Description copied from class: StandardDialog
Subclasses should implement this method to create the button panel. 90% of dialogs have buttons. It is highly recommended to use our ButtonPanel.

Specified by:
createButtonPanel in class StandardDialog
Returns:
the button panel.
See Also:
ButtonPanel

createActions

protected void createActions()
Subclass can override to create actions for buttons.


getPreviousTipAction

protected Action getPreviousTipAction()
Gets the action used by prev tip button. Subclass can override it to return different action for prev tip button.

Returns:
the prev tip action.

getNextTipAction

protected Action getNextTipAction()
Gets the action used by next tip button. Subclass can override it to return different action for next tip button.

Returns:
the next tip action.

getCloseAction

protected Action getCloseAction()
Gets the action used by close button. Subclass can override it to return different action for close button.

Returns:
the close action.

previousTip

public void previousTip()
Displays previous tip.


nextTip

public void nextTip()
Displays next tip.


getCurrentTipIndex

public int getCurrentTipIndex()
Gets the current tip index. User can save this value to preference so that when the dialog comes up again, it can call setCurrentTipIndex(int) to set the index back.

Returns:
the current tip index.

setCurrentTipIndex

public void setCurrentTipIndex(int currentTipIndex)
Sets the current tip index.

Parameters:
currentTipIndex - the current tip index.
See Also:
getCurrentTipIndex()

getTipOfTheDaySource

public TipOfTheDaySource getTipOfTheDaySource()
Gets the TipOfTheDaySource.

Returns:
the TipOfTheDaySource.

getShowTipCheckBox

public JCheckBox getShowTipCheckBox()

createBannerPanel

public JComponent createBannerPanel()
Description copied from class: StandardDialog
Subclasses should implement this method to create the banner panel. By default banner panel will appear on top of the dialog unless you override initComponent() method. Banner panel is really used to balance the layout of dialog to make the dialog looking good. However it can be used to show some help text. It is highly recommended to use our BannerPanel

If subclass doesn't want to have a banner panel, just return null.

Specified by:
createBannerPanel in class StandardDialog
Returns:
the banner panel.

createContentPanel

public JComponent createContentPanel()
Description copied from class: StandardDialog
Subclasses should implement this method to create the content panel. This is the main panel of the dialog which will be added to the center of the dialog. Subclass should never return null.

Specified by:
createContentPanel in class StandardDialog
Returns:
the content panel.

isShowTooltip

public boolean isShowTooltip()

setShowTooltip

public void setShowTooltip(boolean showTooltip)

getResourceString

public String getResourceString(String key)
Gets the resource string used in JideTabbedPane. Subclass can override it to provide their own strings.

Parameters:
key - the resource key
Returns:
the localized string.

JIDE 3.5.15