Class ExportTool2
- java.lang.Object
-
- java.util.Observable
-
- com.nomagic.magicreport.engine.Tool
-
- com.nomagic.magicreport.engine.ConcurrentTool
-
- com.nomagic.magicdraw.magicreport.tools.ExportTool2
-
- All Implemented Interfaces:
com.nomagic.magicreport.engine.ITool
,com.nomagic.magicreport.IVariable
,java.io.Serializable
,java.lang.Cloneable
@OpenApiAll public class ExportTool2 extends com.nomagic.magicreport.engine.ConcurrentTool
This class allow report to export element in other file format including tree folder.- Since:
- Mar 14, 2012
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
ExportTool2.ConcurrentHashSet<T>
private static class
ExportTool2.ElementComparator<T>
private static class
ExportTool2.NameComparator<T>
private static class
ExportTool2.NodeComparator<T>
private static class
ExportTool2.SymbolElement
-
Field Summary
Fields Modifier and Type Field Description private com.nomagic.magicdraw.ui.ElementFilter
auxiliaryFilter
private java.lang.String
blankFieldValue
static java.lang.String
CONTEXT_NAME
Contains a context name.private int
currentPercentage
private java.io.File
defaultOutputDirectory
private javax.xml.parsers.DocumentBuilder
documentBuilder
private int
dummyULId
private java.util.Comparator<BaseElement>
elementComparator
private long
elementFileCount
private java.util.Collection<Element>
elementScope
private java.util.Set<java.lang.String>
elementsToBeExport
private java.util.Set<java.lang.String>
existingFilePaths
private static java.lang.String
EXPORT_ALL_ELEMENT
export all elements.private static java.lang.String
EXPORT_ALL_TREE_ELEMENT
private java.util.Map<java.lang.String,java.lang.Boolean>
exportConfig
private java.util.Set<Diagram>
exportedDiagramSet
private java.util.Set<java.lang.String>
exportedIconSet
private static java.lang.String
FILE_PROTOCOL
private long
fileExportedCount
private long
filesToBeExportedCount
private com.nomagic.magicdraw.ui.ElementFilter
filter
private java.text.DecimalFormat
formatter
private com.nomagic.magicreport.engine.ITemplateEngine
globalEngine
private java.util.Map<java.lang.String,java.lang.String>
hexadecimalMap
private com.nomagic.magicreport.format.HTMLFormatter
htmlFormatter
private int
imageScale
private boolean
isRecursive
private boolean
isShowAuxiliary
private boolean
isSkipExportAll
private static org.apache.logging.log4j.Logger
log
private java.util.Comparator<org.w3c.dom.Element>
nameComparator
private java.util.Comparator<org.w3c.dom.Element>
nodeComparator
private java.util.Collection<Package>
packageScope
private Project
project
private com.nomagic.uml2.ext.jmi.reflect.ModelReflection
reflection
private ReportHelper
reportHelper
private java.io.File
resourcesDir
private static long
serialVersionUID
private static java.lang.String
SKIP_EXPORT_ALL_SPEC_ELEMENT
private java.lang.Boolean
skipProgressbar
private SorterTool
sorter
private com.nomagic.magicdraw.magicreport.ObserverTask
task
private javax.xml.transform.Transformer
transformer
private java.lang.Boolean
useHexadecimalName
-
Constructor Summary
Constructors Constructor Description ExportTool2()
Create an export tool.ExportTool2(com.nomagic.magicreport.engine.ITemplateEngine engine, java.util.Observer observer)
Create an export tool with observer.ExportTool2(java.util.Observer observer)
Create an export tool with observer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
appendPropertyCollection(java.util.Collection<?> propertyCollection, org.w3c.dom.Document document, java.util.List<org.w3c.dom.Element> childList, org.w3c.dom.Element fieldElement, boolean exportResources)
private int
calculatePercentage(long current, long total)
private void
collectAnchorShapeBounds(javax.swing.text.View view, java.awt.Shape container, java.util.Set<ExportTool2.SymbolElement> shapeList, javax.swing.text.Element element, com.nomagic.magicdraw.uml.symbols.DiagramObjectViewContainer diagramContainer)
private java.util.Set<java.lang.String>
collectElementPropertiesNames(Element element, java.lang.String mode)
Creates and collects groups nodes user friendly names that appears in element's specification dialog tree at specific view mode (Standard/Expert/All)private void
collectElements()
private void
collectElements(Element exportingElement)
private void
collectOwnedElements(Element exportingElement, boolean isRecursive)
private boolean
collectOwner(Element exportingElement, java.util.Set<java.lang.String> parents, java.util.Set<Diagram> diagrams, java.util.Set<java.lang.String> notAccepts)
void
consume(com.nomagic.magicreport.engine.ConcurrentTool.ConsumeObject consumeObject)
Consume a object.private java.lang.String
convertModelLinkToFileURL(Element propertyValue)
protected org.w3c.dom.Element
createAndExportElement(org.w3c.dom.Document document, Element exportingElement, boolean exportResources, boolean exportLinkedFile, com.nomagic.magicdraw.ui.ElementFilter filter)
protected org.w3c.dom.Element
createAndExportElement(org.w3c.dom.Document document, Element exportingElement, boolean exportResources, boolean exportLinkedFile, com.nomagic.magicdraw.ui.ElementFilter filter, boolean isSmart)
protected org.w3c.dom.Element
createAndExportSmartElement(org.w3c.dom.Document document, Element exportingElement, boolean exportResources, boolean exportLinkedFile, com.nomagic.magicdraw.ui.ElementFilter filter)
private void
createAreaMapForDiagramPresentation(org.w3c.dom.Document document, com.nomagic.magicdraw.uml.symbols.DiagramObjectViewContainer diagramContainer, java.util.Collection<PresentationElement> presentationElements, org.w3c.dom.Element mapElement, double scale, java.io.FileWriter writer)
protected org.w3c.dom.Element
createAttributeAndExportElement(org.w3c.dom.Document document, Element exportingElement, boolean exportResources, boolean exportLinkedFile, boolean skipData)
Create attributes for XML element represents theexportingElement
and offer the element to be created into file.private java.lang.String
createDiagramTypeName(java.lang.String name)
Append 's' after diagram type name.private org.w3c.dom.Element
createElementAttributeData(org.w3c.dom.Document document, java.lang.String tagName, Element exportingElement, boolean exportResources)
private org.w3c.dom.Element
createElementAttributeData(org.w3c.dom.Document document, java.lang.String tagName, Element exportingElement, boolean exportResources, boolean skipData)
private com.nomagic.magicdraw.ui.ElementFilter
createElementFilter(Project project)
private org.w3c.dom.Element
createElementForTree(org.w3c.dom.Document document, Element exportingElement, boolean exportResources)
Create XML element for element which is used to create tree.private java.lang.String
createHexaID(java.lang.String elementID)
private java.io.File
createOutputByID(java.lang.String prefix, java.lang.String elementID, java.lang.String subfix, boolean forceRenew)
private java.io.File
createOutputFile(java.lang.String filename)
private java.io.File
createOutputFromDefault(java.lang.String filename, boolean forceRenew)
private java.lang.String
createReferneceDiagramType(java.lang.String name)
private java.io.File
createResourcesDir()
Create a resource directory.protected java.io.File
createResourcesDir(java.lang.String resourcesLocation)
Create a resource directory.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.private void
ensureParentDirExists(java.io.File parentFile)
java.lang.String
exportAll(boolean exportResources, boolean exportLinkedFile)
Export current opened project into file.protected java.lang.String
exportCustomImageHolder(BaseElement exportingElement)
Export the image for the element.private void
exportDiagram(Diagram diagram, Project project, org.w3c.dom.Document document, org.w3c.dom.Element xmlElement, java.lang.String[] mainData, boolean exportResources, java.util.List<org.w3c.dom.Element> nodeList, boolean exportLinkedFile)
Export area mapping of elements in the diagram.com.nomagic.magicreport.engine.ITool.Void
exportDiagramImage(DiagramPresentationElement diagramPresentation, boolean exportResources)
com.nomagic.magicreport.engine.ITool.Void
exportElement(java.io.File exportingFile, Element exportingElement, boolean exportResources)
Export element to XML file.com.nomagic.magicreport.engine.ITool.Void
exportElement(java.io.File exportingFile, Element exportingElement, boolean exportResources, boolean exportLinkedFile)
Export element to XML file.com.nomagic.magicreport.engine.ITool.Void
exportElement(java.io.File exportingFile, Element exportingElement, boolean exportResources, boolean exportLinkedFile, com.nomagic.magicdraw.ui.ElementFilter filter)
private void
exportElement(org.w3c.dom.Element parentElement, Element exportingElement, boolean exportResources, boolean exportLinkedFile, boolean skipData)
Export xml element for data.xmlprivate void
exportElementForDiagramTree()
private com.nomagic.magicreport.engine.ITool.Void
exportElementForDiagramTypeTree(java.util.Map<java.lang.String,java.util.List<Diagram>> diagramTypeMap)
private com.nomagic.magicreport.engine.ITool.Void
exportElementForRootDiagramTree(java.util.Map<java.lang.String,java.util.List<Diagram>> diagramTypeMap)
com.nomagic.magicreport.engine.ITool.Void
exportElementForTree(java.io.File exportingNodeFile, Element exportingElement, boolean exportResources)
Export element to XML file which is used for create tree.com.nomagic.magicreport.engine.ITool.Void
exportElementForTree(java.io.File exportingNodeFile, Element exportingElement, boolean exportResources, com.nomagic.magicdraw.ui.ElementFilter filter)
protected java.lang.String
exportIcon(BaseElement exportingElement)
Export the icon for element.private java.lang.String
exportIconForHTMLDocument(Project project, java.lang.String text)
For html, it may contain some attributes that refer to element icon.
Ex.private org.w3c.dom.Element
exportImageMap(org.w3c.dom.Document document, java.lang.String[] mainData, DiagramPresentationElement diagramPresentation, boolean exportLinkedFile)
private void
exportRootTreeAndProfile(org.w3c.dom.Element rootElement, org.w3c.dom.Document document, java.lang.String resourcesLocation, Package dataModel, Project project, boolean exportResources, boolean exportLinkedFile)
private Element
findRootOwner(Element element)
private java.lang.String
formatObject(java.lang.Object object)
private com.nomagic.magicdraw.ui.ElementFilter
getAuxiliaryResourceFilter()
private java.lang.String
getBlankField()
private java.util.Set<ExportTool2.SymbolElement>
getContentShapeAnchorBounds(com.nomagic.magicdraw.uml.symbols.shapes.TextObject textObject, com.nomagic.magicdraw.uml.symbols.DiagramObjectViewContainer diagramContainer)
Collect all anchor element from content shape.private java.lang.String
getElementPropertyString(Element exportingElement, java.lang.String propertyName)
private java.util.Collection<Element>
getElementScope()
protected java.lang.String
getElementType(Element element)
Return String representing element type.private boolean
getExportConfig(java.lang.String config)
private int
getExportImageSize()
private java.lang.String
getFormattedNumber(long num)
private com.nomagic.magicreport.format.HTMLFormatter
getHTMLFormatter()
static java.lang.String
getHumanName(java.lang.String propertyName, java.util.Map<java.lang.String,java.lang.String> nameMap)
private java.lang.String
getModeString(java.util.Set<java.lang.String>[] propertiesModes, java.lang.String propertyName)
private java.util.Collection<Package>
getPackageScope()
java.lang.String
getPropertyHumanName(java.lang.String propertyName, java.util.Map<java.lang.String,java.lang.String> nameMap)
Get property human name of given property name.protected java.lang.String
getResourcesLocation()
Return location of resources directory.protected void
handleIOException(java.lang.Exception e)
private boolean
hasActiveHyperlink(Element exportingElement)
private boolean
hasChildElement(Element exportingElement)
private void
increaseProgressBar(Element exportingElement, java.lang.String id, java.lang.String text)
private void
initialScopeAndVariable()
private void
initialScopeAndVariable(boolean alwaysInit)
protected boolean
isCancel()
private boolean
isCreateSpecificationIcon(Element exportingElement)
private static boolean
isExportableElement(Element element)
Fixed https://jira.nomagic.com/browse/MGRP-3170s 1) Applied Stereotype Instances and Slots that are tagged values should not be exported, since they are not part of actual model 2) Documentation comments should not be exported in a separate file - it is enough to print info in its owner 3) Should not export not user-created ValueSpecifications, like ones that are created when setting multiplicity property valueprivate boolean
isExportableSpecElement(Element element)
Check element that can be created as xml file for specification panelprivate boolean
isExportableTreeElement(Element element)
Check element that can be created as xml file for containment treeprivate boolean
isHiddenElement(Element exportingElement, com.nomagic.magicdraw.ui.ElementFilter filter)
private boolean
isNotAcceptAuxiliary(BaseElement testPackage)
private boolean
isSkipExportAll()
private void
offerElementToConsumeObject(Element exportingElement, boolean exportResources, boolean exportLinkedFile)
Export element to XML file.private void
setModeString(org.w3c.dom.Element xmlElement, java.util.Set<java.lang.String>[] propertiesModes, java.lang.String propertyName)
void
setRecursive(boolean isRecursive)
void
setShowAuxiliary(boolean isShowAuxiliary)
private void
write(org.w3c.dom.Node node, java.lang.StringBuilder builder)
-
Methods inherited from class com.nomagic.magicreport.engine.ConcurrentTool
isNoSpaceException, isRunning, offer
-
Methods inherited from class com.nomagic.magicreport.engine.Tool
clone, getContext, getProperties, getProperty, getProperty, notifyObservers, setContext, setProperties
-
-
-
-
Field Detail
-
CONTEXT_NAME
public static final java.lang.String CONTEXT_NAME
Contains a context name.- See Also:
- Constant Field Values
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
log
private static final org.apache.logging.log4j.Logger log
-
EXPORT_ALL_ELEMENT
private static final java.lang.String EXPORT_ALL_ELEMENT
export all elements. true to export all xml file for containment tree and specification panel.- See Also:
- Constant Field Values
-
EXPORT_ALL_TREE_ELEMENT
private static final java.lang.String EXPORT_ALL_TREE_ELEMENT
- See Also:
- Constant Field Values
-
SKIP_EXPORT_ALL_SPEC_ELEMENT
private static final java.lang.String SKIP_EXPORT_ALL_SPEC_ELEMENT
- See Also:
- Constant Field Values
-
FILE_PROTOCOL
private static final java.lang.String FILE_PROTOCOL
- See Also:
- Constant Field Values
-
formatter
private final java.text.DecimalFormat formatter
-
resourcesDir
private java.io.File resourcesDir
-
dummyULId
private int dummyULId
-
imageScale
private int imageScale
-
project
private Project project
-
reflection
private com.nomagic.uml2.ext.jmi.reflect.ModelReflection reflection
-
exportConfig
private java.util.Map<java.lang.String,java.lang.Boolean> exportConfig
-
elementsToBeExport
private final java.util.Set<java.lang.String> elementsToBeExport
-
exportedDiagramSet
private final java.util.Set<Diagram> exportedDiagramSet
-
exportedIconSet
private final java.util.Set<java.lang.String> exportedIconSet
-
existingFilePaths
private final java.util.Set<java.lang.String> existingFilePaths
-
fileExportedCount
private long fileExportedCount
-
filesToBeExportedCount
private long filesToBeExportedCount
-
currentPercentage
private int currentPercentage
-
skipProgressbar
private java.lang.Boolean skipProgressbar
-
elementFileCount
private long elementFileCount
-
useHexadecimalName
private java.lang.Boolean useHexadecimalName
-
hexadecimalMap
private final java.util.Map<java.lang.String,java.lang.String> hexadecimalMap
-
packageScope
private java.util.Collection<Package> packageScope
-
elementScope
private java.util.Collection<Element> elementScope
-
auxiliaryFilter
private com.nomagic.magicdraw.ui.ElementFilter auxiliaryFilter
-
filter
private com.nomagic.magicdraw.ui.ElementFilter filter
-
isShowAuxiliary
private boolean isShowAuxiliary
-
globalEngine
private com.nomagic.magicreport.engine.ITemplateEngine globalEngine
-
reportHelper
private ReportHelper reportHelper
-
htmlFormatter
private com.nomagic.magicreport.format.HTMLFormatter htmlFormatter
-
sorter
private final SorterTool sorter
-
blankFieldValue
private java.lang.String blankFieldValue
-
defaultOutputDirectory
private java.io.File defaultOutputDirectory
-
isRecursive
private boolean isRecursive
-
isSkipExportAll
private boolean isSkipExportAll
-
documentBuilder
private javax.xml.parsers.DocumentBuilder documentBuilder
-
transformer
private javax.xml.transform.Transformer transformer
-
task
private com.nomagic.magicdraw.magicreport.ObserverTask task
-
nodeComparator
private final java.util.Comparator<org.w3c.dom.Element> nodeComparator
-
elementComparator
private final java.util.Comparator<BaseElement> elementComparator
-
nameComparator
private final java.util.Comparator<org.w3c.dom.Element> nameComparator
-
-
Constructor Detail
-
ExportTool2
public ExportTool2()
Create an export tool.
-
ExportTool2
public ExportTool2(java.util.Observer observer)
Create an export tool with observer.- Parameters:
observer
- Observer
-
ExportTool2
public ExportTool2(com.nomagic.magicreport.engine.ITemplateEngine engine, java.util.Observer observer)
Create an export tool with observer.- Parameters:
engine
- engineobserver
- Observer
-
-
Method Detail
-
setRecursive
public void setRecursive(boolean isRecursive)
-
setShowAuxiliary
public void setShowAuxiliary(boolean isShowAuxiliary)
-
consume
public void consume(com.nomagic.magicreport.engine.ConcurrentTool.ConsumeObject consumeObject)
Consume a object.- Specified by:
consume
in classcom.nomagic.magicreport.engine.ConcurrentTool
- Parameters:
consumeObject
- consume object.- See Also:
ConcurrentTool.consume(ConsumeObject)
-
increaseProgressBar
private void increaseProgressBar(Element exportingElement, java.lang.String id, java.lang.String text)
-
getFormattedNumber
private java.lang.String getFormattedNumber(long num)
-
calculatePercentage
private int calculatePercentage(long current, long total)
-
getBlankField
private java.lang.String getBlankField()
-
formatObject
private java.lang.String formatObject(@CheckForNull java.lang.Object object)
-
getPackageScope
private java.util.Collection<Package> getPackageScope()
-
getElementScope
private java.util.Collection<Element> getElementScope()
-
getAuxiliaryResourceFilter
private com.nomagic.magicdraw.ui.ElementFilter getAuxiliaryResourceFilter()
-
getExportImageSize
private int getExportImageSize()
-
isSkipExportAll
private boolean isSkipExportAll()
-
isNotAcceptAuxiliary
private boolean isNotAcceptAuxiliary(BaseElement testPackage)
-
collectElementPropertiesNames
private java.util.Set<java.lang.String> collectElementPropertiesNames(Element element, java.lang.String mode)
Creates and collects groups nodes user friendly names that appears in element's specification dialog tree at specific view mode (Standard/Expert/All)- Parameters:
element
- elementmode
- view mode from PropertiesModeHelper.MODES- Returns:
- Collection of String group nodes names
- See Also:
PropertiesMode
-
appendPropertyCollection
private void appendPropertyCollection(java.util.Collection<?> propertyCollection, org.w3c.dom.Document document, java.util.List<org.w3c.dom.Element> childList, org.w3c.dom.Element fieldElement, boolean exportResources) throws java.io.IOException
- Throws:
java.io.IOException
-
getModeString
private java.lang.String getModeString(java.util.Set<java.lang.String>[] propertiesModes, java.lang.String propertyName)
-
setModeString
private void setModeString(org.w3c.dom.Element xmlElement, java.util.Set<java.lang.String>[] propertiesModes, java.lang.String propertyName)
-
exportElement
public com.nomagic.magicreport.engine.ITool.Void exportElement(java.io.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
public com.nomagic.magicreport.engine.ITool.Void exportElement(java.io.File exportingFile, Element exportingElement, boolean exportResources, boolean exportLinkedFile, @CheckForNull com.nomagic.magicdraw.ui.ElementFilter filter)
-
exportElement
public com.nomagic.magicreport.engine.ITool.Void exportElement(java.io.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
-
exportImageMap
private org.w3c.dom.Element exportImageMap(org.w3c.dom.Document document, java.lang.String[] mainData, DiagramPresentationElement diagramPresentation, boolean exportLinkedFile)
-
createAreaMapForDiagramPresentation
private void createAreaMapForDiagramPresentation(org.w3c.dom.Document document, com.nomagic.magicdraw.uml.symbols.DiagramObjectViewContainer diagramContainer, java.util.Collection<PresentationElement> presentationElements, org.w3c.dom.Element mapElement, double scale, java.io.FileWriter writer) throws java.io.IOException
- Throws:
java.io.IOException
-
ensureParentDirExists
private void ensureParentDirExists(java.io.File parentFile)
-
convertModelLinkToFileURL
@CheckForNull private java.lang.String convertModelLinkToFileURL(Element propertyValue) throws java.io.IOException
- Throws:
java.io.IOException
-
exportDiagram
private void exportDiagram(Diagram diagram, Project project, org.w3c.dom.Document document, org.w3c.dom.Element xmlElement, java.lang.String[] mainData, boolean exportResources, java.util.List<org.w3c.dom.Element> nodeList, boolean exportLinkedFile)
Export area mapping of elements in the diagram.
-
exportDiagramImage
public com.nomagic.magicreport.engine.ITool.Void exportDiagramImage(DiagramPresentationElement diagramPresentation, boolean exportResources)
-
getHTMLFormatter
private com.nomagic.magicreport.format.HTMLFormatter getHTMLFormatter()
-
exportElementForTree
public com.nomagic.magicreport.engine.ITool.Void exportElementForTree(java.io.File exportingNodeFile, Element exportingElement, boolean exportResources, com.nomagic.magicdraw.ui.ElementFilter filter)
-
exportElementForTree
public com.nomagic.magicreport.engine.ITool.Void exportElementForTree(java.io.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
-
write
private void write(org.w3c.dom.Node node, java.lang.StringBuilder builder)
-
createElementForTree
private org.w3c.dom.Element createElementForTree(org.w3c.dom.Document document, Element exportingElement, boolean exportResources) throws java.io.IOException
Create XML element for element which is used to create tree.- Throws:
java.io.IOException
-
getElementPropertyString
@CheckForNull private java.lang.String getElementPropertyString(Element exportingElement, java.lang.String propertyName)
-
hasActiveHyperlink
private boolean hasActiveHyperlink(Element exportingElement)
-
isCreateSpecificationIcon
private boolean isCreateSpecificationIcon(Element exportingElement)
-
isHiddenElement
private boolean isHiddenElement(Element exportingElement, com.nomagic.magicdraw.ui.ElementFilter filter)
-
hasChildElement
private boolean hasChildElement(Element exportingElement)
-
getResourcesLocation
protected java.lang.String getResourcesLocation()
Return location of resources directory.- Returns:
- a path to resources directory.
-
createResourcesDir
protected java.io.File createResourcesDir(java.lang.String resourcesLocation) throws java.io.IOException
Create a resource directory.- Parameters:
resourcesLocation
- resources location- Returns:
- a File pointed to resources directory
- Throws:
java.io.IOException
- if IO error occurs.
-
createResourcesDir
private java.io.File createResourcesDir() throws java.io.IOException
Create a resource directory.- Returns:
- a File pointed to resources directory
- Throws:
java.io.IOException
- if IO error occurs.
-
exportIcon
protected java.lang.String exportIcon(BaseElement exportingElement) throws java.io.IOException
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:
java.io.IOException
- if IO error occurs
-
exportCustomImageHolder
protected java.lang.String exportCustomImageHolder(BaseElement exportingElement) throws java.io.IOException
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:
java.io.IOException
- if IO error occurs
-
offerElementToConsumeObject
private void offerElementToConsumeObject(Element exportingElement, boolean exportResources, boolean exportLinkedFile)
Export element to XML file. Use element id as file name.- Parameters:
exportingElement
- exporting element
-
createElementAttributeData
private org.w3c.dom.Element createElementAttributeData(org.w3c.dom.Document document, java.lang.String tagName, Element exportingElement, boolean exportResources) throws java.io.IOException
- Throws:
java.io.IOException
-
createElementAttributeData
private org.w3c.dom.Element createElementAttributeData(org.w3c.dom.Document document, java.lang.String tagName, Element exportingElement, boolean exportResources, boolean skipData) throws java.io.IOException
- Throws:
java.io.IOException
-
createAndExportElement
protected org.w3c.dom.Element createAndExportElement(org.w3c.dom.Document document, Element exportingElement, boolean exportResources, boolean exportLinkedFile, @CheckForNull com.nomagic.magicdraw.ui.ElementFilter filter) throws java.io.IOException
- Throws:
java.io.IOException
-
createAndExportSmartElement
protected org.w3c.dom.Element createAndExportSmartElement(org.w3c.dom.Document document, Element exportingElement, boolean exportResources, boolean exportLinkedFile, @CheckForNull com.nomagic.magicdraw.ui.ElementFilter filter) throws java.io.IOException
- Throws:
java.io.IOException
-
createAndExportElement
protected org.w3c.dom.Element createAndExportElement(org.w3c.dom.Document document, Element exportingElement, boolean exportResources, boolean exportLinkedFile, @CheckForNull com.nomagic.magicdraw.ui.ElementFilter filter, boolean isSmart) throws java.io.IOException
- Throws:
java.io.IOException
-
createAttributeAndExportElement
protected org.w3c.dom.Element createAttributeAndExportElement(org.w3c.dom.Document document, Element exportingElement, boolean exportResources, boolean exportLinkedFile, boolean skipData) throws java.io.IOException
Create attributes for XML element represents theexportingElement
and offer the element to be created into file. Returnnull
to 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.- Returns:
- XML element for creating containment tree.
- Throws:
java.io.IOException
- when IO error occurred.
-
getElementType
protected java.lang.String getElementType(Element element)
Return String representing element type.- Parameters:
element
- element- Returns:
- a String representing element type.
-
exportElement
private void exportElement(org.w3c.dom.Element parentElement, Element exportingElement, boolean exportResources, boolean exportLinkedFile, boolean skipData) throws java.io.IOException
Export xml element for data.xml- Parameters:
parentElement
- dom parentexportingElement
- element to be exportedexportResources
- true to export sources (icon, image)exportLinkedFile
- true to export link fileskipData
- true to create only main data- Throws:
java.io.IOException
-
createOutputByID
private java.io.File createOutputByID(java.lang.String prefix, java.lang.String elementID, java.lang.String subfix, boolean forceRenew)
-
createHexaID
private java.lang.String createHexaID(java.lang.String elementID)
-
createOutputFromDefault
private java.io.File createOutputFromDefault(java.lang.String filename, boolean forceRenew)
-
createOutputFile
private java.io.File createOutputFile(java.lang.String filename)
-
initialScopeAndVariable
private void initialScopeAndVariable()
-
initialScopeAndVariable
private void initialScopeAndVariable(boolean alwaysInit)
-
collectElements
private void collectElements()
-
collectOwner
private boolean collectOwner(Element exportingElement, java.util.Set<java.lang.String> parents, java.util.Set<Diagram> diagrams, java.util.Set<java.lang.String> notAccepts)
-
collectElements
private void collectElements(Element exportingElement)
-
collectOwnedElements
private void collectOwnedElements(Element exportingElement, boolean isRecursive)
-
exportAll
public java.lang.String exportAll(boolean exportResources, boolean exportLinkedFile)
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
-
exportRootTreeAndProfile
private void exportRootTreeAndProfile(org.w3c.dom.Element rootElement, org.w3c.dom.Document document, java.lang.String resourcesLocation, Package dataModel, Project project, boolean exportResources, boolean exportLinkedFile)
-
createElementFilter
private com.nomagic.magicdraw.ui.ElementFilter createElementFilter(Project project)
-
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:
destroy
in classcom.nomagic.magicreport.engine.ConcurrentTool
- See Also:
ConcurrentTool.destroy()
-
collectAnchorShapeBounds
private void collectAnchorShapeBounds(javax.swing.text.View view, java.awt.Shape container, java.util.Set<ExportTool2.SymbolElement> shapeList, javax.swing.text.Element element, com.nomagic.magicdraw.uml.symbols.DiagramObjectViewContainer diagramContainer)
-
getContentShapeAnchorBounds
private java.util.Set<ExportTool2.SymbolElement> getContentShapeAnchorBounds(com.nomagic.magicdraw.uml.symbols.shapes.TextObject textObject, com.nomagic.magicdraw.uml.symbols.DiagramObjectViewContainer diagramContainer)
Collect all anchor element from content shape.- Returns:
- a list containing anchor shape
-
getPropertyHumanName
public java.lang.String getPropertyHumanName(java.lang.String propertyName, java.util.Map<java.lang.String,java.lang.String> nameMap)
Get property human name of given property name. IfnameMap
is used, human name will be resolved bynameMap
then resource string.- Parameters:
propertyName
- a property namenameMap
- optional provides new name map fromDSLManager.getPropertyNameMap(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element)
to resolve property name from <<metaType>>- Returns:
- human name
-
getHumanName
public static java.lang.String getHumanName(java.lang.String propertyName, java.util.Map<java.lang.String,java.lang.String> nameMap)
-
exportElementForDiagramTree
private void exportElementForDiagramTree()
-
createReferneceDiagramType
private java.lang.String createReferneceDiagramType(java.lang.String name)
-
createDiagramTypeName
private java.lang.String createDiagramTypeName(java.lang.String name)
Append 's' after diagram type name.
-
exportElementForRootDiagramTree
private com.nomagic.magicreport.engine.ITool.Void exportElementForRootDiagramTree(java.util.Map<java.lang.String,java.util.List<Diagram>> diagramTypeMap)
-
exportElementForDiagramTypeTree
private com.nomagic.magicreport.engine.ITool.Void exportElementForDiagramTypeTree(java.util.Map<java.lang.String,java.util.List<Diagram>> diagramTypeMap)
-
getExportConfig
private boolean getExportConfig(java.lang.String config)
-
isExportableTreeElement
private boolean isExportableTreeElement(Element element)
Check element that can be created as xml file for containment tree- Parameters:
element
- specific element- Returns:
- true if it can be created as xml file; otherwise, false.
-
isExportableSpecElement
private boolean isExportableSpecElement(Element element)
Check element that can be created as xml file for specification panel- Parameters:
element
- specific element- Returns:
- true if it can be created as xml file; otherwise, false.
-
isExportableElement
private static boolean isExportableElement(Element element)
Fixed https://jira.nomagic.com/browse/MGRP-3170s 1) Applied Stereotype Instances and Slots that are tagged values should not be exported, since they are not part of actual model 2) Documentation comments should not be exported in a separate file - it is enough to print info in its owner 3) Should not export not user-created ValueSpecifications, like ones that are created when setting multiplicity property value
-
exportIconForHTMLDocument
private java.lang.String exportIconForHTMLDocument(Project project, java.lang.String text)
For html, it may contain some attributes that refer to element icon.
Ex. This icon should be exported and the value of "src" attribute should be changed to the url of exported icon.- Parameters:
project
- current projecttext
- html text- Returns:
- updated text
-
isCancel
protected boolean isCancel()
-
handleIOException
protected void handleIOException(java.lang.Exception e)
-
-