#856 Adds support for resetting alias color selection in the alias bulk editor. (#857)

Co-authored-by: Denny <denny@denny-desktop>
This commit is contained in:
Denny Sheirer
2020-06-11 04:26:40 -04:00
committed by GitHub
parent 96611fa2c2
commit bbe90ca74b

View File

@@ -35,6 +35,7 @@ import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.scene.control.Separator;
import javafx.scene.image.ImageView;
import javafx.scene.layout.ColumnConstraints;
import javafx.scene.layout.GridPane;
@@ -53,6 +54,7 @@ public class AliasBulkEditor extends Editor<List<Alias>>
private Label mEditingLabel;
private ColorPicker mColorPicker;
private Button mApplyColorButton;
private Button mResetColorButton;
private ComboBox<Icon> mIconNodeComboBox;
private Button mApplyIconButton;
private ToggleSwitch mMonitorAudioToggleSwitch;
@@ -74,9 +76,19 @@ public class AliasBulkEditor extends Editor<List<Alias>>
int row = 0;
GridPane.setConstraints(getEditingLabel(), 1, row, 2, 1);
Label editorLabel = new Label("Multiple Alias Editor");
GridPane.setConstraints(editorLabel, 0, row, 3, 1);
gridPane.getChildren().add(editorLabel);
GridPane.setConstraints(getEditingLabel(), 3, row, 3, 1);
GridPane.setHalignment(getEditingLabel(), HPos.RIGHT);
gridPane.getChildren().add(getEditingLabel());
Separator separator = new Separator();
separator.setMaxWidth(Double.MAX_VALUE);
GridPane.setConstraints(separator, 0, ++row, 6, 1);
gridPane.getChildren().add(separator);
Label colorLabel = new Label("Color");
GridPane.setHalignment(colorLabel, HPos.RIGHT);
GridPane.setConstraints(colorLabel, 0, ++row);
@@ -88,6 +100,9 @@ public class AliasBulkEditor extends Editor<List<Alias>>
GridPane.setConstraints(getApplyColorButton(), 4, row);
gridPane.getChildren().add(getApplyColorButton());
GridPane.setConstraints(getResetColorButton(), 5, row);
gridPane.getChildren().add(getResetColorButton());
Label iconLabel = new Label("Icon");
GridPane.setHalignment(iconLabel, HPos.RIGHT);
GridPane.setConstraints(iconLabel, 0, ++row);
@@ -186,6 +201,22 @@ public class AliasBulkEditor extends Editor<List<Alias>>
return mApplyColorButton;
}
private Button getResetColorButton()
{
if(mResetColorButton == null)
{
mResetColorButton = new Button("Reset Color");
mResetColorButton.setOnAction(event -> {
for(Alias alias: getItem())
{
alias.setColor(0);
}
});
}
return mResetColorButton;
}
private ComboBox<Icon> getIconNodeComboBox()
{
if(mIconNodeComboBox == null)