Skip to content

Commit

Permalink
Another bug fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmederly committed May 5, 2021
1 parent 866f343 commit 5b087c8
Showing 1 changed file with 20 additions and 2 deletions.
Expand Up @@ -365,19 +365,28 @@ public void writeDefinition(PrismContainerDefinition<?> definition,

Definition parentDef = null;

//todo simplify

if (isPresent) {
mapOfParents.put(definitionString, definition);
parentDef = definition;
} else {
for (Definition def : selectedDefinitions) {
//PrismContainerDefinition<?> selectedDefinition = (PrismContainerDefinition<?>) stringToDef.get(def);
if (def != null && (path.contains(def) || definition == def)) { // todo maybe add: && path.indexOf(subDefinition) == mapOfRefDefLevels.get(subDefinitionString)
mapOfSelectedDefinitionsParents.put(definition, def);
mapOfParents.put(definitionString, def);
parentDef = def;
}
}
}

// todo
if (parentDef == null) {
parentDef = definition;
mapOfParents.put(definitionString, definition);
}

if (selectedDefinitions.contains(targetDefinition) && parentDef != null && selectedDefinitions.indexOf(parentDef) > selectedDefinitions.indexOf(targetDefinition)) {
//Collections.swap(selectedDefinitions, selectedDefinitions.indexOf(targetDefinition), selectedDefinitions.indexOf(parentDef));
selectedDefinitions.remove(parentDef);
Expand Down Expand Up @@ -499,7 +508,7 @@ else if (parentLevel > level) {
//description += nParentDefinition;

if (neededNotClosedUls == null || neededNotClosedUls > notClosedUls || nParentLevel != level) {
myWriter.write("\ncouz" + subDefinition);
myWriter.write("\nBUG" + subDefinition);
} else {
while (notClosedUls != (neededNotClosedUls)) {
description += "</ul></li>";
Expand All @@ -525,13 +534,22 @@ else if (parentLevel > level) {
Definition originalDef = stringToDef.get(originalDefString);
PrismContainerDefinition<?> parent = (PrismContainerDefinition<?>) mapOfParents.get(originalDefString);

// if (parent != null) {
// throw new Error("HALOOOOO" + parent);
// }

if (originalDef != null) { //refs != null

ArrayList<ArrayList<String>> refsArrays = new ArrayList<>(mapOfRefs.get(def).values());
ArrayList<String> refs = refsArrays.get(0);
PrismContainerDefinition<?> selectedDefinitionParent = (PrismContainerDefinition<?>) mapOfSelectedDefinitionsParents.get(parent);

if (selectedDefinitionParent == null) {
selectedDefinitionParent = parent;
}

myWriter.write("\n" + parent.getItemName().getLocalPart() + def.getTypeName().getLocalPart() + "Refs = {");
myWriter.write("\n\tparent: " + ((PrismContainerDefinition<?>)mapOfSelectedDefinitionsParents.get(parent)).getItemName().getLocalPart() + ","); // todo make as parent selected def
myWriter.write("\n\tparent: " + selectedDefinitionParent.getItemName().getLocalPart() + ","); // todo make as parent selected def

//String refsInnerHTML = "<div class = \"ref\"><h1>source:<br>" + originalDef.replaceAll("\\d", "") + "</h1><ul>"; // todo make decision if source would be displayed

Expand Down

0 comments on commit 5b087c8

Please sign in to comment.