com.novell.application.console.snapin
Interface PageSnapin

All Superinterfaces:
Help, Snapin
All Known Implementing Classes:
AbstractPageSnapin, AdminPageSnapin

public interface PageSnapin
extends Snapin, Help

Provides the interface that must be implemented by property page snap-in writers.

Note: The size of property pages is now hardcoded to 640 X 480, and the getPreferredSize() and setPreferredSize() methods have been removed. This has the following implications:

Note: Currently, there is a possible problem with hosting a JComboBox swing component on a property page.

See Also:
PropertyBook

Method Summary
 boolean canSave()
          Determines whether the page data is ready to be saved.
 java.lang.String getMenuName()
          Returns the language dependent, unique menu item name for the menu on Multi-Page Tabs.
 java.awt.Component getPage()
          Provides a reference to the actual Component for the given page snap-in.
 java.lang.String getTabID()
          Returns the globally unique, language independent identifier (TabID) for the tab folder where the current page is to be placed.
 java.lang.String getTabName()
          Returns the language dependent, translated display name for the tab where the page is to be placed.
 boolean hasHelp()
          Determines the state of the Property Book Help button.
 boolean killActive()
          Determines if the page can lose focus.
 boolean saveData()
          Saves page data to a persistent store.
 void setActive(boolean firstTimeShown)
          Indicates that your page is receiving focus next.
 void showHelp()
          Displays Help information when the hasHelp() method has returned true.
 
Methods inherited from interface com.novell.application.console.snapin.Snapin
getSnapinDescription, getSnapinName, initSnapin, shutdownSnapin
 

Method Detail

getPage

public java.awt.Component getPage()
Provides a reference to the actual Component for the given page snap-in.

The getPage() method is called when the PropertyBook is initiated, allowing you to provide a reference to the property page Component. Only an AWT Panel should be used with property pages.

Returns:
The visual Component of the given property page that is wrapped in a java.AWT.Component.

getTabName

public java.lang.String getTabName()
Returns the language dependent, translated display name for the tab where the page is to be placed.

This string should be read from a resource file for the purposes of internationalization. This name will only be used when a new tab is being created, not when an existing tab is being extended. If this tab does not exist, the Property Book will use the string name for the tab name, otherwise it is ignored. The following code snippet shows how the getTabName() call is made.


    public String getTabName()
    {
        return "FileInfo";
    }
 
Returns:
The translated display name for the tab.
See Also:
getTabID()

getTabID

public java.lang.String getTabID()
Returns the globally unique, language independent identifier (TabID) for the tab folder where the current page is to be placed.

This TabID can be any globally unique string. If a Tab with the specified TabID exists, the page will extend the Tab, if necessary, by converting it to a Multi-Page Tab, and then adding the menu name to the tab's dropdown menu. If no tab with the specified TabID exists, the PropertyBook will create a new tab folder and assign it the display name obtained from the getTabName() method call. The tab page is then added to this new folder.

Any Tab may be extended by third-party developers if its TabID is published to the development community and someone writes a Page snap-in that returns the same TabID from its getTabID() method. The following code snippet shows how the getTabID() call is made.


    public String getTabID()
    {
        return "com.novell.sample.snapins.filesystem.fileinfo";
    }
 
Returns:
The tab indentification name.
See Also:
getTabName()

getMenuName

public java.lang.String getMenuName()
Returns the language dependent, unique menu item name for the menu on Multi-Page Tabs.

The PropertyBook calls the getMenuName() method to determine the the menu item name for this page if the Tab is a Multi-Page Tab. The menu item name is displayed in a pop-up menu whenever a user selects a Multi-Page Tab. You can return NULL if the Tab is not a Multi-Page Tab and you are sure it will never be extended. That is, its TabID will never be published to the third-party snap-in development community. The following code snippet shows how the getMenuName() call is made.


    public String getMenuName()
    {
        return "Rename";
    }
 
Returns:
The displayable menu name or null if the tab ID cannot be extended.
See Also:
getTabID()

setActive

public void setActive(boolean firstTimeShown)
Indicates that your page is receiving focus next.

The setActive() method is called when your page is about get the focus (to be shown).


       public void setActive( boolean firstTimeShown )
       {
          if( firstTimeShown )
          {
             // read data from source and populate page
          }
       }
 
Parameters:
firstTimeShown - Boolean set to true the first time your page gets focus, then set to false to indicate the page has previously been given focus.
See Also:
killActive()

killActive

public boolean killActive()
Determines if the page can lose focus.

The killActive() method is called when your snap-in page is about to lose focus. To give the current focus holder an opportunity to veto the change, the PropertyBook calls the page's killActive() method. If the owning PageSnapin determines that its data is valid, it should return true, indicating its willingness to proceed with the focus change. If the PageSnapin checks its data and finds it invalid, it should display an error dialog and then return false, effectively vetoing the change in focus. Thus, you should implement this method to validate snap-in data before losing focus, as shown below.


       public boolean killActive()
       {
          // Check page data validity
          // Return true if data is valid
          // else display error dialog, then return false
       }
 
Returns:
A boolean set to true if it is OK to lose focus, otherwise display an error dialog and return false to stop the page from losing focus.
See Also:
setActive(boolean)

hasHelp

public boolean hasHelp()
Determines the state of the Property Book Help button.

You should override this method and return true if you wish to provide Help for your snap-in, and have the Help button enabled for your page. You should also override the showHelp() method.

Specified by:
hasHelp in interface Help
Returns:
Boolean set to true if you want the Property Book Help] button to be enabled for this page, otherwise return false to disable the Help button.
See Also:
showHelp()

showHelp

public void showHelp()
Displays Help information when the hasHelp() method has returned true.

The showHelp() method is called when the user presses the Property Book Help button. To provide help for your snap-in, you must override the hasHelp() method to return true, then implement the showHelp() method.

Specified by:
showHelp in interface Help
See Also:
hasHelp()

canSave

public boolean canSave()
Determines whether the page data is ready to be saved.

The canSave() method is called in each of its page snap-ins to validate dialog fields,when the user selects either the OK button, or the Apply Now button. You should implement this method to to give each page snap-in a chance to validate page data before saving data to storage. The only difference between this method and the killActive method is that this method is called when the user is trying to close the PropertyBook and the killActive() method is called when the user is trying to change the focus to a different page. This method can also be implemented by simply calling the killActive() method as shown below.


       public boolean canSave()
       {
          // Check page data validity
          // Return true if data is valid
          // Else display error dialog, then return false
          return true; // or
          return killActive();
       }
 
Returns:
A boolean set to true if your snap-in data is ready to be saved, otherwise display a dialog informing the user of why the operation was stopped and return false.
See Also:
saveData()

saveData

public boolean saveData()
Saves page data to a persistent store.

The saveData() method is called when the user selects either the OK button or the Apply Now button, and the canSave() method has returned true. If all the page snap-ins return true in their canSave() methods, this indicates to the PropertyBook that the save sequence may continue. The PropertyBook then calls each of its page snap-in's saveData() methods. If during the process of saving its data the page snap-in has a problem, it can display a dialog informing the user of why the operation was stopped and then return false, thereby stopping the operation for the remaining pages.

Returns:
A boolean set to true if the page data has been saved to a persistant store, otherwise display a dialog informing the user of why the operation was stopped and return false.
See Also:
canSave()


API Documentation Copyright © 1998-2003 Novell, Inc. All rights reserved.
ConsoleOne is a registered trademark of Novell Inc.
Generated December 9 2003 1727.