package fi.lpam.gui.elementit; import fi.lpam.Main; import javafx.geometry.Insets; import javafx.scene.control.Tab; import javafx.scene.layout.*; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.FontWeight; import java.util.Properties; /** * Käyttöliittymän välilehden pohja */ public class TabPohja extends Tab { public static Insets INSETS; public static Border BORDER = new Border(new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, new CornerRadii(5), BorderWidths.DEFAULT)); public static String STYLE; public static String TV_COLUMN_STYLE; public static Font BUTTON_FONT; public static Font TEKSTI_FONT; public static double SPACING; protected BorderPane root = new BorderPane(); public TabPohja(String title) { super(title); Properties prop = Main.properties; INSETS = new Insets(Double.parseDouble(prop.getProperty("insets"))); SPACING = Double.parseDouble(prop.getProperty("insets")); STYLE = "-fx-background-color: " + prop.getProperty("taustaVari"); TV_COLUMN_STYLE = "-fx-alignment: CENTER;" + "-fx-font-size: " + Main.properties.getProperty("tekstiFonttiKoko") + "px;" + "-fx-font-family: " + Main.properties.getProperty("tekstiFontti"); BUTTON_FONT = Font.font(prop.getProperty("buttonFontti"), FontWeight.BOLD, Double.parseDouble(prop.getProperty("buttonFonttiKoko"))); TEKSTI_FONT = Font.font(prop.getProperty("tekstiFontti"), FontWeight.NORMAL, Double.parseDouble(prop.getProperty("tekstiFonttiKoko"))); this.setStyle( "-fx-font-size: " + Main.properties.getProperty("buttonFonttiKoko") + "px;" + "-fx-font-weight: bold;" + "-fx-font-family: " + Main.properties.getProperty("buttonFontti") + ";" ); this.setClosable(false); this.setOnSelectionChanged(e -> {if (this.isSelected()) päivitä();}); root.setStyle(STYLE); root.setPadding(INSETS); root.setBorder(BORDER); this.setContent(root); } /** * Metodi, jota kutsutaan kun tähän välilehteen palataan * Luokan toteuttaja määrittää, mitä tarvitsee päivittää välilehteen palattaessa */ public void päivitä() {} }