Change FeatureListsComponent to HBox
@@ -37,9 +37,9 @@ import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.Tooltip;
-import javafx.scene.layout.BorderPane;
+import javafx.scene.layout.HBox;
-public class FeatureListsComponent extends BorderPane {
+public class FeatureListsComponent extends HBox {
private final ComboBox<FeatureListsSelectionType> typeCombo;
@@ -48,27 +48,26 @@ public class FeatureListsComponent extends BorderPane {
private FeatureListsSelection currentValue = new FeatureListsSelection();
public FeatureListsComponent() {
-
- // setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0));
+ setSpacing(5);
numPeakListsLabel = new Label();
- setLeft(numPeakListsLabel);
detailsButton = new Button("Select");
detailsButton.setDisable(true);
- setRight(detailsButton);
- typeCombo = new ComboBox<>(FXCollections.observableArrayList(FeatureListsSelectionType.values()));
+ typeCombo = new ComboBox<>(
+ FXCollections.observableArrayList(FeatureListsSelectionType.values()));
typeCombo.getSelectionModel().selectFirst();
- typeCombo.getSelectionModel().selectedItemProperty().addListener((options, oldValue, newValue) -> {
+ typeCombo.getSelectionModel().selectedItemProperty()
+ .addListener((options, oldValue, newValue) -> {
currentValue.setSelectionType(newValue);
- detailsButton.setDisable((newValue != FeatureListsSelectionType.NAME_PATTERN)
- && (newValue != FeatureListsSelectionType.SPECIFIC_FEATURELISTS));
+ detailsButton.setDisable((newValue != FeatureListsSelectionType.NAME_PATTERN) && (newValue
+ != FeatureListsSelectionType.SPECIFIC_FEATURELISTS));
updateNumPeakLists();
});
- setCenter(typeCombo);
+ getChildren().addAll(numPeakListsLabel, typeCombo, detailsButton);
detailsButton.setOnAction(e -> {
FeatureListsSelectionType type = typeCombo.getSelectionModel().getSelectedItem();
@@ -81,7 +80,7 @@ public class FeatureListsComponent extends BorderPane {
final SimpleParameterSet paramSet = new SimpleParameterSet(new Parameter[]{plsParameter});
final ExitCode exitCode = paramSet.showSetupDialog(true);
if (exitCode == ExitCode.OK) {
- FeatureList pls[] = paramSet.getParameter(plsParameter).getValue();
+ FeatureList[] pls = paramSet.getParameter(plsParameter).getValue();
currentValue.setSpecificFeatureLists(pls);
}
@@ -102,14 +101,14 @@ public class FeatureListsComponent extends BorderPane {
updateNumPeakLists();
});
-
}
void setValue(FeatureListsSelection newValue) {
currentValue = newValue.clone();
FeatureListsSelectionType type = newValue.getSelectionType();
- if (type != null)
+ if (type != null) {
typeCombo.getSelectionModel().select(type);
+ }
updateNumPeakLists();
}
@@ -118,7 +117,6 @@ public class FeatureListsComponent extends BorderPane {
}
-
public void setToolTipText(String toolTip) {
typeCombo.setTooltip(new Tooltip(toolTip));
}
@@ -128,11 +126,12 @@ public class FeatureListsComponent extends BorderPane {
numPeakListsLabel.setText("");
numPeakListsLabel.setTooltip(null);
} else {
- FeatureList pls[] = currentValue.getMatchingFeatureLists();
+ FeatureList[] pls = currentValue.getMatchingFeatureLists();
if (pls.length == 1) {
String plName = pls[0].getName();
- if (plName.length() > 22)
+ if (plName.length() > 22) {
plName = plName.substring(0, 20) + "...";
+ }
numPeakListsLabel.setText(plName);
} else {
numPeakListsLabel.setText(pls.length + " selected");
