logFlow entfernt. Ausgabe immer über die infoBox eines bestimmten Bausteins. Datum wird bei start der App auf das aktuelle datum gesetzt

This commit is contained in:
2025-08-27 17:18:34 +02:00
parent 13c8400c2f
commit eeb4576fc1
3 changed files with 60 additions and 285 deletions

View File

@@ -6,8 +6,9 @@ import at.vvo.omds.client.gui.api.SOAPConnector;
import at.vvo.omds.types.omds3.r2025_05.common.*; import at.vvo.omds.types.omds3.r2025_05.common.*;
import at.vvo.omds.types.omds3.r2025_05.on2antrag.common.*; import at.vvo.omds.types.omds3.r2025_05.on2antrag.common.*;
import com.sun.xml.messaging.saaj.SOAPExceptionImpl; import com.sun.xml.messaging.saaj.SOAPExceptionImpl;
import javafx.animation.PauseTransition;
import javafx.application.Application; import javafx.application.Application;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.geometry.Insets; import javafx.geometry.Insets;
import javafx.geometry.Pos; import javafx.geometry.Pos;
import javafx.scene.Scene; import javafx.scene.Scene;
@@ -17,13 +18,12 @@ import javafx.scene.layout.*;
import javafx.scene.paint.Paint; import javafx.scene.paint.Paint;
import javafx.scene.text.*; import javafx.scene.text.*;
import javafx.stage.Stage; import javafx.stage.Stage;
import javafx.util.Duration;
import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.datatype.XMLGregorianCalendar;
import java.math.BigInteger; import java.math.BigInteger;
import java.time.LocalDateTime; import java.time.LocalDate;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
@@ -34,7 +34,6 @@ public class AllinOneView extends Application {
List<TreeItem<Object>> isNotIncluded = new ArrayList<>(); List<TreeItem<Object>> isNotIncluded = new ArrayList<>();
Map<TreeItem<Object>, Map<AttributType, String>> infoBoxFromItem = new HashMap<>(); Map<TreeItem<Object>, Map<AttributType, String>> infoBoxFromItem = new HashMap<>();
TextFlow logFlow = new TextFlow();
TreeHelper treeHelper = new TreeHelper(); TreeHelper treeHelper = new TreeHelper();
public static void main(String[] args) { public static void main(String[] args) {
@@ -74,11 +73,10 @@ public class AllinOneView extends Application {
controlBox[0].getChildren().add(dp); controlBox[0].getChildren().add(dp);
vpBox.getItems().clear(); vpBox.getItems().clear();
Text text = new Text("Kein Verkaufsoffenes Produkt an dem Datum: " + Label label = new Label("Kein Verkaufsoffenes Produkt an dem Datum: " +
stichtag.get().toString().substring(0, stichtag.get().toString().length() - 1) + stichtag.get().toString().substring(0, stichtag.get().toString().length() - 1) +
System.lineSeparator()); System.lineSeparator());
text.setFill(Paint.valueOf("#dd0000")); controlBox[0].getChildren().add(3, label);
logFlow.getChildren().add(text);
throw new NoSuchElementException(ex.getMessage()); throw new NoSuchElementException(ex.getMessage());
} catch (SOAPExceptionImpl ex) { } catch (SOAPExceptionImpl ex) {
HBox errorBox = new HBox(); HBox errorBox = new HBox();
@@ -133,6 +131,12 @@ public class AllinOneView extends Application {
}); });
dp.setValue(LocalDate.now());
Platform.runLater(() -> {
dp.getOnAction().handle(new ActionEvent(dp, null));
});
VBox.setVgrow(newCalcRequestControlBox, Priority.ALWAYS); VBox.setVgrow(newCalcRequestControlBox, Priority.ALWAYS);
newCalcRequestControlBox.setAlignment(Pos.BOTTOM_RIGHT); newCalcRequestControlBox.setAlignment(Pos.BOTTOM_RIGHT);
@@ -141,7 +145,7 @@ public class AllinOneView extends Application {
aprioriControlBox.getChildren().addAll(dp, vpBox); aprioriControlBox.getChildren().addAll(dp, vpBox);
controlBox[0].getChildren().addAll(aprioriControlBox); controlBox[0].getChildren().addAll(aprioriControlBox);
Scene scene = new Scene(controlBox[0], 900, 700); Scene scene = new Scene(controlBox[0], 900, 600);
stage.setScene(scene); stage.setScene(scene);
stage.show(); stage.show();
@@ -168,16 +172,11 @@ public class AllinOneView extends Application {
VBox treeBox = new VBox(); VBox treeBox = new VBox();
VBox infoBox = new VBox(); VBox infoBox = new VBox();
ScrollPane logPane = new ScrollPane(logFlow);
if (!logFlow.getChildren().isEmpty()) treeHelper.setLogFlow(logFlow);
TreeItem<Object> vkp = treeHelper.aprioriItemToCalcItem(new TreeItem<>(verkaufsprodukt)); TreeItem<Object> vkp = treeHelper.aprioriItemToCalcItem(new TreeItem<>(verkaufsprodukt));
vkp.setExpanded(true); vkp.setExpanded(true);
treeHelper.messageToTree(verkaufsprodukt, vkp); treeHelper.messageToTree(verkaufsprodukt, vkp);
logFlow = treeHelper.getLogFlow();
TreeView<Object> tv = new TreeView<>(vkp); TreeView<Object> tv = new TreeView<>(vkp);
tv.getSelectionModel().selectedItemProperty().addListener((obs, oldSelection, newSelection) -> { tv.getSelectionModel().selectedItemProperty().addListener((obs, oldSelection, newSelection) -> {
@@ -189,12 +188,13 @@ public class AllinOneView extends Application {
ItemAttribute itemAttribute = new ItemAttribute(); ItemAttribute itemAttribute = new ItemAttribute();
if (!infoBoxFromItem.isEmpty()) itemAttribute.setInfoBoxFromItem(infoBoxFromItem); if (!infoBoxFromItem.isEmpty()) itemAttribute.setInfoBoxFromItem(infoBoxFromItem);
itemAttribute.addItemInfo(newSelection, infoBox); itemAttribute.addItemInfo(newSelection, infoBox);
if (newSelection.getValue() instanceof VerkaufsproduktType){
itemAttribute.addVpInfo(infoBox, isMeldungVorhanden((ProduktbausteinType) newSelection.getValue(), tv), (VerkaufsproduktType) newSelection.getValue());
}
infoBoxFromItem = itemAttribute.getInfoBoxFromItem(); infoBoxFromItem = itemAttribute.getInfoBoxFromItem();
// addItemInfo(newSelection, infoBox);
}else{ }else{
infoBox.getChildren().removeAll(infoBox.getChildren()); infoBox.getChildren().removeAll(infoBox.getChildren());
} }
}); });
final TreeItem<Object> originalRoot = treeHelper.cloneTreeItem(tv.getRoot()); final TreeItem<Object> originalRoot = treeHelper.cloneTreeItem(tv.getRoot());
@@ -242,22 +242,6 @@ public class AllinOneView extends Application {
label.setMaxWidth(Double.MAX_VALUE); label.setMaxWidth(Double.MAX_VALUE);
if (!(getTreeItem().getValue() instanceof VerkaufsproduktType)) {
System.out.println(((ProduktbausteinType) getTreeItem().getValue()).getBezeichnung());
System.out.println(timesItemisIncludedById.get(
((ProduktbausteinType) getTreeItem().getValue()).getId()) != null);
System.out.println("...");
System.out.println(((ProduktbausteinType) getTreeItem().getValue()).getMaxVorkommen() != null
&& ((ProduktbausteinType) getTreeItem().getValue()).getMaxVorkommen() >=
timeItemIsIncludedByParent(getTreeItem().getParent(),
((ProduktbausteinType) getTreeItem().getValue()).getId()));
System.out.println("...");
System.out.println(timeItemIsIncludedByParent(getTreeItem().getParent(),
((ProduktbausteinType) getTreeItem().getValue()).getId()));
System.out.println("...");
System.out.println(((ProduktbausteinType) getTreeItem().getValue()).getMaxVorkommen() != null);
System.out.println("-----------------------------------------------------------------------------");
}
if (getTreeItem().getValue() instanceof VerkaufsproduktType || if (getTreeItem().getValue() instanceof VerkaufsproduktType ||
getTreeItem().getValue().getClass().equals(APrioriVerkaufsproduktType.class)) { getTreeItem().getValue().getClass().equals(APrioriVerkaufsproduktType.class)) {
cellBox.getChildren().addAll(label); cellBox.getChildren().addAll(label);
@@ -291,7 +275,6 @@ public class AllinOneView extends Application {
includeAddedChildren(getTreeItem()); includeAddedChildren(getTreeItem());
tv.setRoot(treeHelper.sortTree(tv.getRoot())); tv.setRoot(treeHelper.sortTree(tv.getRoot()));
tv.refresh(); tv.refresh();
timesItemisIncludedById.clear(); timesItemisIncludedById.clear();
refreshTimesItemisIncludedById(tv.getRoot()); refreshTimesItemisIncludedById(tv.getRoot());
} else { } else {
@@ -382,24 +365,6 @@ public class AllinOneView extends Application {
treeHelper.calcMessageToTree(calcResponse.getBerechnungsantwort().getVerkaufsprodukt(), newRoot); treeHelper.calcMessageToTree(calcResponse.getBerechnungsantwort().getVerkaufsprodukt(), newRoot);
timesItemisIncludedById = treeHelper.getTimesItemisIncludedById(); timesItemisIncludedById = treeHelper.getTimesItemisIncludedById();
newRoot.setExpanded(true); newRoot.setExpanded(true);
isNotIncluded.clear();
if (!isMeldungVorhanden(calcResponse.getBerechnungsantwort().getVerkaufsprodukt())) {
Text text = new Text(LocalDateTime.now() + ": Gültiges Verkaufsprodukt " + System.lineSeparator());
text.setFill(Paint.valueOf("#00bb33"));
logFlow.getChildren().add(text);
treeBox.setStyle("-fx-border-color: #00bb33");
PauseTransition pause = new PauseTransition(Duration.seconds(3));
pause.setOnFinished(ep -> treeBox.setStyle("-fx-border-color: #000000"));
pause.play();
}else {
Text text = new Text(LocalDateTime.now() + ": Kein Gültiges Verkaufsprodukt " + System.lineSeparator());
text.setFill(Paint.valueOf("#aa3333"));
logFlow.getChildren().add(text);
}
newRoot = treeHelper.addAprioriToCalc(newRoot, originalRoot); newRoot = treeHelper.addAprioriToCalc(newRoot, originalRoot);
newRoot = treeHelper.sortTree(newRoot); newRoot = treeHelper.sortTree(newRoot);
@@ -409,31 +374,11 @@ public class AllinOneView extends Application {
refreshTimesItemisIncludedById(tv.getRoot()); refreshTimesItemisIncludedById(tv.getRoot());
tv.refresh(); tv.refresh();
for (int j = 0; j < calcResponse.getBerechnungsantwort().getVerkaufsprodukt().getMeldungen().size(); j++) {
Text text = new Text(LocalDateTime.now() + " :"
+ calcResponse.getBerechnungsantwort().getVerkaufsprodukt().getMeldungen().get(j).getErrorMsg()
+ System.lineSeparator());
if (calcResponse.getBerechnungsantwort().getVerkaufsprodukt().getMeldungen().get(j).getErrorType()
.equals(BigInteger.ONE)) {
text.setFill(Paint.valueOf("#dd0000"));
} else if (calcResponse.getBerechnungsantwort().getVerkaufsprodukt().getMeldungen().get(j).getErrorType()
.equals(BigInteger.TWO)) {
text.setFill(Paint.valueOf("#bbbb00"));
} else {
text.setFill(Paint.valueOf("#000000"));
}
logFlow.getChildren().add(text);
}
} catch (Exception ex) { } catch (Exception ex) {
throw new RuntimeException(ex); throw new RuntimeException(ex);
} }
}); });
if (!treeBox.getChildren().isEmpty()) { if (!treeBox.getChildren().isEmpty()) {
treeBox.getChildren().clear(); treeBox.getChildren().clear();
} }
@@ -468,55 +413,12 @@ public class AllinOneView extends Application {
logWrapper.setAlignment(Pos.CENTER_LEFT); logWrapper.setAlignment(Pos.CENTER_LEFT);
logWrapper.setMaxWidth(Double.MAX_VALUE); logWrapper.setMaxWidth(Double.MAX_VALUE);
logFlow.setDisable(true); vbox.getChildren().addAll(wrapper);
logFlow.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
logFlow.setPadding(new Insets(20));
logFlow.setStyle("-fx-border-color: black; -fx-background-color: white;");
HBox.setMargin(logFlow, new Insets(10, 20, 10, 20));
logPane.setContent(logFlow);
logPane.setFitToWidth(true);
logPane.setFitToHeight(true);
logPane.setMaxHeight(200);
HBox.setHgrow(logPane, Priority.ALWAYS);
logWrapper.getChildren().add(logPane);
vbox.getChildren().addAll(wrapper, logWrapper);
VBox.setVgrow(wrapper, Priority.ALWAYS); VBox.setVgrow(wrapper, Priority.ALWAYS);
return vbox; return vbox;
} }
private boolean isMeldungVorhanden(ProduktbausteinType produkt) {
if (produkt != null && produkt.getMeldungen() != null && !produkt.getMeldungen().isEmpty()) {
return true;
}
for (ProduktbausteinType child : produkt.getBausteine()){
if(isMeldungVorhanden(child)) return true;
}
return false;
}
// private void addMeldungen(TreeItem<Object> newRoot, TextFlow logFlow, Node tv) {
// if (!((ProduktbausteinType)newRoot.getValue()).getMeldungen().isEmpty()) {
// PauseTransition pause = new PauseTransition(Duration.seconds(5));
//
// pause.play();
//
// for (ServiceFault s : ((ProduktbausteinType)newRoot.getValue()).getMeldungen()) {
// logFlow.getChildren().add(new Text(s.getErrorMsg() + System.lineSeparator()));
//
// if (tv != null) tv.setStyle("-fx-background-color: #aa3333");
// }
// }
// if (!newRoot.getChildren().isEmpty()) {
// for (TreeItem<Object> child : newRoot.getChildren()) {
// addMeldungen(child, logFlow, child.getGraphic());
// }
// }
// }
private void includeAddedParent(TreeItem<Object> treeItem) { private void includeAddedParent(TreeItem<Object> treeItem) {
if (treeItem.getParent() != null) { if (treeItem.getParent() != null) {
isNotIncluded.remove(treeItem.getParent()); isNotIncluded.remove(treeItem.getParent());
@@ -615,134 +517,16 @@ public class AllinOneView extends Application {
return erg; return erg;
} }
private boolean isMeldungVorhanden(ProduktbausteinType produkt, TreeView<Object> tv) {
TreeHelper treeHelper = new TreeHelper();
TreeItem<Object> actual = treeHelper.findTreeItem(produkt, tv.getRoot());
// private TreeItem<Object> cloneTreeItem(TreeItem<Object> original) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { if (actual != null && ((ProduktbausteinType)actual.getValue()).getMeldungen() != null && !((ProduktbausteinType)actual.getValue()).getMeldungen().isEmpty()) {
// Object cloneOriginalValue; return true;
// }
// cloneOriginalValue = new ObjectFactoryFactory().create(((ProduktbausteinType) original.getValue()).getType()); for (ProduktbausteinType child : produkt.getBausteine()){
// if(isMeldungVorhanden(child, tv)) return true;
// ((ProduktbausteinType) cloneOriginalValue).setId(((ProduktbausteinType) original.getValue()).getId()); }
// ((ProduktbausteinType) cloneOriginalValue).setBezeichnung(((ProduktbausteinType) original.getValue()).getBezeichnung()); return false;
// ((ProduktbausteinType) cloneOriginalValue).setFrom(((ProduktbausteinType) original.getValue()).getFrom()); }
// ((ProduktbausteinType) cloneOriginalValue).setTo(((ProduktbausteinType) original.getValue()).getTo());
// ((ProduktbausteinType) cloneOriginalValue).getAttribute().addAll(((ProduktbausteinType) original.getValue()).getAttribute());
// ((ProduktbausteinType) cloneOriginalValue).getMeldungen().addAll(((ProduktbausteinType) original.getValue()).getMeldungen());
// ((ProduktbausteinType) cloneOriginalValue).setMinOccurrences(((ProduktbausteinType) original.getValue()).getMinOccurrences());
// ((ProduktbausteinType) cloneOriginalValue).setMaxOccurrences(((ProduktbausteinType) original.getValue()).getMaxOccurrences());
// ((ProduktbausteinType) cloneOriginalValue).setType(((ProduktbausteinType) original.getValue()).getType());
//
//
// TreeItem<Object> clonedItem = new TreeItem<>(cloneOriginalValue);
//
// for (TreeItem<Object> child : original.getChildren()) {
// clonedItem.getChildren().add(cloneTreeItem(child));
// }
// return clonedItem;
// }
//
// private TreeItem<Object> findTreeItem(ProduktbausteinType item, TreeItem<Object> root) {
// if (((ProduktbausteinType) root.getValue()).getId().equals(item.getId())) {
// return root;
// }
// for (TreeItem<Object> child : root.getChildren()) {
// TreeItem<Object> found = findTreeItem(item, child);
// if (found != null) return found;
// }
// return null;
// }
//
// public void messageToTree(APrioriProduktbausteinType produkt, TreeItem<Object> treeItem) throws Exception {
// if (!produkt.getBausteine().isEmpty()) {
// for (int i = 0; i < produkt.getBausteine().size(); i++) {
// TreeItem<Object> up = aprioriToCalc(new TreeItem<>(produkt.getBausteine().get(i)));
// up.setExpanded(true);
// if (!produkt.getBausteine().get(i).getBausteine().isEmpty()) {
// messageToTree(produkt.getBausteine().get(i), up);
// }
// treeItem.getChildren().add(up);
// }
// }
// }
//
// public void calcMessageToTree(ProduktbausteinType produkt, TreeItem<Object> treeItem) {
// if (!produkt.getBausteine().isEmpty()) {
// for (int i = 0; i < produkt.getBausteine().size(); i++) {
// TreeItem<Object> up = new TreeItem<>(produkt.getBausteine().get(i));
// up.setExpanded(true);
// if (!produkt.getBausteine().get(i).getBausteine().isEmpty()) {
// calcMessageToTree(produkt.getBausteine().get(i), up);
// }
// treeItem.getChildren().add(up);
// if (!timesItemisIncludedById.containsKey(((ProduktbausteinType) up.getValue()).getId())) {
// timesItemisIncludedById.put(((ProduktbausteinType) up.getValue()).getId(), 1);
// }
// }
// }
// }
// public TreeItem<Object> aprioriToCalc(TreeItem<Object> produkt) throws Exception {
//
// TreeItem<Object> ergItem = new TreeItem<>();
// Object erg = new ObjectFactoryFactory().create(((APrioriProduktbausteinType) produkt.getValue()).getType());
//
// if (erg != null) {
// if (ProduktbausteinType.class.isAssignableFrom(erg.getClass())) {
// ((ProduktbausteinType) erg).setId(((APrioriProduktbausteinType) produkt.getValue()).getId());
// ((ProduktbausteinType) erg).setBezeichnung(((APrioriProduktbausteinType) produkt.getValue()).getName());
// ((ProduktbausteinType) erg).setFrom(((APrioriProduktbausteinType) produkt.getValue()).getFrom());
// ((ProduktbausteinType) erg).setTo(((APrioriProduktbausteinType) produkt.getValue()).getTo());
// ((ProduktbausteinType) erg).getMeldungen().addAll(((APrioriProduktbausteinType) produkt.getValue()).getMeldungen());
// ((ProduktbausteinType) erg).getAttribute().addAll(((APrioriProduktbausteinType) produkt.getValue()).getAttribute());
// ((ProduktbausteinType) erg).setMinOccurrences(((APrioriProduktbausteinType) produkt.getValue()).getMinOccurrences());
// ((ProduktbausteinType) erg).setMaxOccurrences(((APrioriProduktbausteinType) produkt.getValue()).getMaxOccurrences());
// ((ProduktbausteinType) erg).setType(((APrioriProduktbausteinType) produkt.getValue()).getType());
//
//
// for (int i = 0; i < ((APrioriProduktbausteinType) produkt.getValue()).getBausteine().size(); i++) {
// ((ProduktbausteinType) erg).getBausteine().add((ProduktbausteinType) aprioriToCalc(new TreeItem<>(((APrioriProduktbausteinType) produkt.getValue()).getBausteine().get(i))).getValue());
// }
//
// for (int i = 0; i < produkt.getChildren().size(); i++) {
// ergItem.getChildren().add(aprioriToCalc(produkt.getChildren().get(i)));
// }
// }
// } else {
// logFlow.getChildren().add(new Text("Objekt kann nicht erzeugt werden. Unbekannte Klasse " + ((APrioriProduktbausteinType) produkt.getValue()).getType()));
// throw new Exception("Objekt kann nicht erzeugt werden. Unbekannte Klasse " + ((APrioriProduktbausteinType) produkt.getValue()).getType());
//
// }
// ergItem.setValue(erg);
// return ergItem;
// }
//
// public TreeItem<Object> addAprioriToCalc(TreeItem<Object> calcItem, TreeItem<Object> aprioriItem) throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
// for (TreeItem<Object> aprioriChild : aprioriItem.getChildren()) {
//
// List<TreeItem<Object>> matchingChildren = calcItem.getChildren().stream()
// .filter(c -> ((ProduktbausteinType) c.getValue()).getId().equals(((ProduktbausteinType) aprioriChild.getValue()).getId()))
// .toList();
//
// if (matchingChildren.isEmpty()) {
// TreeItem<Object> newChild = cloneTreeItem(aprioriChild);
// calcItem.getChildren().add(newChild);
// addAprioriToCalc(newChild, aprioriChild);
// } else {
// for (TreeItem<Object> matchingChild : matchingChildren) {
// addAprioriToCalc(matchingChild, aprioriChild);
// }
// }
// }
// return calcItem;
// }
//
// private void sortTree(TreeItem<Object> parent) {
// FXCollections.sort(parent.getChildren(), Comparator.comparing(
// item -> ((ProduktbausteinType) item.getValue()).getBezeichnung().toLowerCase()
// ));
//
// for (TreeItem<Object> child : parent.getChildren()) {
// sortTree(child);
// }
// }
} }

View File

@@ -308,38 +308,35 @@ public class ItemAttribute {
}else { }else {
singleAttributBox.getChildren().addAll(label, textField); singleAttributBox.getChildren().addAll(label, textField);
} }
attributBox.getChildren().add(singleAttributBox); attributBox.getChildren().add(singleAttributBox);
// if (((ProduktbausteinType)newSelection.getValue()).getMeldungen() != null
// && !((ProduktbausteinType)newSelection.getValue()).getMeldungen().isEmpty()) {
// ((ProduktbausteinType)newSelection.getValue()).getMeldungen().forEach(n -> {
// VBox meldung = new VBox();
//
// Label code = new Label();
// Label text = new Label();
// Label ref = new Label();
//
// if (n.getErrorCode() != null) {code = new Label("Error Code: " + n.getErrorCode().toString());}
// if (n.getErrorMsg() != null) {text = new Label(n.getErrorMsg());}
// if (n.getElementReference() != null) {ref = new Label(n.getElementReference());}
//
// if (n.getErrorType().equals(BigInteger.ONE)){
// code.setStyle("-fx-text-fill: red;");
// text.setStyle("-fx-text-fill: red;");
// ref.setStyle("-fx-text-fill: red;");
// }else if (n.getErrorType().equals(BigInteger.TWO)){
// code.setStyle("-fx-text-fill: #bbbb00;");
// text.setStyle("-fx-text-fill: #bbbb00;");
// ref.setStyle("-fx-text-fill: #bbbb00;");
// }
//
// meldung.getChildren().addAll(code, text, ref);
// attributBox.getChildren().add(meldung);
// });
// }
} }
return attributBox; return attributBox;
} }
public VBox addVpInfo(VBox attributBox, boolean meldungVorhanden, VerkaufsproduktType vp) {
attributBox.getChildren().removeIf(c -> c.getId() != null && c.getId().equals("vpLabel"));
Label vpLabel = new Label();
if (!meldungVorhanden) {
vpLabel.setText("Gültiges Verkaufsprodukt " + System.lineSeparator());
}else {
vpLabel.setText("Kein Gültiges Verkaufsprodukt " + System.lineSeparator());
}
vpLabel.setPadding(new Insets(10));
attributBox.getChildren().addFirst(vpLabel);
VBox vpMeldungenTexts = new VBox();
vp.getMeldungen().forEach( m -> {
Label vpMeldungText = new Label(m.getErrorMsg() + System.lineSeparator());
vpMeldungText.setPadding(new Insets(10));
vpMeldungenTexts.getChildren().add(vpMeldungText);
});
attributBox.getChildren().removeIf(c -> c.getId() != null && c.getId().equals("vpMeldungenTexts"));
attributBox.getChildren().addAll(vpMeldungenTexts);
return attributBox;
}
} }

