Skip to content

Commit

Permalink
Merge pull request #96 from protegeproject/104-if-a-class-has-only-on…
Browse files Browse the repository at this point in the history
…e-direct-parent-then-show-the-existing-parent-in-gray-in-the-lin-parent-column

fixed who-icatx/icatx-project#104
  • Loading branch information
soimugeoWB authored Jan 7, 2025
2 parents 86a96b5 + 83db8b4 commit fdf1046
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
.linearizationTable {
border-radius: 5px;
overflow: hidden;
-webkit-box-shadow: 0 0 40px 0 rgba(0,0,0,.15);
box-shadow: 0 0 40px 0 rgba(0,0,0,.15);
-webkit-box-shadow: 0 0 40px 0 rgba(0, 0, 0, .15);
box-shadow: 0 0 40px 0 rgba(0, 0, 0, .15);
margin: 15px;
border-collapse: collapse;
padding: 3px;
Expand Down Expand Up @@ -47,7 +47,7 @@
}

.tableCheckboxHeader > div {
justify-content: center!important;
justify-content: center !important;
}

.tableText [enabled="true"]:hover {
Expand All @@ -71,7 +71,7 @@
}

.tableCheckBox {
justify-self: center!important;
justify-self: center !important;
}

.tableCheckboxHeader {
Expand All @@ -88,7 +88,16 @@
}

.secondaryParent {
color : #A8A8A8;
color: #A8A8A8;
}

.italic {
font-style: italic;
}

.center {
display: flex;
justify-content: center;
}

.linearizationDefinition {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ interface LinearizationCss extends CssResource {

@ClassName("linearizationParentCell")
String getLinearizationParentCell();

@ClassName("italic")
String italic();

@ClassName("center")
String center();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public class LinearizationTableRow {

HorizontalPanel parentSelectionPanel;

LinearizationTableResourceBundle.LinearizationCss linearizationCss = LinearizationTableResourceBundle.INSTANCE.style();

private LinearizationTableRow() {

}
Expand Down Expand Up @@ -110,8 +112,7 @@ private void populateEditableLinearizationParent() {
}
}

String selectedItemText = linearizationParentSelector.getSelectedValue().equals("") ? "Select a parent" : linearizationParentSelector.getSelectedItemText();
this.linearizationParentLabel.setText(selectedItemText);
setLinearizationParentLabel();

this.linearizationParentSelector.addChangeHandler((event) -> this.handleParentSelected());
this.linearizationParentSelector.setVisible(false);
Expand All @@ -121,6 +122,19 @@ private void populateEditableLinearizationParent() {
}
}

private void setLinearizationParentLabel() {
String selectedItemText = "Select a parent";
if (linearizationParentSelector.getSelectedValue().equals("") && baseEntityParentsMap.size() == 1) {
Optional<String> keysOptional = baseEntityParentsMap.keySet().stream().findFirst();
selectedItemText = "[" + baseEntityParentsMap.get(keysOptional.get()) + "]";
this.linearizationParentLabel.addStyleName(linearizationCss.italic());
} else if (!linearizationParentSelector.getSelectedValue().equals("")) {
selectedItemText = linearizationParentSelector.getSelectedItemText();
this.linearizationParentLabel.removeStyleName(linearizationCss.italic());
}
this.linearizationParentLabel.setText(selectedItemText);
}

public void populateDerivedLinearizationParents(List<LinearizationTableRow> rows) {
if (isDerived()) {
LinearizationTableRow mainRow = rows.stream()
Expand All @@ -134,7 +148,8 @@ public void populateDerivedLinearizationParents(List<LinearizationTableRow> rows
this.linearizationParentSelector.setEnabled(false);
this.linearizationParentSelector.setVisible(false);
this.linearizationParentLabel.setText(mainRow.linearizationParentLabel.getText());
this.linearizationParentLabel.addStyleName(LinearizationTableResourceBundle.INSTANCE.style().getSecondaryParent());
this.linearizationParentLabel.addStyleName(mainRow.linearizationParentLabel.getStyleName());
this.linearizationParentLabel.addStyleName(linearizationCss.getSecondaryParent());
this.linearizationParentLabel.setVisible(true);
}
}
Expand Down Expand Up @@ -191,25 +206,25 @@ public LinearizationSpecification asLinearizationSpecification() {


public void populateFlexTable(int index, FlexTable flexTable) {
LinearizationTableResourceBundle.LinearizationCss style = LinearizationTableResourceBundle.INSTANCE.style();
flexTable.setWidget(index, 0, linearizationDefinitionWidget);
flexTable.getCellFormatter().addStyleName(index, 0, style.getTableText());
flexTable.getCellFormatter().addStyleName(index, 0, style.getLinearizationDefinition());
flexTable.getCellFormatter().addStyleName(index, 0, linearizationCss.getTableText());
flexTable.getCellFormatter().addStyleName(index, 0, linearizationCss.getLinearizationDefinition());

flexTable.setWidget(index, 1, isPartOfCheckbox);
flexTable.getCellFormatter().addStyleName(index, 1, style.getTableCheckBox());
flexTable.getCellFormatter().addStyleName(index, 1, linearizationCss.getTableCheckBox());

flexTable.setWidget(index, 2, isGroupingCheckbox);
flexTable.getCellFormatter().addStyleName(index, 2, style.getTableCheckBox());
flexTable.getCellFormatter().addStyleName(index, 2, linearizationCss.getTableCheckBox());

flexTable.setWidget(index, 3, isAuxAxChildCheckbox);
flexTable.getCellFormatter().addStyleName(index, 3, style.getTableCheckBox());
flexTable.getCellFormatter().addStyleName(index, 3, linearizationCss.getTableCheckBox());

flexTable.setWidget(index, 4, parentSelectionPanel);
flexTable.getCellFormatter().addStyleName(index, 4, style.getTableText());
flexTable.getCellFormatter().addStyleName(index, 4, linearizationCss.getTableText());
flexTable.getCellFormatter().addStyleName(index, 4, linearizationCss.getLinearizationDefinition());

flexTable.setWidget(index, 5, codingNotes);
flexTable.getCellFormatter().addStyleName(index, 5, style.getTableText());
flexTable.getCellFormatter().addStyleName(index, 5, linearizationCss.getTableText());

}

Expand Down

0 comments on commit fdf1046

Please sign in to comment.