forked from j62/ctbrec
Make layout grow horizontally
This commit is contained in:
parent
6117d24e13
commit
faf3d469f0
|
@ -59,7 +59,7 @@ import javafx.stage.Modality;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import javafx.stage.Window;
|
import javafx.stage.Window;
|
||||||
|
|
||||||
public class ActionSettingsPanel extends Pane {
|
public class ActionSettingsPanel extends GridPane {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(ActionSettingsPanel.class);
|
private static final Logger LOG = LoggerFactory.getLogger(ActionSettingsPanel.class);
|
||||||
private ListView<EventHandlerConfiguration> actionTable;
|
private ListView<EventHandlerConfiguration> actionTable;
|
||||||
|
|
||||||
|
@ -89,22 +89,21 @@ public class ActionSettingsPanel extends Pane {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createGui() {
|
private void createGui() {
|
||||||
GridPane grid = new GridPane();
|
setHgap(10);
|
||||||
grid.setHgap(10);
|
setVgap(10);
|
||||||
grid.setVgap(10);
|
setPadding(new Insets(20, 10, 10, 10));
|
||||||
grid.setPadding(new Insets(20, 150, 10, 10));
|
|
||||||
getChildren().add(grid);
|
|
||||||
|
|
||||||
Label headline = new Label("Events & Actions");
|
Label headline = new Label("Events & Actions");
|
||||||
headline.getStyleClass().add("settings-group-label");
|
headline.getStyleClass().add("settings-group-label");
|
||||||
grid.add(headline, 0, 0);
|
add(headline, 0, 0);
|
||||||
|
|
||||||
actionTable = createActionTable();
|
actionTable = createActionTable();
|
||||||
ScrollPane scrollPane = new ScrollPane(actionTable);
|
ScrollPane scrollPane = new ScrollPane(actionTable);
|
||||||
scrollPane.setFitToHeight(true);
|
scrollPane.setFitToHeight(true);
|
||||||
scrollPane.setFitToWidth(true);
|
scrollPane.setFitToWidth(true);
|
||||||
scrollPane.setStyle("-fx-background-color: -fx-background");
|
scrollPane.setStyle("-fx-background-color: -fx-background");
|
||||||
grid.add(scrollPane, 0, 1);
|
add(scrollPane, 0, 1);
|
||||||
|
GridPane.setHgrow(scrollPane, Priority.ALWAYS);
|
||||||
|
|
||||||
Button add = new Button("Add");
|
Button add = new Button("Add");
|
||||||
add.setOnAction(this::add);
|
add.setOnAction(this::add);
|
||||||
|
@ -113,7 +112,7 @@ public class ActionSettingsPanel extends Pane {
|
||||||
delete.setDisable(true);
|
delete.setDisable(true);
|
||||||
HBox buttons = new HBox(5, add, delete);
|
HBox buttons = new HBox(5, add, delete);
|
||||||
buttons.setStyle("-fx-background-color: -fx-background"); // workaround so that the buttons don't shrink
|
buttons.setStyle("-fx-background-color: -fx-background"); // workaround so that the buttons don't shrink
|
||||||
grid.add(buttons, 0, 2);
|
add(buttons, 0, 2);
|
||||||
|
|
||||||
actionTable.getSelectionModel().getSelectedItems().addListener((ListChangeListener<EventHandlerConfiguration>) change -> delete.setDisable(change.getList().isEmpty()));
|
actionTable.getSelectionModel().getSelectedItems().addListener((ListChangeListener<EventHandlerConfiguration>) change -> delete.setDisable(change.getList().isEmpty()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,10 +35,10 @@ import javafx.scene.input.KeyCode;
|
||||||
import javafx.scene.input.KeyEvent;
|
import javafx.scene.input.KeyEvent;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Priority;
|
||||||
import javafx.stage.FileChooser;
|
import javafx.stage.FileChooser;
|
||||||
|
|
||||||
public class IgnoreList extends Pane {
|
public class IgnoreList extends GridPane {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(IgnoreList.class);
|
private static final Logger LOG = LoggerFactory.getLogger(IgnoreList.class);
|
||||||
|
|
||||||
|
@ -53,14 +53,13 @@ public class IgnoreList extends Pane {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createGui() {
|
private void createGui() {
|
||||||
GridPane grid = new GridPane();
|
setHgap(10);
|
||||||
grid.setHgap(10);
|
setVgap(10);
|
||||||
grid.setVgap(10);
|
setPadding(new Insets(20, 10, 10, 10));
|
||||||
grid.setPadding(new Insets(20, 150, 10, 10));
|
|
||||||
|
|
||||||
Label headline = new Label("Ignore List");
|
Label headline = new Label("Ignore List");
|
||||||
headline.getStyleClass().add("settings-group-label");
|
headline.getStyleClass().add("settings-group-label");
|
||||||
grid.add(headline, 0, 0);
|
add(headline, 0, 0);
|
||||||
|
|
||||||
ignoreListView = new ListView<>();
|
ignoreListView = new ListView<>();
|
||||||
ignoreListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
|
ignoreListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
|
||||||
|
@ -69,7 +68,8 @@ public class IgnoreList extends Pane {
|
||||||
removeSelectedModels();
|
removeSelectedModels();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
grid.add(ignoreListView, 0, 1);
|
add(ignoreListView, 0, 1);
|
||||||
|
GridPane.setHgrow(ignoreListView, Priority.ALWAYS);
|
||||||
|
|
||||||
Button remove = new Button("Remove");
|
Button remove = new Button("Remove");
|
||||||
remove.setOnAction(evt -> removeSelectedModels());
|
remove.setOnAction(evt -> removeSelectedModels());
|
||||||
|
@ -78,10 +78,8 @@ public class IgnoreList extends Pane {
|
||||||
Button importIgnoreList = new Button("Import");
|
Button importIgnoreList = new Button("Import");
|
||||||
importIgnoreList.setOnAction(e -> importIgnoreList());
|
importIgnoreList.setOnAction(e -> importIgnoreList());
|
||||||
HBox buttons = new HBox(10, remove, exportIgnoreList, importIgnoreList);
|
HBox buttons = new HBox(10, remove, exportIgnoreList, importIgnoreList);
|
||||||
grid.add(buttons, 0, 2);
|
add(buttons, 0, 2);
|
||||||
buttons.setStyle("-fx-background-color: -fx-background"); // workaround so that the buttons don't shrink
|
buttons.setStyle("-fx-background-color: -fx-background"); // workaround so that the buttons don't shrink
|
||||||
|
|
||||||
getChildren().add(grid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeSelectedModels() {
|
private void removeSelectedModels() {
|
||||||
|
|
Loading…
Reference in New Issue