|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
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.
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 |
public java.awt.Component getPage()
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.
public java.lang.String getTabName()
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";
}
getTabID()public java.lang.String getTabID()
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";
}
getTabName()public java.lang.String getMenuName()
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";
}
getTabID()public void setActive(boolean firstTimeShown)
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
}
}
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.killActive()public boolean killActive()
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
}
setActive(boolean)public boolean hasHelp()
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.
showHelp()public void showHelp()
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.
hasHelp()public boolean canSave()
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();
}
saveData()public boolean saveData()
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.
canSave()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||