hallo zusammen, Ich habe eine Problem beim unmarschall und zwar :-
wenn ich diese Code ausführen ohne newTab(1);
dann läuft ohne Problem.aber mit newTab(1) dann kommt die Fehler meldung.
ich weiss nicht, was ich falsch machte.
danke im Voraus
aber wenn ich mit die newTab(1) aus führen dann kommt diese Fehler meldung:-
Die Fehler meldung :-
openProject() :-
unmarschall() :-
hier ist Die newTab():-
wenn ich diese Code ausführen ohne newTab(1);
dann läuft ohne Problem.aber mit newTab(1) dann kommt die Fehler meldung.
ich weiss nicht, was ich falsch machte.
danke im Voraus
Code:
if(!this.getProject().getGraph().isEmpty()){
System.out.println("Graph Liste ist voll ...");
for (Graph graphNode : projectNode.getGraphList()) {
System.out.println("Graph ID :" +graphNode.getId());
this.setGraph(graphNode);
((WorkspacePane) this.getTabbedPane().getComponentAt(
this.getTabbedPane().getTabCount() - 1))
.getMvGraph().setGraph(graphNode, "open");
}
}else {
System.out.println("Graph Liste ist leer ...");
}
aber wenn ich mit die newTab(1) aus führen dann kommt diese Fehler meldung:-
Die Fehler meldung :-
Exception in thread "AWT-EventQueue-0" java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
at java.util.AbstractList$Itr.next(Unknown Source)
at de.diplom.view.MainFrame.unmarschall(MainFrame.java:806)
at de.diplom.view.MainFrame.openProject(MainFrame.java:767)
at de.diplom.controller.Button_Menu_WorkspaceController.actionPerformed(Button_Menu_WorkspaceController.java:148)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
openProject() :-
Code:
public void openProject() {
this.fileChooser.setFileHidingEnabled(true);
this.fileChooser.addChoosableFileFilter(this.fileFilter);
if (!this.nothingToSave()) {
return;
}
if (JFileChooser.APPROVE_OPTION == fileChooser.showOpenDialog(this)) {
this.projectName = this.fileChooser.getSelectedFile().getPath();
try {
// Knoten aus Datei einlesen
File file = new File(this.projectName);
this.setFrameTitle(file.getName().replaceFirst(".xml", ""));
if (new MyFileFilter().accept(file) == true) {
FileReader in = new FileReader(file);
unmarschall(in);
this.setProjectChanged(false);
this.getMenuFrame().getSaveProjectItem().setEnabled(false);
this.getMenuFrame().getSaveProjectAsItem()
.setEnabled(false);
this.getSymbolButton().getSave().setEnabled(false);
statusleiste.setText(this.getProjectName()
+ " wurde geöffnet.");
// System.out.println("ProjectName sffdsafadsf :" +this.projectName);
this.confirmFrameTitle();
}
} catch (IOException e) {
statusleiste.setText("Fehler beim Öffnen von "
+ this.getProjectName());
}
}
}
unmarschall() :-
Code:
public void unmarschall(FileReader in) {
try {
JAXBContext jc = JAXBContext.newInstance("de.diplom.model");
Unmarshaller unmarshaller = jc.createUnmarshaller();
Project projectNode = (Project) unmarshaller.unmarshal(in);
in.close();
if (projectNode != null) {
this.newProject();
this.project = projectNode;
this.setProjectName(projectNode.getName());
if(!this.getProject().getGraphList().isEmpty()){
System.out.println("Graph Liste ist voll ...");
for (Graph graphNode : projectNode.getGraphList()) {
System.out.println("Graph ID :" +graphNode.getId());
this.setGraph(graphNode);
this.newTab(1);
((WorkspacePane) this.getTabbedPane().getComponentAt(
this.getTabbedPane().getTabCount() - 1))
.getMvGraph().setGraph(graphNode, "open");
}
}else {
System.out.println("Graph Liste ist leer ...");
}
}
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MainFrameException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
hier ist Die newTab():-
Code:
public void newTab(int i) throws MainFrameException {
if (i == 0) {
if (this.getProject() != null) {
int index = this.tabbedPane.getTabCount() + 1;
String title;
String toolTip = "Darstellung Ursache-Wirkung-Graph " + index;
this.workspacePane = this.getWorkspacePane();
title = this.workspacePane.getMvGraph().getGraph().getName();
System.out.println("Title " + title);
this.tabbedPane
.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
this.tabbedPane
.addTab(title, null, this.workspacePane, toolTip);
}
} else if (i == 1) {
if (this.getProject() != null) {
int index = this.tabbedPane.getTabCount() + 1;
String title = "";
String toolTip = "Darstellung Ursache-Wirkung-Graph " + index;
this.workspacePane = this.getWorkspacePane();
this.workspacePane.getMvGraph().setGraph(this.getGraph());
title = this.workspacePane.getMvGraph().getGraph().getName();
this.tabbedPane
.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
this.tabbedPane
.addTab(title, null, this.workspacePane, toolTip);
}
}
}
Zuletzt bearbeitet: