Skip to content

Commit f1f5910

Browse files
authored
Merge pull request #736 from bowring/issue734
Fixed Issue #734
2 parents 22bdc8e + 4768fe6 commit f1f5910

File tree

4 files changed

+96
-99
lines changed

4 files changed

+96
-99
lines changed

common.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ apply plugin: 'maven-publish'
77

88

99
String mavenGroupId = 'org.cirdles'
10-
String mavenVersion = '1.10.5'
10+
String mavenVersion = '1.10.6'
1111

1212
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
1313

squidApp/src/main/java/org/cirdles/squid/gui/TaskEditorController.java

+95-98
Original file line numberDiff line numberDiff line change
@@ -90,77 +90,8 @@ public class TaskEditorController implements Initializable {
9090
private static final ToggleGroup denTG = new ToggleGroup();
9191
public static TaskInterface existingTaskToEdit = null;
9292
public static Squid3Constants.TaskEditTypeEnum editType = Squid3Constants.TaskEditTypeEnum.EDIT_CURRENT;
93-
private static TaskDesign taskEditor;
94-
@FXML
95-
private static TextField uncorrConstPbUExpressionText;
96-
@FXML
97-
private static TextField uncorrConstPbThExpressionText;
98-
@FXML
99-
private static TextField parentConcExpressionText;
100-
@FXML
101-
private static TextField pb208Th232ExpressionText;
102-
@FXML
103-
private static TextFlow defaultRatiosListTextFlow;
10493
private static Map<String, ExpressionTreeInterface> namedExpressionsMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
10594
private static boolean amGeochronMode;
106-
107-
static {
108-
addBtnHBox.setAlignment(Pos.CENTER);
109-
addBtn.setStyle(
110-
"-fx-padding: 5 22 5 22;\n"
111-
+ " -fx-border-color: #e2e2e2;"
112-
+ " -fx-border-width: 2;"
113-
+ " -fx-background-radius: 0;"
114-
+ " -fx-background-color: #FB6D42;"
115-
+ " -fx-font-family: SansSerif;"
116-
+ " -fx-font-size: 11pt;"
117-
+ " -fx-text-fill: whitesmoke;"
118-
+ " -fx-background-insets: 0 0 0 0, 0, 1, 2;");
119-
120-
addBtn.setOnMouseClicked((event) -> {
121-
taskEditor.addRatioName(numLabel.getText() + "/" + denLabel.getText());
122-
namedExpressionsMap = taskEditor.buildNamedExpressionsMap();
123-
populateRatios();
124-
refreshExpressionAudits();
125-
updateAddButton();
126-
});
127-
128-
updateAddButton();
129-
130-
numLabel.setStyle("-fx-font-family: SansSerif bold;-fx-font-size: 18");
131-
divLabel.setStyle("-fx-font-family: SansSerif bold;-fx-font-size: 18");
132-
denLabel.setStyle("-fx-font-family: SansSerif bold;-fx-font-size: 18");
133-
134-
infoLabelHBox.setAlignment(Pos.CENTER);
135-
AnchorPane pane = new AnchorPane(menuVBox);
136-
AnchorPane.setBottomAnchor(menuVBox, 0.0);
137-
AnchorPane.setTopAnchor(menuVBox, 0.0);
138-
AnchorPane.setRightAnchor(menuVBox, 0.0);
139-
AnchorPane.setLeftAnchor(menuVBox, 0.0);
140-
141-
numTG.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
142-
public void changed(ObservableValue<? extends Toggle> ob, Toggle o, Toggle n) {
143-
RadioButton rb = (RadioButton) numTG.getSelectedToggle();
144-
if (rb != null) {
145-
numLabel.setText(rb.getText());
146-
updateAddButton();
147-
}
148-
}
149-
});
150-
denTG.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
151-
public void changed(ObservableValue<? extends Toggle> ob, Toggle o, Toggle n) {
152-
RadioButton rb = (RadioButton) denTG.getSelectedToggle();
153-
if (rb != null) {
154-
denLabel.setText(rb.getText());
155-
updateAddButton();
156-
}
157-
}
158-
});
159-
ADD_RATIOS_STAGE.setScene(new Scene(pane, 250, 500));
160-
ADD_RATIOS_STAGE.setAlwaysOnTop(true);
161-
162-
}
163-
16495
private final List<StackPane> undoMassesList = new ArrayList<>();
16596
EventHandler<MouseEvent> mouseEnteredExpressionEventHandler = new EventHandler<MouseEvent>() {
16697
@Override
@@ -177,6 +108,17 @@ public void handle(MouseEvent event) {
177108
}
178109
}
179110
};
111+
private TaskDesign taskEditor;
112+
@FXML
113+
private TextField uncorrConstPbUExpressionText;
114+
@FXML
115+
private TextField uncorrConstPbThExpressionText;
116+
@FXML
117+
private TextField parentConcExpressionText;
118+
@FXML
119+
private TextField pb208Th232ExpressionText;
120+
@FXML
121+
private TextFlow defaultRatiosListTextFlow;
180122
@FXML
181123
private GridPane taskManagerGridPane;
182124
@FXML
@@ -262,7 +204,33 @@ public static VBox makeRatioVBox(String ratioName) {
262204
return ratio;
263205
}
264206

265-
private static void updateAddButton() {
207+
private static void tooltipMapPut(Expression exp, String expressionText) {
208+
Tooltip audit = new Tooltip(exp.produceExpressionTreeAudit());
209+
audit.setStyle(EXPRESSION_TOOLTIP_CSS_STYLE_SPECS);
210+
Tooltip result = tooltipsMap.put(expressionText, audit);
211+
if (result != null) {
212+
result.hide();
213+
}
214+
}
215+
216+
/**
217+
* @param expressionName
218+
* @param expressionString
219+
* @return
220+
*/
221+
private static Expression makeExpression(String expressionName, final String expressionString) {
222+
return makeExpressionForAudit(expressionName, expressionString, namedExpressionsMap);
223+
}
224+
225+
private static void updateExpressionHealthFlag(TextField expressionText, boolean healthy) {
226+
if (healthy) {
227+
expressionText.setStyle(expressionText.getStyle().replace("wrongx_icon", "icon_checkmark"));
228+
} else {
229+
expressionText.setStyle(expressionText.getStyle().replace("icon_checkmark", "wrongx_icon"));
230+
}
231+
}
232+
233+
private void updateAddButton() {
266234
String num = numLabel.getText();
267235
String den = denLabel.getText();
268236
boolean valid = (num.compareTo(den) != 0)
@@ -272,7 +240,7 @@ private static void updateAddButton() {
272240
addBtn.setDisable(!valid);
273241
}
274242

275-
private static void populateRatios() {
243+
private void populateRatios() {
276244
defaultRatiosListTextFlow.getChildren().clear();
277245
defaultRatiosListTextFlow.setMaxHeight(30);
278246
int count = 1;
@@ -305,7 +273,7 @@ private static void populateRatios() {
305273
}
306274
}
307275

308-
private static void refreshExpressionAudits() {
276+
private void refreshExpressionAudits() {
309277
Expression exp = makeExpression(UNCOR206PB238U_CALIB_CONST, uncorrConstPbUExpressionText.getText());
310278
tooltipMapPut(exp, UNCOR206PB238U_CALIB_CONST);
311279
updateExpressionHealthFlag(uncorrConstPbUExpressionText, exp.amHealthy());
@@ -324,37 +292,66 @@ private static void refreshExpressionAudits() {
324292

325293
}
326294

327-
private static void tooltipMapPut(Expression exp, String expressionText) {
328-
Tooltip audit = new Tooltip(exp.produceExpressionTreeAudit());
329-
audit.setStyle(EXPRESSION_TOOLTIP_CSS_STYLE_SPECS);
330-
Tooltip result = tooltipsMap.put(expressionText, audit);
331-
if (result != null) {
332-
result.hide();
333-
}
334-
}
335-
336-
/**
337-
* @param expressionName
338-
* @param expressionString
339-
* @return
340-
*/
341-
private static Expression makeExpression(String expressionName, final String expressionString) {
342-
return makeExpressionForAudit(expressionName, expressionString, namedExpressionsMap);
343-
}
344-
345-
private static void updateExpressionHealthFlag(TextField expressionText, boolean healthy) {
346-
if (healthy) {
347-
expressionText.setStyle(expressionText.getStyle().replace("wrongx_icon", "icon_checkmark"));
348-
} else {
349-
expressionText.setStyle(expressionText.getStyle().replace("icon_checkmark", "wrongx_icon"));
350-
}
351-
}
352-
353295
/**
354296
* Initializes the controller class.
355297
*/
356298
@Override
357299
public void initialize(URL url, ResourceBundle rb) {
300+
addBtnHBox.setAlignment(Pos.CENTER);
301+
addBtn.setStyle(
302+
"-fx-padding: 5 22 5 22;\n"
303+
+ " -fx-border-color: #e2e2e2;"
304+
+ " -fx-border-width: 2;"
305+
+ " -fx-background-radius: 0;"
306+
+ " -fx-background-color: #FB6D42;"
307+
+ " -fx-font-family: SansSerif;"
308+
+ " -fx-font-size: 11pt;"
309+
+ " -fx-text-fill: whitesmoke;"
310+
+ " -fx-background-insets: 0 0 0 0, 0, 1, 2;");
311+
312+
addBtn.setOnMouseClicked((event) -> {
313+
taskEditor.addRatioName(numLabel.getText() + "/" + denLabel.getText());
314+
namedExpressionsMap = taskEditor.buildNamedExpressionsMap();
315+
populateRatios();
316+
refreshExpressionAudits();
317+
updateAddButton();
318+
});
319+
320+
updateAddButton();
321+
322+
numLabel.setStyle("-fx-font-family: SansSerif bold;-fx-font-size: 18");
323+
divLabel.setStyle("-fx-font-family: SansSerif bold;-fx-font-size: 18");
324+
denLabel.setStyle("-fx-font-family: SansSerif bold;-fx-font-size: 18");
325+
326+
infoLabelHBox.setAlignment(Pos.CENTER);
327+
AnchorPane pane = new AnchorPane(menuVBox);
328+
AnchorPane.setBottomAnchor(menuVBox, 0.0);
329+
AnchorPane.setTopAnchor(menuVBox, 0.0);
330+
AnchorPane.setRightAnchor(menuVBox, 0.0);
331+
AnchorPane.setLeftAnchor(menuVBox, 0.0);
332+
333+
numTG.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
334+
public void changed(ObservableValue<? extends Toggle> ob, Toggle o, Toggle n) {
335+
RadioButton rb = (RadioButton) numTG.getSelectedToggle();
336+
if (rb != null) {
337+
numLabel.setText(rb.getText());
338+
updateAddButton();
339+
}
340+
}
341+
});
342+
denTG.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
343+
public void changed(ObservableValue<? extends Toggle> ob, Toggle o, Toggle n) {
344+
RadioButton rb = (RadioButton) denTG.getSelectedToggle();
345+
if (rb != null) {
346+
denLabel.setText(rb.getText());
347+
updateAddButton();
348+
}
349+
}
350+
});
351+
352+
ADD_RATIOS_STAGE.setScene(new Scene(pane, 250, 500));
353+
ADD_RATIOS_STAGE.setAlwaysOnTop(true);
354+
358355
titleLabel.setStyle(STYLE_MANAGER_TITLE);
359356
try {
360357
taskEditor = SquidPersistentState.getExistingPersistentState().getTaskDesign();
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)