com.tensegrity.skeleton.commands
Class PreferenceHelper

java.lang.Object
  extended bycom.tensegrity.skeleton.commands.PreferenceHelper
All Implemented Interfaces:
PreferenceHelp

public class PreferenceHelper
extends java.lang.Object
implements PreferenceHelp

Some utility methods for setting the preferences. They are needed twice:

The PreferenceHelper also provides some settings like last used directory necessary for file dialogs.

Version:
$Id: PreferenceHelper.java,v 1.67 2006/03/24 15:40:39 BurkhardWick Exp $
Author:
Andreas Ebbert

Constructor Summary
PreferenceHelper(ApplicationFrame frame)
          Constructor specifying the SwingGraphFrame.
 
Method Summary
 void applyGridSettings()
          Applies the settings given by the preferences to the CompositeViewGrid object of the CompositeView.
 void applyGridSettings(GraphDocument document)
          Applies the grid settings of the preferences to the CompositeViewGrid object of the CompositeView of the given Document.
 void applyRulerSettings()
          Applies the settings given by the preferences to the CompositeViewRuler object of views.
 void applyRulerSettings(GraphDocument document)
          Applies the Ruler Settings to the given document.
 void changeNavigatorPanelRendererAttribute(java.lang.String name, boolean value)
          Sets an attribute on the AttributeSet that is returned by the NavigatorPanel class statically and which can be used to adjust the RendererConfigurationC that is used by all NavigatorPanels.
 void changeSwingGraphPanelRendererAttribute(java.lang.String name, boolean value)
          Sets an attribute on the AttributeSet that is returned by the SwingGraphPanel class statically and which can be used to adjust the RendererConfigurationC that is used by all SwingGraphPanels during user-interaction.
 java.io.File getCurrentDirectory()
          Returns the current directory of this application.
 void initCurrentDirectory()
          Initializes the currently used directory.
 void initFrameSizeAndPosition()
          Initializes the size and the position of the top level frame to the values found in the preferences.
 void initToolbarVisibilties()
          Called at Application start to initialize the visibilities of the Toolbar.
 void setCurrentDirectory(java.io.File directory)
          Sets the currently used directory.
 void setLanguage(java.lang.String value)
          Sets the used language to the one specified by value.
 void setLookAndFeel(java.lang.String laf)
          Sets the look and feel to the one specified by value.
 void setSubMenuRecentlyUsed(SwingMenu menu)
          Sets the Sub-Menu for the recenlty used files to the given SwingMenu.
 void setTooltipsEnabled(boolean b)
          Enables the tooltips if b is true.
 void updateRecentlyUsedFilesMenu(ApplicationFrame applicationFrame)
          Updates the menu of recently used files.
 void updateRecentlyUsedFilesMenu(ApplicationFrame applicationFrame, java.io.File newestFile)
          Updates the menu of recently used files and moves the given file to the top of the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreferenceHelper

public PreferenceHelper(ApplicationFrame frame)
Constructor specifying the SwingGraphFrame.

Parameters:
frame - the SwingGraphFrame of the application.
Method Detail

setLanguage

public void setLanguage(java.lang.String value)
Sets the used language to the one specified by value.

Specified by:
setLanguage in interface PreferenceHelp
Parameters:
value - a string defining the language to be used.

setLookAndFeel

public void setLookAndFeel(java.lang.String laf)
Sets the look and feel to the one specified by value.

Specified by:
setLookAndFeel in interface PreferenceHelp
Parameters:
laf - a string defining the look and feel to be used.

setTooltipsEnabled

public void setTooltipsEnabled(boolean b)
Enables the tooltips if b is true.

Specified by:
setTooltipsEnabled in interface PreferenceHelp
Parameters:
b - true, if tooltips should be displayed.

updateRecentlyUsedFilesMenu

public void updateRecentlyUsedFilesMenu(ApplicationFrame applicationFrame,
                                        java.io.File newestFile)
Updates the menu of recently used files and moves the given file to the top of the list.

Parameters:
applicationFrame - the ApplicationFrame.
newestFile - the file to move to the top of the list

updateRecentlyUsedFilesMenu

public void updateRecentlyUsedFilesMenu(ApplicationFrame applicationFrame)
Updates the menu of recently used files.

Parameters:
applicationFrame - the ApplicationFrame.

getCurrentDirectory

public java.io.File getCurrentDirectory()
Returns the current directory of this application.

Specified by:
getCurrentDirectory in interface PreferenceHelp
Returns:
the current directory of this application.

setCurrentDirectory

public void setCurrentDirectory(java.io.File directory)
Sets the currently used directory.

Specified by:
setCurrentDirectory in interface PreferenceHelp
Parameters:
directory - the directory to set.

setSubMenuRecentlyUsed

public void setSubMenuRecentlyUsed(SwingMenu menu)
Sets the Sub-Menu for the recenlty used files to the given SwingMenu.

Parameters:
menu - the SwingMenu to set.

initFrameSizeAndPosition

public void initFrameSizeAndPosition()
Initializes the size and the position of the top level frame to the values found in the preferences.

Specified by:
initFrameSizeAndPosition in interface PreferenceHelp

initCurrentDirectory

public void initCurrentDirectory()
Initializes the currently used directory.

Specified by:
initCurrentDirectory in interface PreferenceHelp

changeSwingGraphPanelRendererAttribute

public void changeSwingGraphPanelRendererAttribute(java.lang.String name,
                                                   boolean value)
Sets an attribute on the AttributeSet that is returned by the SwingGraphPanel class statically and which can be used to adjust the RendererConfigurationC that is used by all SwingGraphPanels during user-interaction.

Parameters:
name - of the renderer-configuration item to change.
value - boolean-value to change the renderer-configuration item to.

changeNavigatorPanelRendererAttribute

public void changeNavigatorPanelRendererAttribute(java.lang.String name,
                                                  boolean value)
Sets an attribute on the AttributeSet that is returned by the NavigatorPanel class statically and which can be used to adjust the RendererConfigurationC that is used by all NavigatorPanels.

Parameters:
name - of the renderer-configuration item to change.
value - boolean-value to change the renderer-configuration item to.

applyRulerSettings

public void applyRulerSettings(GraphDocument document)
Applies the Ruler Settings to the given document.

Specified by:
applyRulerSettings in interface PreferenceHelp
Parameters:
document - the document to apply the new ruler settings to.

applyRulerSettings

public void applyRulerSettings()
Applies the settings given by the preferences to the CompositeViewRuler object of views.

Specified by:
applyRulerSettings in interface PreferenceHelp

applyGridSettings

public void applyGridSettings(GraphDocument document)
Applies the grid settings of the preferences to the CompositeViewGrid object of the CompositeView of the given Document.

Specified by:
applyGridSettings in interface PreferenceHelp
Parameters:
document - the GraphDocument containing the grid to configure.

applyGridSettings

public void applyGridSettings()
Applies the settings given by the preferences to the CompositeViewGrid object of the CompositeView.

Specified by:
applyGridSettings in interface PreferenceHelp

initToolbarVisibilties

public void initToolbarVisibilties()
Called at Application start to initialize the visibilities of the Toolbar. They are set to their last state.

Specified by:
initToolbarVisibilties in interface PreferenceHelp


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.