Class ExportTool3
java.lang.Object
java.util.Observable
com.nomagic.magicreport.engine.Tool
com.nomagic.magicreport.engine.ConcurrentTool
com.nomagic.magicdraw.magicreport.tools.ExportTool3
- All Implemented Interfaces:
com.nomagic.magicreport.engine.ITool,com.nomagic.magicreport.IVariable,Serializable,Cloneable
@OpenApiAll
public class ExportTool3
extends com.nomagic.magicreport.engine.ConcurrentTool
This class allow report to export element in other file format including tree folder.
This class use XMLStreamWriter2 instead of DOM.
- Since:
- Aut 31, 2021
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.nomagic.magicreport.engine.ConcurrentTool
com.nomagic.magicreport.engine.ConcurrentTool.ConsumeObjectNested classes/interfaces inherited from interface com.nomagic.magicreport.engine.ITool
com.nomagic.magicreport.engine.ITool.HTMLString, com.nomagic.magicreport.engine.ITool.RetainedString, com.nomagic.magicreport.engine.ITool.Void -
Field Summary
FieldsFields inherited from class com.nomagic.magicreport.engine.Tool
context, propertiesFields inherited from interface com.nomagic.magicreport.engine.ITool
VOID -
Constructor Summary
ConstructorsConstructorDescriptionCreate an export tool.ExportTool3(com.nomagic.magicreport.engine.ITemplateEngine engine, Observer observer) Create an export tool with observer.ExportTool3(Observer observer) Create an export tool with observer. -
Method Summary
Modifier and TypeMethodDescriptionvoidconsume(com.nomagic.magicreport.engine.ConcurrentTool.ConsumeObject consumeObject) Consume a object.protected voidcreateAndExportElement(org.codehaus.stax2.XMLStreamWriter2 document, Element exportingElement, boolean exportResources, boolean exportLinkedFile, com.nomagic.magicdraw.ui.ElementFilter filter) protected voidcreateAndExportElement(org.codehaus.stax2.XMLStreamWriter2 document, Element exportingElement, boolean exportResources, boolean exportLinkedFile, com.nomagic.magicdraw.ui.ElementFilter filter, boolean isSmart) protected voidcreateAndExportSmartElement(org.codehaus.stax2.XMLStreamWriter2 document, Element exportingElement, boolean exportResources, boolean exportLinkedFile, com.nomagic.magicdraw.ui.ElementFilter filter) protected voidcreateAttributeAndExportElement(org.codehaus.stax2.XMLStreamWriter2 document, Element exportingElement, boolean exportResources, boolean exportLinkedFile, boolean skipData) Create attributes for XML element represents theexportingElementand offer the element to be created into file.protected FilecreateResourcesDir(String resourcesLocation) Create a resource directory.protected StringcreateTagName(String tagName) voiddestroy()Called by the engine to inform this tool is no longer use and that it should destroy any resources that it has allocated.exportAll(boolean exportResources, boolean exportLinkedFile) Export current opened project into file.protected StringexportCustomImageHolder(BaseElement exportingElement) Export the image for the element.com.nomagic.magicreport.engine.ITool.VoidexportDiagramImage(DiagramPresentationElement diagramPresentation, boolean exportResources) exportDiagramImageWithResult(DiagramPresentationElement diagramPresentation, boolean exportResources) com.nomagic.magicreport.engine.ITool.VoidexportElement(File exportingFile, Element exportingElement, boolean exportResources) Export element to XML file.com.nomagic.magicreport.engine.ITool.VoidexportElement(File exportingFile, Element exportingElement, boolean exportResources, boolean exportLinkedFile) Export element to XML file.com.nomagic.magicreport.engine.ITool.VoidexportElement(File exportingFile, Element exportingElement, boolean exportResources, boolean exportLinkedFile, ImageExportResult result) Export element to XML file.com.nomagic.magicreport.engine.ITool.VoidexportElement(File exportingFile, Element exportingElement, boolean exportResources, boolean exportLinkedFile, com.nomagic.magicdraw.ui.ElementFilter filter) com.nomagic.magicreport.engine.ITool.VoidexportElementForTree(File exportingNodeFile, Element exportingElement, boolean exportResources) Export element to XML file which is used for create tree.com.nomagic.magicreport.engine.ITool.VoidexportElementForTree(File exportingNodeFile, Element exportingElement, boolean exportResources, com.nomagic.magicdraw.ui.ElementFilter filter) protected StringexportIcon(BaseElement exportingElement) Export the icon for element.exportIcon(String type) protected StringgetElementType(Element element) Return String representing element type.protected StringgetElementTypeForTagName(Element element) static StringgetHumanName(String propertyName, Map<String, String> nameMap) getPropertyHumanName(String propertyName, Map<String, String> nameMap) Get property human name of given property name.protected StringReturn location of resources directory.protected voidprotected booleanisCancel()voidsetRecursive(boolean isRecursive) voidsetReportBean(com.nomagic.magicdraw.magicreport.ui.bean.ReportBean reportBean) voidsetShowAuxiliary(boolean isShowAuxiliary) Methods inherited from class com.nomagic.magicreport.engine.ConcurrentTool
getCustomPoolSize, isNoSpaceException, isRunning, offerMethods inherited from class com.nomagic.magicreport.engine.Tool
clone, getContext, getProperties, getProperty, getProperty, notifyObservers, setContext, setPropertiesMethods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, setChangedMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.nomagic.magicreport.engine.ITool
clearTool
-
Field Details
-
CONTEXT_NAME
Contains a context name.- See Also:
-
-
Constructor Details
-
ExportTool3
public ExportTool3()Create an export tool. -
ExportTool3
Create an export tool with observer.- Parameters:
observer- Observer
-
ExportTool3
Create an export tool with observer.- Parameters:
engine- engineobserver- Observer
-
-
Method Details
-
setRecursive
public void setRecursive(boolean isRecursive) -
setReportBean
public void setReportBean(com.nomagic.magicdraw.magicreport.ui.bean.ReportBean reportBean) -
setShowAuxiliary
public void setShowAuxiliary(boolean isShowAuxiliary) -
consume
public void consume(com.nomagic.magicreport.engine.ConcurrentTool.ConsumeObject consumeObject) Consume a object.- Specified by:
consumein classcom.nomagic.magicreport.engine.ConcurrentTool- Parameters:
consumeObject- consume object.- See Also:
-
ConcurrentTool.consume(ConsumeObject)
-
exportElement
public com.nomagic.magicreport.engine.ITool.Void exportElement(File exportingFile, Element exportingElement, boolean exportResources) Export element to XML file.- Parameters:
exportingFile- exporting fileexportingElement- exporting elementexportResources- true if you want to export resources of this element- Returns:
- nothing
-
exportElement
-
exportElement
public com.nomagic.magicreport.engine.ITool.Void exportElement(File exportingFile, Element exportingElement, boolean exportResources, boolean exportLinkedFile) Export element to XML file.- Parameters:
exportingFile- exporting fileexportingElement- exporting elementexportResources- true if you want to export resources of this elementexportLinkedFile- true if you want to include linked files.- Returns:
- nothing
-
exportElement
public com.nomagic.magicreport.engine.ITool.Void exportElement(File exportingFile, Element exportingElement, boolean exportResources, boolean exportLinkedFile, ImageExportResult result) Export element to XML file.- Parameters:
exportingFile- exporting fileexportingElement- exporting elementexportResources- true if you want to export resources of this elementexportLinkedFile- true if you want to include linked files.result- result of exporting digram- Returns:
- nothing
-
exportDiagramImage
public com.nomagic.magicreport.engine.ITool.Void exportDiagramImage(DiagramPresentationElement diagramPresentation, boolean exportResources) -
exportDiagramImageWithResult
public ImageExportResult exportDiagramImageWithResult(DiagramPresentationElement diagramPresentation, boolean exportResources) -
exportElementForTree
-
exportElementForTree
public com.nomagic.magicreport.engine.ITool.Void exportElementForTree(File exportingNodeFile, Element exportingElement, boolean exportResources) Export element to XML file which is used for create tree.- Parameters:
exportingNodeFile- exporting fileexportingElement- export elementexportResources- true if you want to export resources of this element- Returns:
- nothing
-
getResourcesLocation
Return location of resources directory.- Returns:
- a path to resources directory.
-
createResourcesDir
Create a resource directory.- Parameters:
resourcesLocation- resources location- Returns:
- a File pointed to resources directory
- Throws:
IOException- if IO error occurs.
-
exportIcon
- Throws:
IOException
-
exportIcon
Export the icon for element. This method should not perform graphic renderer by itself. The icon exporting process should be enqueue by methodoffer(ConsumeObject).- Parameters:
exportingElement- target element- Returns:
- path to icon
- Throws:
IOException- if IO error occurs
-
exportCustomImageHolder
Export the image for the element. Image for the element will be exported from strereotype CustomImageHolder.- Parameters:
exportingElement- target element- Returns:
- path to icon
- Throws:
IOException- if IO error occurs
-
createAndExportElement
protected void createAndExportElement(org.codehaus.stax2.XMLStreamWriter2 document, Element exportingElement, boolean exportResources, boolean exportLinkedFile, @CheckForNull com.nomagic.magicdraw.ui.ElementFilter filter) throws IOException, XMLStreamException - Throws:
IOExceptionXMLStreamException
-
createAndExportSmartElement
protected void createAndExportSmartElement(org.codehaus.stax2.XMLStreamWriter2 document, Element exportingElement, boolean exportResources, boolean exportLinkedFile, @CheckForNull com.nomagic.magicdraw.ui.ElementFilter filter) throws IOException, XMLStreamException - Throws:
IOExceptionXMLStreamException
-
createAndExportElement
protected void createAndExportElement(org.codehaus.stax2.XMLStreamWriter2 document, Element exportingElement, boolean exportResources, boolean exportLinkedFile, @CheckForNull com.nomagic.magicdraw.ui.ElementFilter filter, boolean isSmart) throws IOException, XMLStreamException - Throws:
IOExceptionXMLStreamException
-
createAttributeAndExportElement
protected void createAttributeAndExportElement(org.codehaus.stax2.XMLStreamWriter2 document, Element exportingElement, boolean exportResources, boolean exportLinkedFile, boolean skipData) throws IOException, XMLStreamException Create attributes for XML element represents theexportingElementand offer the element to be created into file. Returnnullto cancel this element exporting.- Parameters:
document- XML documentexportingElement- exporting elementexportResources- true if you want to export resources of this elementexportLinkedFile- true if you want to include linked files.skipData- true to create only main attribute to xml document.- Throws:
IOException- when IO error occurred.XMLStreamException
-
getElementType
Return String representing element type.- Parameters:
element- element- Returns:
- a String representing element type.
-
getElementTypeForTagName
-
createTagName
-
exportAll
Export current opened project into file.- Parameters:
exportResources- true if you want to export resources.exportLinkedFile- true if you want to include linked files.- Returns:
- nothing
-
destroy
public void destroy()Called by the engine to inform this tool is no longer use and that it should destroy any resources that it has allocated.- Overrides:
destroyin classcom.nomagic.magicreport.engine.ConcurrentTool- See Also:
-
ConcurrentTool.destroy()
-
getPropertyHumanName
Get property human name of given property name. IfnameMapis used, human name will be resolved bynameMapthen resource string.- Parameters:
propertyName- a property namenameMap- optional provides new name map fromDSL.getPropertyNameMap(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element)to resolve property name from <<metaType>>- Returns:
- human name
-
getHumanName
-
isCancel
protected boolean isCancel() -
handleIOException
-