Skip to content

Improving detaching tabs#5

Open
eatpasta02 wants to merge 6 commits intorecruitment-2026from
improving-detaching-tabs
Open

Improving detaching tabs#5
eatpasta02 wants to merge 6 commits intorecruitment-2026from
improving-detaching-tabs

Conversation

@eatpasta02
Copy link
Copy Markdown

Now tabs can be detached between windows

modified: src/main/java/pl/edu/pwr/pwrinspace/poliwrocket/Controller/DetachedTabController.java
few changes, logic the same

modified:   src/main/java/pl/edu/pwr/pwrinspace/poliwrocket/Controller/MainController.java

added methods for detaching tabs - setupDetachedWindowsProvider, configureTabContextMenu,detachTabToNewWindow , and changed the warning in findAndStyleTiles

created:    src/main/java/pl/edu/pwr/pwrinspace/poliwrocket/Provider/DetachedWindowsProvider.java

added a class used for managing all active tab panes, has a method for transfering tabs

modified:   src/main/resources/Views/DetachedTabView.fxml

added TabPane

modified:   src/main/resources/Views/constants.css

changes for ContextMenu

modified:   src/main/resources/Views/constantsLight.css

changes for ContextMenu

…DetachedTabController.java

        used for scaling detached window

new file:   src/main/resources/Views/DetachedTabView.fxml
    new View with an empty anchorPane

modified:   src/main/java/pl/edu/pwr/pwrinspace/poliwrocket/Controller/MainController.java
    added methods responsible for detaching tab (detaching and detachTab) and calling detaching in initialize()
    and methods responsible for changing mode to light or dark(applyStyleToNode, findAndStyleTiles, applyTileStyle, applyGaugeStyle) and using them in invalidated()

modified:   src/main/java/pl/edu/pwr/pwrinspace/poliwrocket/Controller/SettingsController.java
    added method onToggleLightMode that uses Configuration

modified:   src/main/java/pl/edu/pwr/pwrinspace/poliwrocket/Main.java
    not adding DetachedTabView to loaders

modified:   src/main/java/pl/edu/pwr/pwrinspace/poliwrocket/Model/Configuration/Configuration.java
    adding field lightMode and method setLightMode to use observable in MainController

modified:   src/main/resources/Views/SettingsView.fxml
    added toggle button to switch between modes(light dark)

modified:   src/main/resources/Views/constants.css
new file:   src/main/resources/Views/constantsLight.css
    to switch between css when changing mode(light dark)
…DetachedTabController.java

        used for scaling detached window

new file:   src/main/resources/Views/DetachedTabView.fxml
    new View with an empty anchorPane

modified:   src/main/java/pl/edu/pwr/pwrinspace/poliwrocket/Controller/MainController.java
    added methods responsible for detaching tab (detaching and detachTab) and calling detaching in initialize()
    and methods responsible for changing mode to light or dark(applyStyleToNode, findAndStyleTiles, applyTileStyle, applyGaugeStyle) and using them in invalidated()

modified:   src/main/java/pl/edu/pwr/pwrinspace/poliwrocket/Controller/SettingsController.java
    added method onToggleLightMode that uses Configuration

modified:   src/main/java/pl/edu/pwr/pwrinspace/poliwrocket/Main.java
    not adding DetachedTabView to loaders

modified:   src/main/java/pl/edu/pwr/pwrinspace/poliwrocket/Model/Configuration/Configuration.java
    adding field lightMode and method setLightMode to use observable in MainController

modified:   src/main/resources/Views/SettingsView.fxml
    added toggle button to switch between modes(light dark)

modified:   src/main/resources/Views/constants.css
new file:   src/main/resources/Views/constantsLight.css
    to switch between css when changing mode(light dark)
…wanie taba z glownego okna, usuniecie linijki z readme(z path javafx), ustawienie glownego okna na caly ekran
…/DetachedTabController.java

few changes, logic the same

    modified:   src/main/java/pl/edu/pwr/pwrinspace/poliwrocket/Controller/MainController.java
added methods for detaching tabs - setupDetachedWindowsProvider, configureTabContextMenu,detachTabToNewWindow , and changed the warning in findAndStyleTiles

    created:    src/main/java/pl/edu/pwr/pwrinspace/poliwrocket/Provider/DetachedWindowsProvider.java
added a class used for managing all active tab panes, has a method for transfering tabs

    modified:   src/main/resources/Views/DetachedTabView.fxml
added TabPane

    modified:   src/main/resources/Views/constants.css
changes for ContextMenu
    modified:   src/main/resources/Views/constantsLight.css
changes for ContextMenu
Comment on lines 484 to 495
for (Node n : root.getChildrenUnmodifiable()) {
if (n instanceof Tile) {
Tile tile = (Tile) n;
applyTileStyle(tile, bg, fg);
}else if (n instanceof Gauge){
}else if (n instanceof Gauge) {
Gauge gauge = (Gauge) n;
applyGaugeStyle(gauge, fg);
}else{
System.out.println("Node ignored for styling: " + n.getClass().getSimpleName());
}if (n.getClass().getName().startsWith("pl.edu.pwr") &&
!(n instanceof Tile || n instanceof Gauge || n instanceof Parent)) {
System.out.println("Unpredicted node ignored for styling:: " + n.getClass().getSimpleName());
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Można tutaj dodać końcowe else

targetIndex = (int) tab.getUserData();
}

sourceTabPane.getTabs().remove(tab);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dodajmy sprawdzenie czy sourceTabPane nie jest null

@@ -8,4 +8,8 @@

<AnchorPane fx:id="rootPane" maxHeight="-1.0" maxWidth="-1.0" prefHeight="1080.0" prefWidth="1920.0" style="-fx-background-image: url('background.jpg'); -fx-background-size: stretch; -fx-background-color: grey;" stylesheets="@constants.css" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="pl.edu.pwr.pwrinspace.poliwrocket.Controller.DetachedTabController">
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tutaj mamy troszkę inne wymiary sceny niż w controllerze

Comment on lines 18 to 19
private static final double initWidth = 1550.4;
private static final double initHeight = 838.4;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mamy już 2 miejsca, w ktorych pojawiaja się te wartości. Można zrobić wspólne miejsce do jej przechowywania

Comment on lines 64 to 75
.jfx-button {
-jfx-button-type: FLAT;
-fx-background-color: -inspace-base-border-color;
-fx-text-fill: black;
}

/*Raised button example */
.jfx-button {
-jfx-button-type: RAISED;
-fx-background-color: -inspace-base-border-color;
-fx-text-fill: black;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jak to działa,  że mamy 2 różne przyciski, które tak samo się nazywaja?

if (tabPane != null) {
DetachedWindowsProvider.addActiveTabPane(tabPane);
}
for(int i = 0; i < Objects.requireNonNull(tabPane).getTabs().size(); i++) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Można to wciągnąc pod pierwszego ifa, który właśnie sprawdza czy tabPane nie jest nullem i na koniec dodać else jakiś z informacja o tym, ze tabPane jest nullem

}else{
targetTabPane.getTabs().add(tab);
}
targetTabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A czemu tak robimy?

Copy link
Copy Markdown

@kasprzakewa kasprzakewa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kilka uwag i pytań + do rozwiązania konflikty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants