public final class GFileManipulation extends Object
Modifier and Type | Method and Description |
---|---|
static void |
copyComponent(GComponent component)
Copies the values of the component and all the child components to the configuration file.
|
static org.jdom.Document |
createDomDocument(String filename)
create a dom document from the configuration file
|
static void |
exportComponent(GComponent component)
Export the values of the component and all the child components to the configuration file.
|
static List<org.jdom.Element> |
findAllElements(org.jdom.Element sourceElement,
String itemType,
String componentName)
Finds the elements in the DOM structure corresponding to a certain name and with an attribute
|
static org.jdom.Element |
findElement(org.jdom.Element sourceElement,
GItemTypeInterface itemType,
String attribute,
String attributeValue)
Finds the element in the DOM structure corresponding to a certain name and with an attribute
equal to attributeValue.
|
static org.jdom.Element |
findElement(org.jdom.Element sourceElement,
GItemTypeInterface itemType,
String attribute,
String attributeValue,
String defaultValue)
Finds the element in the DOM structure corresponding to a certain name and with an attribute
equal to attributeValue.
|
static org.jdom.Element |
findElement(org.jdom.Element sourceElement,
String itemType,
String attribute,
String attributeValue,
String defaultValue)
Deprecated.
The argument type should be an enum implementing the interface GItemTypeInterface
instead of a String. See
GItemTypeInterface for more details. |
static org.jdom.Element |
findFirstElement(org.jdom.Element sourceElement,
String itemType,
String elementName,
String defaultValue)
Finds the First element in the DOM structure corresponding to a certain element name.
|
static String |
getClipboardString()
Get the contents of the clipboar as a string.
|
static String |
getXmlItemType(GComponent component)
get the xml type in the configuration file
|
static void |
importComponent(GComponent component)
Imports the values of the component and all the child components from the configuration file.
|
static void |
loadComponent(String filename,
String componentName,
GComponent component)
Reads from the configuration file the configuration values for to the component identified in
the method.
|
static void |
loadFromDomDocument(org.jdom.Document domDocument,
String componentName,
GComponent component,
boolean saveValue,
boolean... rootVerification)
Load the component values from a Dom document.
|
static void |
pasteComponent(GComponent component)
Paste from the configuration file the configuration values for to the component identified in
the method.
|
static void |
readConfig(String filename,
String componentName,
GComponent component,
boolean saveValue,
boolean... verifications)
Reads from the configuration file the configuration values for to the component identified in
the method.
|
static void |
readConfigComponent(GComponent component)
read the configuration file for only one GComponent
|
static void |
resetComponent(GComponent component)
Reset the component given in input.
|
static void |
saveComponent(String filename,
String componentName,
GComponent component)
Writes the values of the component and all the child components to the configuration file.
|
static org.jdom.Document |
saveToDomDocument(String componentName,
GComponent component,
boolean saveValue)
Create a DOM document containing the informations of the component.
|
static List<GComponent> |
searchCompatibleComponents(GComponent component,
GComponent componentToSearch,
boolean useComponentName)
search compatible objects from a GComponent
|
static List<GComponent> |
searchCompatibleComponents(String filename,
GComponent componentToSearch,
boolean useComponentName)
search compatible objects from a configuration file
|
static void |
writeConfig(String filename,
String componentName,
GComponent component,
boolean saveValue)
Writes the values of the component and all the child components to the configuration file.
|
static void |
writeConfigFromElement(GComponent component,
String filename,
org.jdom.Element element)
Writes the values of the Element to the configuration file.
|
public static void resetComponent(GComponent component) throws GFileManipulatorException
component
- instance of the component that will be cleared.GFileManipulatorException
- in case there is a problem loading the values from the Dom
document.public static void loadFromDomDocument(org.jdom.Document domDocument, String componentName, GComponent component, boolean saveValue, boolean... rootVerification) throws GFileManipulatorException
domDocument
- Dom document to load the component values.componentName
- name of the component that shall be loaded from the configuration file.component
- instance of the component that will be loaded with the values loaded from
the configuration file.saveValue
- true if the saved values of the components being loaded from the dom
document shall be updated, false otherwise.rootVerification
- if true prevents the type verification of the configuration fileGFileManipulatorException
- in case there is a problem loading the values from the Dom
document.public static void readConfigComponent(GComponent component) throws GFileManipulatorException
component
- instance of the component that will be loaded with the values loaded from
the configuration file.GFileManipulatorException
- in case there is a problem reading the configuration file.public static void readConfig(String filename, String componentName, GComponent component, boolean saveValue, boolean... verifications) throws GFileManipulatorException
filename
- of the configuration file.componentName
- name of the component that shall be loaded from the configuration file.component
- instance of the component that will be loaded with the values loaded from
the configuration file.saveValue
- true if the saved values of the components being read from the file document
shall be updated, false otherwise.verifications
- if true prevents the type verification of the configuration fileGFileManipulatorException
- in case there is a problem reading the configuration file.public static void loadComponent(String filename, String componentName, GComponent component) throws GFileManipulatorException
filename
- of the configuration file.componentName
- name of the component that shall be loaded from the configuration file.component
- instance of the component that will be loaded with the values loaded from
the configuration file.GFileManipulatorException
- in case there is a problem reading the configuration file.public static void pasteComponent(GComponent component)
component
- instance of the component that will be pasted from clipboard.public static org.jdom.Document saveToDomDocument(String componentName, GComponent component, boolean saveValue) throws GFileManipulatorException
componentName
- name of the component that shall be stored in the configuration file.component
- instance of the component that will be stored with the values loaded from
the configuration file.saveValue
- true if the saved values of the components being saved to the dom document
shall be updated, false otherwise.GFileManipulatorException
- in case there is a problem writing the configuration file.public static void writeConfigFromElement(GComponent component, String filename, org.jdom.Element element) throws GFileManipulatorException
component
- used to change elementfilename
- of the configuration file.element
- Element from parent dom documentGFileManipulatorException
- is raised if there is a problem with the cration of the xml filepublic static void writeConfig(String filename, String componentName, GComponent component, boolean saveValue) throws GFileManipulatorException
filename
- of the configuration file.componentName
- name of the component that shall be stored in the configuration file.component
- instance of the component that will be stored with the values loaded from
the configuration file.saveValue
- true if the saved values of the components being written to file shall be
updated, false otherwise.GFileManipulatorException
- in case there is a problem writing the configuration file.public static org.jdom.Document createDomDocument(String filename) throws GFileManipulatorException
filename
- of the configuration file.GFileManipulatorException
- in case there is a problem writing the configuration file.public static List<GComponent> searchCompatibleComponents(GComponent component, GComponent componentToSearch, boolean useComponentName) throws GException
component
- to search objects in the configuration filecomponentToSearch
- in the main componentuseComponentName
- true if the name of the component is used to filter the research.GException
- in case there is a problem with element researchpublic static List<GComponent> searchCompatibleComponents(String filename, GComponent componentToSearch, boolean useComponentName) throws GException
filename
- of the configuration file.componentToSearch
- to compare with objects in the configuration fileuseComponentName
- true if the name of the component is used to filter the research.GException
- in case there is a problem with the configuration file or a missing constructorpublic static void saveComponent(String filename, String componentName, GComponent component) throws GFileManipulatorException
filename
- of the configuration file.componentName
- name of the component that shall be stored in the configuration file.component
- instance of the component that will be stored with the values loaded from
the configuration file.GFileManipulatorException
- in case there is a problem writing the configuration file.public static void copyComponent(GComponent component) throws GFileManipulatorException
component
- instance of the component whose values will be copied to clipboard.GFileManipulatorException
- in case there is a problem writing the configuration file
to clipboard.public static void exportComponent(GComponent component) throws GFileManipulatorException
component
- instance of the component whose values will be exported in the configuration
file.GFileManipulatorException
- in case there is a problem writing the configuration file.public static void importComponent(GComponent component)
component
- instance of the component that will be stored with the values imported from
the configuration file.@Deprecated public static org.jdom.Element findElement(org.jdom.Element sourceElement, String itemType, String attribute, String attributeValue, String defaultValue) throws GException
GItemTypeInterface
for more details.sourceElement
- from which the search starts.itemType
- of the searched element.attribute
- that shall be matched.attributeValue
- value to match the attribute.defaultValue
- default value in case that the element is not found.GException
- in case the element or the searched attribute do not exist.public static List<org.jdom.Element> findAllElements(org.jdom.Element sourceElement, String itemType, String componentName) throws GException
sourceElement
- from which the search starts.itemType
- of the searched element.componentName
- the name of the component used to filter the research.GException
- in case there is a problem with element researchpublic static org.jdom.Element findElement(org.jdom.Element sourceElement, GItemTypeInterface itemType, String attribute, String attributeValue, String defaultValue) throws GException
sourceElement
- from which the search starts.itemType
- of the searched element.attribute
- that shall be matched.attributeValue
- value to match the attribute.defaultValue
- default value in case that the element is not found.GException
- in case the element or the searched attribute do not exist.public static org.jdom.Element findElement(org.jdom.Element sourceElement, GItemTypeInterface itemType, String attribute, String attributeValue) throws GException
sourceElement
- from which the search starts.itemType
- of the searched element.attribute
- that shall be matched.attributeValue
- value to match the attribute.GException
- in case the element or the searched attribute do not exist.public static org.jdom.Element findFirstElement(org.jdom.Element sourceElement, String itemType, String elementName, String defaultValue) throws GException
sourceElement
- from which the search starts.itemType
- of the searched element.elementName
- value to match the element.defaultValue
- default value in case that the element is not found.GException
- in case the element or the searched attribute do not exist.public static String getClipboardString()
public static String getXmlItemType(GComponent component) throws GFileManipulatorException
component
- used to get back the xml typeGFileManipulatorException
- in case there is problem with the elements resarchCopyright © 2024. All rights reserved.