View File

@@ -13,7 +13,6 @@ import java.util.*;
public class TreeHelper { public class TreeHelper {
Map<String, Integer> timesItemisIncludedById = new HashMap<>(); Map<String, Integer> timesItemisIncludedById = new HashMap<>();
List<TreeItem<Object>> isNotIncluded = new ArrayList<>(); List<TreeItem<Object>> isNotIncluded = new ArrayList<>();
TextFlow logFlow = new TextFlow();
public Map<String, Integer> getTimesItemisIncludedById() { public Map<String, Integer> getTimesItemisIncludedById() {
return timesItemisIncludedById; return timesItemisIncludedById;
@@ -31,14 +30,6 @@ public class TreeHelper {
this.isNotIncluded = isNotIncluded; this.isNotIncluded = isNotIncluded;
} }
public TextFlow getLogFlow() {
return logFlow;
}
public void setLogFlow(TextFlow logFlow) {
this.logFlow = logFlow;
}
public TreeItem<Object> cleanTree(TreeItem<Object> original) { public TreeItem<Object> cleanTree(TreeItem<Object> original) {
if (isNotIncluded.contains(original)) { if (isNotIncluded.contains(original)) {
return null; return null;
@@ -165,11 +156,8 @@ public class TreeHelper {
} }
} }
} else { } else {
logFlow.getChildren().add(new Text("Objekt kann nicht erzeugt werden. Unbekannte Klasse "
+ ((APrioriProduktbausteinType) produkt.getValue()).getType()));
throw new Exception("Objekt kann nicht erzeugt werden. Unbekannte Klasse " throw new Exception("Objekt kann nicht erzeugt werden. Unbekannte Klasse "
+ ((APrioriProduktbausteinType) produkt.getValue()).getType()); + ((APrioriProduktbausteinType) produkt.getValue()).getType());
} }
ergItem.setValue(erg); ergItem.setValue(erg);
return ergItem; return ergItem;
@@ -186,6 +174,7 @@ public class TreeHelper {
if (matchingChildren.isEmpty()) { if (matchingChildren.isEmpty()) {
TreeItem<Object> newChild = cloneTreeItem(aprioriChild); TreeItem<Object> newChild = cloneTreeItem(aprioriChild);
calcItem.getChildren().add(newChild); calcItem.getChildren().add(newChild);
addAprioriToCalc(newChild, aprioriChild); addAprioriToCalc(newChild, aprioriChild);
} else { } else {
@@ -207,4 +196,9 @@ public class TreeHelper {
} }
return parent; return parent;
} }
private String itemPfad(TreeItem<Object> item) {
if (item.getParent() == null) return ((ProduktbausteinType)item.getValue()).getId();
return itemPfad(item.getParent()) + "/" + ((ProduktbausteinType)item.getValue()).getId();
}
} }