mirror of https://github.com/BURAI-team/burai.git
update QEFXDesignerViewerController
This commit is contained in:
parent
eacbf24742
commit
54ac864079
|
@ -37,3 +37,10 @@
|
|||
-fx-opacity: 0.75;
|
||||
}
|
||||
|
||||
/* DesignerWindow */
|
||||
|
||||
.designerwin-pane {
|
||||
-fx-background-color: transparent;
|
||||
-fx-effect: dropshadow(gaussian, derive(black, 15.0%), 4.5, 0.15, 0.333333em, 0.5em);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<?import javafx.scene.layout.ColumnConstraints?>
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<?import javafx.scene.layout.RowConstraints?>
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
|
||||
|
||||
<BorderPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<BorderPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<center>
|
||||
<StackPane fx:id="basePane" BorderPane.alignment="CENTER">
|
||||
<StackPane fx:id="basePane" style="-fx-background-color: cyan;" BorderPane.alignment="CENTER">
|
||||
<children>
|
||||
<GridPane>
|
||||
<columnConstraints>
|
||||
|
@ -22,8 +21,8 @@
|
|||
<RowConstraints vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<Pane fx:id="primPane" prefHeight="200.0" prefWidth="300.0" GridPane.columnIndex="1" />
|
||||
<Pane fx:id="dualPane" prefHeight="200.0" prefWidth="300.0" GridPane.rowIndex="1" />
|
||||
<Pane fx:id="primPane" prefHeight="200.0" prefWidth="300.0" style="-fx-background-color: red;" GridPane.columnIndex="1" />
|
||||
<Pane fx:id="dualPane" prefHeight="200.0" prefWidth="300.0" style="-fx-background-color: blue;" GridPane.rowIndex="1" />
|
||||
</children>
|
||||
</GridPane>
|
||||
</children>
|
||||
|
|
|
@ -48,8 +48,10 @@ public class QEFXDesignerViewerController extends QEFXAppController {
|
|||
|
||||
this.projectController = projectController;
|
||||
|
||||
this.atomsViewerPrim = new AtomsViewer(cell, AtomsAction.getAtomsViewerSize());
|
||||
this.atomsViewerDual = new AtomsViewer(cell, AtomsAction.getAtomsViewerSize());
|
||||
this.atomsViewerPrim = new AtomsViewer(cell, AtomsAction.getAtomsViewerSize(), true);
|
||||
this.atomsViewerDual = new AtomsViewer(cell, AtomsAction.getAtomsViewerSize(), true);
|
||||
|
||||
this.atomsViewerPrim.linkAtomsViewer(this.atomsViewerDual);
|
||||
}
|
||||
|
||||
public Design getDesign() {
|
||||
|
@ -68,6 +70,8 @@ public class QEFXDesignerViewerController extends QEFXAppController {
|
|||
return;
|
||||
}
|
||||
|
||||
this.primPane.setPrefWidth(500.0);
|
||||
this.primPane.setPrefHeight(500.0);
|
||||
this.primPane.getChildren().clear();
|
||||
|
||||
if (this.atomsViewerPrim != null) {
|
||||
|
@ -81,12 +85,14 @@ public class QEFXDesignerViewerController extends QEFXAppController {
|
|||
return;
|
||||
}
|
||||
|
||||
this.dualPane.setPrefWidth(0.0);
|
||||
this.dualPane.setPrefHeight(0.0);
|
||||
this.dualPane.getChildren().clear();
|
||||
|
||||
if (this.atomsViewerDual != null) {
|
||||
this.atomsViewerDual.bindSceneTo(this.dualPane);
|
||||
this.dualPane.getChildren().add(this.atomsViewerDual);
|
||||
}
|
||||
// if (this.atomsViewerDual != null) {
|
||||
// this.atomsViewerDual.bindSceneTo(this.dualPane);
|
||||
// this.dualPane.getChildren().add(this.atomsViewerDual);
|
||||
// }
|
||||
}
|
||||
|
||||
private void setupBasePane() {
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.Group?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.ToolBar?>
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<?import javafx.scene.layout.ColumnConstraints?>
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<?import javafx.scene.layout.RowConstraints?>
|
||||
|
||||
<Group fx:id="baseGroup" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<BorderPane styleClass="designerwin-pane">
|
||||
<top>
|
||||
<GridPane>
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<ToolBar nodeOrientation="RIGHT_TO_LEFT" style="-fx-background-color: transparent;" BorderPane.alignment="CENTER" GridPane.columnIndex="1">
|
||||
<items>
|
||||
<Button fx:id="scaleButton" mnemonicParsing="false" styleClass="piclight-button" text="\@" />
|
||||
</items>
|
||||
</ToolBar>
|
||||
</children>
|
||||
<BorderPane.margin>
|
||||
<Insets left="4.0" right="4.0" />
|
||||
</BorderPane.margin>
|
||||
</GridPane>
|
||||
</top>
|
||||
<center>
|
||||
<Pane fx:id="mainPane" prefHeight="400.0" prefWidth="400.0" BorderPane.alignment="CENTER" />
|
||||
</center>
|
||||
</BorderPane>
|
||||
</children>
|
||||
</Group>
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright (C) 2016 Satomichi Nishihara
|
||||
*
|
||||
* This file is distributed under the terms of the
|
||||
* GNU General Public License. See the file `LICENSE'
|
||||
* in the root directory of the present distribution,
|
||||
* or http://www.gnu.org/copyleft/gpl.txt .
|
||||
*/
|
||||
|
||||
package burai.app.project.viewer.designer;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import burai.app.QEFXAppComponent;
|
||||
import burai.app.project.QEFXProjectController;
|
||||
import burai.atoms.viewer.AtomsViewer;
|
||||
|
||||
public class QEFXDesignerWindow extends QEFXAppComponent<QEFXDesignerWindowController> {
|
||||
|
||||
public QEFXDesignerWindow(QEFXProjectController projectController, AtomsViewer atomsViewer) throws IOException {
|
||||
super("QEFXDesignerWindow.fxml", new QEFXDesignerWindowController(projectController, atomsViewer));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
* Copyright (C) 2016 Satomichi Nishihara
|
||||
*
|
||||
* This file is distributed under the terms of the
|
||||
* GNU General Public License. See the file `LICENSE'
|
||||
* in the root directory of the present distribution,
|
||||
* or http://www.gnu.org/copyleft/gpl.txt .
|
||||
*/
|
||||
|
||||
package burai.app.project.viewer.designer;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import burai.app.QEFXAppController;
|
||||
import burai.app.project.QEFXProjectController;
|
||||
import burai.atoms.viewer.AtomsViewer;
|
||||
import burai.com.graphic.svg.SVGLibrary;
|
||||
import burai.com.graphic.svg.SVGLibrary.SVGData;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Tooltip;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
|
||||
public class QEFXDesignerWindowController extends QEFXAppController {
|
||||
|
||||
private static final double INSETS_SIZE = 2.0;
|
||||
|
||||
private static final double GRAPHIC_SIZE = 20.0;
|
||||
private static final String GRAPHIC_CLASS = "piclight-button";
|
||||
|
||||
private QEFXProjectController projectController;
|
||||
|
||||
private AtomsViewer atomsViewer;
|
||||
|
||||
@FXML
|
||||
private Group baseGroup;
|
||||
|
||||
@FXML
|
||||
private Pane mainPane;
|
||||
|
||||
@FXML
|
||||
private Button scaleButton;
|
||||
|
||||
public QEFXDesignerWindowController(QEFXProjectController projectController, AtomsViewer atomsViewer) {
|
||||
super(projectController == null ? null : projectController.getMainController());
|
||||
|
||||
if (projectController == null) {
|
||||
throw new IllegalArgumentException("projectController is null.");
|
||||
}
|
||||
|
||||
if (atomsViewer == null) {
|
||||
throw new IllegalArgumentException("atomsViewer is null.");
|
||||
}
|
||||
|
||||
this.projectController = projectController;
|
||||
|
||||
this.atomsViewer = atomsViewer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
this.setupBaseGroup();
|
||||
this.setupMainPane();
|
||||
this.setupScaleButton();
|
||||
}
|
||||
|
||||
private void setupBaseGroup() {
|
||||
if (this.baseGroup == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
StackPane.setMargin(this.baseGroup, new Insets(INSETS_SIZE));
|
||||
StackPane.setAlignment(this.baseGroup, Pos.BOTTOM_LEFT);
|
||||
}
|
||||
|
||||
private void setupMainPane() {
|
||||
if (this.mainPane == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.mainPane.setPrefWidth(500.0);
|
||||
this.mainPane.setPrefHeight(500.0);
|
||||
this.mainPane.getChildren().clear();
|
||||
|
||||
if (this.atomsViewer != null) {
|
||||
this.atomsViewer.bindSceneTo(this.mainPane);
|
||||
this.mainPane.getChildren().add(this.atomsViewer);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupScaleButton() {
|
||||
if (this.scaleButton == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.updateScaleButton(true);
|
||||
}
|
||||
|
||||
private void updateScaleButton(boolean toMaximize) {
|
||||
if (this.scaleButton == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (toMaximize) {
|
||||
this.scaleButton.setText("");
|
||||
this.scaleButton.setTooltip(new Tooltip("maximize"));
|
||||
this.scaleButton.setGraphic(
|
||||
SVGLibrary.getGraphic(SVGData.MAXIMIZE, GRAPHIC_SIZE, null, GRAPHIC_CLASS));
|
||||
|
||||
} else {
|
||||
this.scaleButton.setText("");
|
||||
this.scaleButton.setTooltip(new Tooltip("minimize"));
|
||||
this.scaleButton.setGraphic(
|
||||
SVGLibrary.getGraphic(SVGData.MINIMIZE, GRAPHIC_SIZE, null, GRAPHIC_CLASS));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue