mirror of
https://github.com/Noratrieb/UMLetClassParser.git
synced 2026-01-14 08:35:07 +01:00
better gui and can now extend other class in the class name
This commit is contained in:
parent
6d76166b3c
commit
c970867916
4 changed files with 24 additions and 20 deletions
|
|
@ -15,7 +15,7 @@ public class UMLClass {
|
|||
String[] lines = classDiagram.split("\n");
|
||||
|
||||
String[] linesBeheaded = new String[lines.length-1];
|
||||
this.name = lines[0];
|
||||
this.name = lines[0].split(" ")[0];
|
||||
|
||||
System.arraycopy(lines, 1, linesBeheaded, 0, linesBeheaded.length);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="fc27a" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="fc27a" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<tabbedpane title="File Mode"/>
|
||||
|
|
@ -33,11 +33,6 @@
|
|||
<text value=" .uxf File Path:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<vspacer id="8c974">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="a9bfd" class="javax.swing.JTextField" binding="pathField">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
|
|
@ -48,7 +43,7 @@
|
|||
</component>
|
||||
<component id="fa74" class="javax.swing.JButton" binding="convertFileButton">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="convert"/>
|
||||
|
|
@ -59,6 +54,7 @@
|
|||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<labelFor value="96709"/>
|
||||
<text value="Package Destination Path"/>
|
||||
</properties>
|
||||
</component>
|
||||
|
|
@ -70,6 +66,11 @@
|
|||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<vspacer id="1a17d">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="425fa" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
|
|
|
|||
|
|
@ -9,8 +9,7 @@ public class UMLConverterMain {
|
|||
new UMLManager(view);
|
||||
frame.setContentPane(view.getPanel1());
|
||||
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
frame.pack();
|
||||
//frame.setExtendedState(Frame.MAXIMIZED_BOTH);
|
||||
frame.setSize(700, 500);
|
||||
frame.setVisible(true);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import java.util.ArrayList;
|
|||
public class XMLParser {
|
||||
|
||||
private Document doc;
|
||||
private boolean valid;
|
||||
|
||||
public XMLParser(String path) {
|
||||
try {
|
||||
|
|
@ -21,8 +22,8 @@ public class XMLParser {
|
|||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
doc = builder.parse(inputFile);
|
||||
} catch (ParserConfigurationException | SAXException | IOException e){
|
||||
e.printStackTrace();
|
||||
valid = true;
|
||||
} catch (ParserConfigurationException | SAXException | IOException ignored){
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -30,20 +31,23 @@ public class XMLParser {
|
|||
|
||||
ArrayList<String> classes = new ArrayList<>();
|
||||
|
||||
NodeList nList = doc.getDocumentElement().getElementsByTagName("element");
|
||||
if(valid) {
|
||||
|
||||
for (int i = 0; i < nList.getLength(); i++) {
|
||||
Node node = nList.item(i);
|
||||
NodeList nList = doc.getDocumentElement().getElementsByTagName("element");
|
||||
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE){
|
||||
for (int i = 0; i < nList.getLength(); i++) {
|
||||
Node node = nList.item(i);
|
||||
|
||||
Element element = (Element) node;
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
|
||||
if(element.getElementsByTagName("id").item(0).getTextContent().equals("UMLClass")){
|
||||
Element element = (Element) node;
|
||||
|
||||
String classBody = element.getElementsByTagName("panel_attributes").item(0).getTextContent();
|
||||
classes.add(classBody);
|
||||
if (element.getElementsByTagName("id").item(0).getTextContent().equals("UMLClass")) {
|
||||
|
||||
String classBody = element.getElementsByTagName("panel_attributes").item(0).getTextContent();
|
||||
classes.add(classBody);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue