Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

made applying the validation set and use the entity selection model o…

…f iri and type in the same way as previewing
  • Loading branch information...
commit 7d777e4481f5c33ceedec99d6107b9814b3e20ba 1 parent de5a134
@stuzart stuzart authored
View
16 src/main/java/uk/ac/manchester/cs/owl/semspreadsheets/model/WorkbookManager.java
@@ -251,18 +251,22 @@ public void saveWorkbook(URI uri) throws IOException {
getWorkbookState().changesSaved();
}
- public void previewValidationType() {
+ public void previewValidation() {
IRI iri = entitySelectionModel.getSelection().getIRI();
ValidationType type = entitySelectionModel.getValidationType();
Range range = new Range(workbook.getSheet(0));
ontologyTermValidationManager.previewValidation(range,type, iri);
}
- public void setValidationType(ValidationType type) {
- setValidationType(type,entitySelectionModel.getSelection().getIRI() );
+ public void setValidation() {
+ ValidationType type = entitySelectionModel.getValidationType();
+ IRI iri = entitySelectionModel.getSelection().getIRI();
+ logger.debug("Setting validation for IRI "+iri.toString()+", type "+type.toString());
+
+ setValidation(type, iri);
}
- public void setValidationTypeAt(Range range,ValidationType type, IRI entityIRI) {
+ public void setValidationAt(Range range,ValidationType type, IRI entityIRI) {
Range rangeToApply;
Collection<OntologyTermValidation> validations = ontologyTermValidationManager.getContainingValidations(range);
@@ -299,13 +303,13 @@ public void setValidationTypeAt(Range range,ValidationType type, IRI entityIRI)
* Sets the validation type for the currently selected cells.
* @param type
*/
- public void setValidationType(ValidationType type, IRI entityIRI) {
+ public void setValidation(ValidationType type, IRI entityIRI) {
Range selectedRange = getSelectionModel().getSelectedRange();
if(!selectedRange.isCellSelection()) {
return;
}
- setValidationTypeAt(selectedRange, type, entityIRI);
+ setValidationAt(selectedRange, type, entityIRI);
}
public void removeValidations(Range range) {
View
2  src/main/java/uk/ac/manchester/cs/owl/semspreadsheets/ui/ClassHierarchyTree.java
@@ -96,7 +96,7 @@ private void previewSelectedClass() {
}
}
workbookManager.getEntitySelectionModel().setSelection(selectedEntities.iterator().next());
- workbookManager.previewValidationType();
+ workbookManager.previewValidation();
}
finally {
transmittingSelectioToModel = false;
View
16 src/main/java/uk/ac/manchester/cs/owl/semspreadsheets/ui/ValidationTypeSelectorPanel.java
@@ -30,11 +30,11 @@
private Map<JRadioButton, ValidationType> values = new LinkedHashMap<JRadioButton, ValidationType>();
private JButton applyButton = new JButton("Apply");
- private WorkbookManager workbookManager;
+ private final WorkbookManager workbookManager;
private CellSelectionListener cellSelectionListener;
- public ValidationTypeSelectorPanel(WorkbookManager workbookManager) {
+ public ValidationTypeSelectorPanel(final WorkbookManager workbookManager) {
this.workbookManager = workbookManager;
setLayout(new BorderLayout());
Box box = new Box(BoxLayout.Y_AXIS);
@@ -54,7 +54,8 @@ public void actionPerformed(ActionEvent e) {
applyButton.addActionListener(applyButtonActionListener);
ActionListener checkboxActionListener = new ActionListener() {
- public void actionPerformed(ActionEvent e) {
+ public void actionPerformed(ActionEvent e) {
+ workbookManager.getEntitySelectionModel().setValidationType(getSelectedType());
previewSelectionInList();
applyButton.setEnabled(true);
}
@@ -82,13 +83,12 @@ public void selectionChanged(Range range) {
updateSelectionFromModel();
}
- private void previewSelectionInList() {
- workbookManager.getEntitySelectionModel().setValidationType(getSelectedType());
- workbookManager.previewValidationType();
+ private void previewSelectionInList() {
+ workbookManager.previewValidation();
}
- private void transmitSelectionToModel() {
- workbookManager.setValidationType(getSelectedType());
+ private void transmitSelectionToModel() {
+ workbookManager.setValidation();
}
private void updateSelectionFromModel() {
View
2  src/main/java/uk/ac/manchester/cs/owl/semspreadsheets/ui/action/SheetCellPasteAction.java
@@ -102,7 +102,7 @@ private void pasteValidations(Range range,
OntologyTermValidationDescriptor descriptor) {
getWorkbookManager().removeValidations(range);
if (descriptor!=null) {
- getWorkbookManager().setValidationTypeAt(range,descriptor.getType(), descriptor.getEntityIRI());
+ getWorkbookManager().setValidationAt(range,descriptor.getType(), descriptor.getEntityIRI());
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.