private void initGoButton() { goButton = new Button("Go"); goButton.setLayoutX( ConfigManager.getInt(ConfigManager.scope(this.getClass().getName(), "go-x"))); goButton.setLayoutY( ConfigManager.getInt(ConfigManager.scope(this.getClass().getName(), "go-y"))); root.getChildren().add(goButton); }
private void initXmlList() { xmlLoader = new ComboBox<String>(); xmlLoader.setPromptText("XML File to Load"); xmlLoader.setEditable(true); xmlLoader.setLayoutX( ConfigManager.getInt(ConfigManager.scope(this.getClass().getName(), "xml-x"))); xmlLoader.setLayoutY( ConfigManager.getInt(ConfigManager.scope(this.getClass().getName(), "xml-y"))); xmlLoader.setVisibleRowCount(3); root.getChildren().add(xmlLoader); }
@Override protected void init() { WIDTH = ConfigManager.getInt(ConfigManager.scope(this.getClass().getName(), "width"), 800); HEIGHT = ConfigManager.getInt(ConfigManager.scope(this.getClass().getName(), "height"), 400); root = new Group(); scene = new Scene(root, WIDTH, HEIGHT); initIconList(); initTitle(); initXmlList(); initGoButton(); click(iconList.get(0)); }
private void initIconList() { iconList = new ArrayList<Icon>(); List<String> iconNames = ConfigManager.getStringList(ConfigManager.scope(this.getClass().getName(), "iconNames")); int offset = WIDTH / iconNames.size() / 2; for (String s : iconNames) { Icon toAdd = new Icon(s, offset, iconNames.size()); iconList.add(toAdd); root.getChildren().add(toAdd); offset = offset + WIDTH / iconNames.size(); } }
private void handleAction() { if (xmlLoader.getValue() != null) { AbstractGrid newScreen = ConfigManager.getAbstractGrid( ConfigManager.getString( ConfigManager.scope(this.getClass().getName(), selected.iconName)), xmlLoader.getValue()); nextScreen = newScreen; } else { Alert uhoh = new Alert(AlertType.ERROR); uhoh.setTitle("whoops"); uhoh.setContentText("please select an XML file"); uhoh.showAndWait(); } }
private Icon(String s, int xOffset, int numberOfIcons) { xmlList = ConfigManager.getStringList(ConfigManager.scope(s, "xmlList")); Image img = new Image( getClass() .getClassLoader() .getResourceAsStream(ConfigManager.getString(ConfigManager.scope(s, "image")))); image = new ImageView(img); image.setFitWidth(WIDTH / (numberOfIcons * 3 / 2)); image.setPreserveRatio(true); image.setSmooth(true); image.setCache(true); setGraphic(image); setLayoutY( ConfigManager.getInt(ConfigManager.scope(this.getClass().getName(), "yPos"), HEIGHT / 3)); setLayoutX(xOffset - (image.getBoundsInParent().getWidth() + 18) / 2); iconName = s; }