|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jidesoft.swing.AbstractLayoutPersistence
public abstract class AbstractLayoutPersistence
Abstract implementation of LayoutPersistence
.
Field Summary | |
---|---|
protected String |
_layoutDirectory
|
protected boolean |
_loadingLayoutData
|
protected String |
_profileKey
Key of profile. |
protected boolean |
_useFrameBounds
true if the main frame bounds is persisted |
protected boolean |
_useFrameBoundsSet
|
protected boolean |
_useFrameState
true if the main frame state is persisted. |
protected boolean |
_useFrameStateSet
|
protected boolean |
_usePref
Whether use javax.utils.pref. |
protected short |
_version
Version. |
protected static String |
DEFAULT_PROFILE_NAME
Default profile name if user didn't select any profile name. |
protected static String |
LAYOUT_COUNT_STRING
|
protected String |
LAYOUT_POSTFIX
|
protected static int |
MAX_PREF_BYTE_ARRAY_LENGTH
|
static String |
PROPERTY_PROFILE_KEY
|
static String |
PROPERTY_USE_PREF
|
static String |
PROPERTY_VERSION
|
static short |
V2004
The persistence version in place at the end of 2004. |
static short |
V2005_09
The persistence version in place starting September 2005. |
Fields inherited from interface com.jidesoft.swing.LayoutPersistence |
---|
ATTRIBUTE_PERSISTENCE_NAME, NODE_LAYOUT_PERSISTENCE |
Constructor Summary | |
---|---|
AbstractLayoutPersistence()
|
Method Summary | |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. |
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list for a specific property. |
protected void |
firePropertyChange(String propertyName,
boolean oldValue,
boolean newValue)
Support for reporting bound property changes for boolean properties. |
protected void |
firePropertyChange(String propertyName,
int oldValue,
int newValue)
Support for reporting bound property changes for integer properties. |
protected void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
Support for reporting bound property changes for Object properties. |
List<String> |
getAvailableLayouts()
Gets the list of available layout names. |
String |
getLayoutDirectory()
Gets setting file directory. |
String |
getLayoutPersistenceName()
Gets the persistence's name. |
byte[] |
getLayoutRawData()
Gets layout raw data in byte array. |
PersistenceUtilsCallback.Load |
getLoadCallback()
Gets the load callback to help add some customized information while loading layout from XML format. |
String |
getProfileKey()
Gets profile key. |
PropertyChangeListener[] |
getPropertyChangeListeners()
Returns an array of all the property change listeners registered on this component. |
PropertyChangeListener[] |
getPropertyChangeListeners(String propertyName)
Returns an array of all the listeners which have been associated with the named property. |
PersistenceUtilsCallback.Save |
getSaveCallback()
Gets the save callback to help add some customized information while saving layout to XML format. |
short |
getVersion()
Gets version number of profile. |
String |
getXmlEncoding()
Gets XML encoding while saving layout to XML format. |
boolean |
isLast()
Checks if it is the last one during when loading several several LayoutPersistence s. |
boolean |
isLayoutAvailable(String layoutName)
Checks if the layout is available. |
boolean |
isLayoutDataVersionValid(String layoutName)
Checks if the layout version of the named layout is valid. |
boolean |
isLoadingLayoutData()
Gets the flag indicating if the layout persistence is currently loading layout. |
boolean |
isNeedFormatCheck()
Gets the flag indicating if format check is required. |
boolean |
isUsePref()
Checks if the layout will be saved using javax.util.pref package. |
protected boolean |
isVersionCompatible(int version)
Tells whether the given version is compatible with our current version. |
boolean |
isXmlFormat()
Gets the flag indicating if the layout should be saved to XML format by default. |
void |
loadInitialLayout(InputStream layoutStream)
Load initial layout from an initial layout file designed by Visual Designer. |
void |
loadInitialLayout(String layoutFile)
Load initial layout from an initial layout file designed by Visual Designer. |
void |
loadLayoutData()
Load layout from default layout data from profile. |
void |
loadLayoutDataFrom(String layoutName)
Load layout from default layout data from named profile. |
void |
loadLayoutDataFromFile(String fileName)
Loads layout from default layout data from a file. |
void |
removeLayout(String layoutName)
Removes the layout. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. |
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list for a specific property. |
void |
saveLayoutData()
Save layout information to default profile. |
void |
saveLayoutDataAs(String layoutName)
Save layout data to profile that specified in layoutName Note: Always use all lower case. |
void |
saveLayoutDataToFile(String layoutFileName)
Save layout data to file that specified in layoutFileName . |
void |
setLast(boolean last)
Sets the LayoutPersistence as the last one (or not the last one) when loading several LayoutPersistences. |
void |
setLayoutDirectory(String layoutDirectory)
Sets the layout directory. |
void |
setLayoutPersistenceName(String layoutPersistenceName)
Sets the persistence's name. |
void |
setLayoutRawData(byte[] layoutData)
Sets the layout using layout raw data. |
void |
setLoadCallback(PersistenceUtilsCallback.Load loadCallback)
Sets the load callback to help add some customized information while loading layout from XML format. |
void |
setLoadingLayoutData(boolean loadingLayoutData)
Sets the flag indicating if the layout persistence is currently loading layout. |
void |
setNeedFormatCheck(boolean needFormatCheck)
Sets the flag indicating if format check is required. |
void |
setProfileKey(String profileKey)
Sets the profile key to be used to store layout information. |
void |
setSaveCallback(PersistenceUtilsCallback.Save saveCallback)
Sets the save callback to help add some customized information while saving layout to XML format. |
void |
setUseFrameBounds(boolean useFrameBounds)
If true, the bounds of main frame will be persisted in layout data. |
void |
setUseFrameState(boolean useFrameState)
If true, the state of main frame will be persisted in layout data. |
void |
setUsePref(boolean usePref)
If true, use javax.util.pref to store frames layout data. |
void |
setVersion(short version)
Sets version number of profile. |
void |
setXmlEncoding(String xmlEncoding)
Sets XML encoding while saving layout to XML format. |
void |
setXmlFormat(boolean xmlFormat)
Sets the flag indicating if the layout should be saved to XML format by default. |
protected boolean |
shouldUseFrameBounds(boolean wasVisible)
|
protected boolean |
shouldUseFrameState(boolean wasVisible)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.jidesoft.swing.LayoutPersistence |
---|
beginLoadLayoutData, isLoadDataSuccessful, loadInitialLayout, loadLayoutFrom, loadLayoutFrom, resetToDefault, saveLayoutTo, saveLayoutTo |
Field Detail |
---|
public static final short V2004
public static final short V2005_09
protected short _version
protected static final String DEFAULT_PROFILE_NAME
public static final String PROPERTY_PROFILE_KEY
public static final String PROPERTY_USE_PREF
public static final String PROPERTY_VERSION
protected String _profileKey
protected static final int MAX_PREF_BYTE_ARRAY_LENGTH
protected boolean _loadingLayoutData
protected boolean _useFrameBounds
protected boolean _useFrameBoundsSet
protected boolean _useFrameState
protected boolean _useFrameStateSet
protected boolean _usePref
protected static final String LAYOUT_COUNT_STRING
protected final String LAYOUT_POSTFIX
protected String _layoutDirectory
Constructor Detail |
---|
public AbstractLayoutPersistence()
Method Detail |
---|
public short getVersion()
getVersion
in interface LayoutPersistence
public void setVersion(short version)
setVersion
in interface LayoutPersistence
version
- new versionpublic String getProfileKey()
public void setProfileKey(String profileKey)
setProfileKey
in interface LayoutPersistence
profileKey
- profile keypublic void loadLayoutData()
loadLayoutData
in interface LayoutPersistence
public boolean isLayoutAvailable(String layoutName)
LayoutPersistence
isLayoutAvailable
in interface LayoutPersistence
layoutName
- the layout name. In Window registry, the layout name is the registry key name. If it's a layout
file, the layout name is the file name with ".layout" as suffix.
public List<String> getAvailableLayouts()
LayoutPersistence
usePref
is true and profileKey
has been
set, the method will return the list of save layouts. If usePref
is false, it will find out the
layout file in layout directory.
getAvailableLayouts
in interface LayoutPersistence
public void removeLayout(String layoutName)
LayoutPersistence
removeLayout
in interface LayoutPersistence
layoutName
- the layout name. In Window registry, the layout name is the registry key name. If it's a layout
file, the layout name is the file name with ".layout" as suffix.public void loadLayoutDataFrom(String layoutName)
loadLayoutDataFrom
in interface LayoutPersistence
layoutName
- the layout name. In Window registry, the layout name is the registry key name. If it's a layout
file, the layout name is the file name with ".layout" as suffix. Please don't add ".layout" to
invoke this method.public boolean isLayoutDataVersionValid(String layoutName)
isLayoutDataVersionValid
in interface LayoutPersistence
layoutName
- the layout name. In Window registry, the layout name is the registry key name. If it's a layout
file, the layout name is the file name with ".layout" as suffix.
protected boolean isVersionCompatible(int version)
version
- the version to be checked
public void loadLayoutDataFromFile(String fileName)
loadLayoutDataFromFile
in interface LayoutPersistence
fileName
- a layout file name.public void saveLayoutData()
saveLayoutData
in interface LayoutPersistence
public String getLayoutDirectory()
getLayoutDirectory
in interface LayoutPersistence
public void setLayoutDirectory(String layoutDirectory)
LayoutPersistence
usePref
is false.
setLayoutDirectory
in interface LayoutPersistence
layoutDirectory
- the layout directory.public void saveLayoutDataAs(String layoutName)
layoutName
Note: Always use all lower case. We found
some problems with upper case on Windows.
saveLayoutDataAs
in interface LayoutPersistence
layoutName
- the layout namepublic void saveLayoutDataToFile(String layoutFileName)
layoutFileName
. The layoutFileName should be full
qualified file name. If the file exists, it will be overwritten.
saveLayoutDataToFile
in interface LayoutPersistence
layoutFileName
- the layout file namepublic void setLayoutRawData(byte[] layoutData)
LayoutPersistence
setLayoutRawData
in interface LayoutPersistence
layoutData
- the byte array that returned from getLayoutRawData
public byte[] getLayoutRawData()
LayoutPersistence
setLayoutRawData
to set the layout.
getLayoutRawData
in interface LayoutPersistence
public boolean isUsePref()
public void setUsePref(boolean usePref)
setUsePref
in interface LayoutPersistence
usePref
- use javax pref or not. Default is truepublic void setUseFrameState(boolean useFrameState)
setUseFrameState
in interface LayoutPersistence
useFrameState
- true if the state of main frame will be persisted in layout data.LayoutPersistence.setUseFrameBounds(boolean)
public void setUseFrameBounds(boolean useFrameBounds)
setUseFrameBounds
in interface LayoutPersistence
useFrameBounds
- true if the bounds of main frame will be persisted in layout data.LayoutPersistence.setUseFrameState(boolean)
public void addPropertyChangeListener(PropertyChangeListener listener)
listener
- the PropertyChangeListener to be addedremovePropertyChangeListener(java.beans.PropertyChangeListener)
,
getPropertyChangeListeners()
,
addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener listener)
listener
- the PropertyChangeListener to be removedaddPropertyChangeListener(java.beans.PropertyChangeListener)
,
getPropertyChangeListeners()
,
removePropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
public PropertyChangeListener[] getPropertyChangeListeners()
PropertyChangeListener
s or an empty array if no property change
listeners are currently registeredaddPropertyChangeListener(java.beans.PropertyChangeListener)
,
removePropertyChangeListener(java.beans.PropertyChangeListener)
,
getPropertyChangeListeners(java.lang.String)
,
PropertyChangeSupport.getPropertyChangeListeners()
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
propertyName
- one of the property names listed abovelistener
- the PropertyChangeListener to be addedremovePropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
,
getPropertyChangeListeners(java.lang.String)
,
addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
propertyName
- a valid property namelistener
- the PropertyChangeListener to be removedaddPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
,
getPropertyChangeListeners(java.lang.String)
,
removePropertyChangeListener(java.beans.PropertyChangeListener)
public PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
propertyName
- the property name.
PropertyChangeListeners
associated with the named property or an empty array if
no listeners have been addedaddPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
,
removePropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
,
getPropertyChangeListeners()
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
propertyName
- the property whose value has changedoldValue
- the property's previous valuenewValue
- the property's new valueprotected void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
propertyName
- the property whose value has changedoldValue
- the property's previous valuenewValue
- the property's new valueprotected void firePropertyChange(String propertyName, int oldValue, int newValue)
propertyName
- the property whose value has changedoldValue
- the property's previous valuenewValue
- the property's new valuepublic void loadInitialLayout(String layoutFile) throws ParserConfigurationException, SAXException, IOException
LayoutPersistence
loadInitialLayout
in interface LayoutPersistence
layoutFile
- the full file path to the .ilayout file.
ParserConfigurationException
- when DocumentBuilder cannot be created which satisfies the configuration
requested.
SAXException
- when DocumentBuilder has trouble parsing the initial layout xml file.
IOException
- when DocumetnBuilder encounters any errors when reading the initial layout
xml file.public void loadInitialLayout(InputStream layoutStream) throws ParserConfigurationException, SAXException, IOException
LayoutPersistence
loadInitialLayout
in interface LayoutPersistence
layoutStream
- an input stream containing an initial layout.
ParserConfigurationException
- when DocumentBuilder cannot be created which satisfies the configuration
requested.
SAXException
- when DocumentBuilder has trouble parsing the initial layout xml file.
IOException
- when DocumetnBuilder encounters any errors when reading the initial layout
xml file.protected boolean shouldUseFrameState(boolean wasVisible)
protected boolean shouldUseFrameBounds(boolean wasVisible)
public boolean isLast()
LayoutPersistence
LayoutPersistence
s. Only the last
LayoutPersistence
will restore the main window's state and bounds and make the main window visible.
isLast
in interface LayoutPersistence
public void setLast(boolean last)
LayoutPersistence
setLast
in interface LayoutPersistence
last
- true if the layout persistence is the last one in the LayoutPersistenceManager
.public boolean isLoadingLayoutData()
public void setLoadingLayoutData(boolean loadingLayoutData)
loadingLayoutData
- the flagpublic boolean isXmlFormat()
isXmlFormat
in interface LayoutPersistence
setXmlFormat(boolean)
public void setXmlFormat(boolean xmlFormat)
setXmlFormat
in interface LayoutPersistence
xmlFormat
- the flagpublic PersistenceUtilsCallback.Save getSaveCallback()
LayoutPersistence
getSaveCallback
in interface LayoutPersistence
public void setSaveCallback(PersistenceUtilsCallback.Save saveCallback)
LayoutPersistence
setSaveCallback
in interface LayoutPersistence
saveCallback
- the save call backpublic PersistenceUtilsCallback.Load getLoadCallback()
LayoutPersistence
getLoadCallback
in interface LayoutPersistence
public void setLoadCallback(PersistenceUtilsCallback.Load loadCallback)
LayoutPersistence
setLoadCallback
in interface LayoutPersistence
loadCallback
- the load call backpublic String getXmlEncoding()
LayoutPersistence
getXmlEncoding
in interface LayoutPersistence
public void setXmlEncoding(String xmlEncoding)
LayoutPersistence
setXmlEncoding
in interface LayoutPersistence
xmlEncoding
- the xml encodingpublic String getLayoutPersistenceName()
LayoutPersistence
LayoutPersistenceManager
manages.
getLayoutPersistenceName
in interface LayoutPersistence
public void setLayoutPersistenceName(String layoutPersistenceName)
LayoutPersistence
setLayoutPersistenceName
in interface LayoutPersistence
layoutPersistenceName
- the layout persistence namepublic boolean isNeedFormatCheck()
LayoutPersistence
LayoutPersistenceManager
scenario, it will be set to false if the
format is traditional binary.
isNeedFormatCheck
in interface LayoutPersistence
public void setNeedFormatCheck(boolean needFormatCheck)
LayoutPersistence
LayoutPersistenceManager
.
setNeedFormatCheck
in interface LayoutPersistence
needFormatCheck
- the flag
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |