下面列出了javafx.scene.layout.AnchorPane#setBottomAnchor ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public void setOverlayTop(VBox progress) {
// TODO Auto-generated method stub
progressBar.getChildren().clear();
progressBar.getChildren().add(progress);
AnchorPane.setTopAnchor(progress, 0.0);
AnchorPane.setLeftAnchor(progress, 0.0);
AnchorPane.setRightAnchor(progress, 0.0);
AnchorPane.setBottomAnchor(progress, 0.0);
}
private Axis createCenterYAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
Axis axis = new Axis(Orientation.VERTICAL, Position.CENTER);
axis.setMinValue(MIN);
axis.setMaxValue(MAX);
axis.setPrefWidth(AXIS_WIDTH);
axis.setAutoScale(AUTO_SCALE);
AnchorPane.setTopAnchor(axis, 0d);
AnchorPane.setBottomAnchor(axis, 25d);
AnchorPane.setLeftAnchor(axis, axis.getZeroPosition());
return axis;
}
private Axis createBottomXAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
Axis axis = new Axis(MIN, MAX, Orientation.HORIZONTAL, AxisType.LOGARITHMIC, Position.BOTTOM);
axis.setPrefHeight(AXIS_WIDTH);
axis.setAutoScale(AUTO_SCALE);
AnchorPane.setBottomAnchor(axis, 0d);
AnchorPane.setLeftAnchor(axis, 25d);
AnchorPane.setRightAnchor(axis, 25d);
return axis;
}
public final void setExampleCode(String code) {
SamplePage samplePage = new SamplePage(code);
codePane.getChildren().setAll(samplePage);
AnchorPane.setBottomAnchor(samplePage, 5d);
AnchorPane.setTopAnchor(samplePage, 5d);
AnchorPane.setLeftAnchor(samplePage, 5d);
AnchorPane.setRightAnchor(samplePage, 5d);
}
private Axis createBottomXAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
Axis axis = new Axis(Orientation.HORIZONTAL, Position.BOTTOM);
axis.setMinValue(MIN);
axis.setMaxValue(MAX);
axis.setPrefHeight(AXIS_WIDTH);
axis.setAutoScale(AUTO_SCALE);
AnchorPane.setBottomAnchor(axis, 0d);
AnchorPane.setLeftAnchor(axis, 25d);
AnchorPane.setRightAnchor(axis, 25d);
return axis;
}
void showModbusTrendDialog(EventResolver eventResolver) throws Exception {
FXMLLoader loader = FXMLLoaderFactory.modbusTrendLoader();
AnchorPane page = (AnchorPane) loader.getRoot();
// Create the dialog Stage.
Stage dialogStage = new Stage(StageStyle.DECORATED);
dialogStage.setTitle(DesignerLocalizer.instance().getLangString("modbus.event.trend"));
dialogStage.initModality(Modality.NONE);
Scene scene = new Scene(page);
dialogStage.setScene(scene);
// get the controller
ModbusTrendController modbusTrendController = loader.getController();
modbusTrendController.setDialogStage(dialogStage);
modbusTrendController.setApp(this);
// add the trend chart
SplitPane chartPane = modbusTrendController.initializeTrend();
AnchorPane.setBottomAnchor(chartPane, 50.0);
AnchorPane.setLeftAnchor(chartPane, 5.0);
AnchorPane.setRightAnchor(chartPane, 5.0);
AnchorPane.setTopAnchor(chartPane, 50.0);
page.getChildren().add(0, chartPane);
// set the script resolver
modbusTrendController.setEventResolver(eventResolver);
// connect to the database server
modbusTrendController.createModbusMaster();
// show the window
modbusTrendController.getDialogStage().show();
}
private Axis createRightYAxis(final double MIN, final double MAX, final boolean AUTO_SCALE, final double AXIS_WIDTH) {
Axis axis = new Axis(Orientation.VERTICAL, Position.RIGHT);
axis.setMinValue(MIN);
axis.setMaxValue(MAX);
axis.setPrefWidth(AXIS_WIDTH);
axis.setAutoScale(AUTO_SCALE);
AnchorPane.setRightAnchor(axis, 0d);
AnchorPane.setTopAnchor(axis, 0d);
AnchorPane.setBottomAnchor(axis, AXIS_WIDTH);
return axis;
}
private Axis createRightYAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
Axis axis = new Axis(Orientation.VERTICAL, Position.RIGHT);
axis.setMinValue(MIN);
axis.setMaxValue(MAX);
axis.setPrefWidth(AXIS_WIDTH);
axis.setAutoScale(AUTO_SCALE);
AnchorPane.setRightAnchor(axis, 0d);
AnchorPane.setTopAnchor(axis, 0d);
AnchorPane.setBottomAnchor(axis, 25d);
return axis;
}
public void setOverlayTopRight(JogWidget walkWidget) {
// TODO Auto-generated method stub
walkingBox.getChildren().clear();
walkingBox.getChildren().add(walkWidget);
AnchorPane.setTopAnchor(walkWidget, 0.0);
AnchorPane.setLeftAnchor(walkWidget, 0.0);
AnchorPane.setRightAnchor(walkWidget, 0.0);
AnchorPane.setBottomAnchor(walkWidget, 0.0);
}
private void addScrollPane() {
scrollPane = new ScrollPane();
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scrollPane.setFitToWidth(true);
scrollPane.setFitToHeight(true);
AnchorPane.setLeftAnchor(scrollPane, 0d);
AnchorPane.setTopAnchor(scrollPane, 0d);
AnchorPane.setRightAnchor(scrollPane, 0d);
AnchorPane.setBottomAnchor(scrollPane, 0d);
root.getChildren().add(scrollPane);
}
void showOpcUaTrendDialog(EventResolver eventResolver) throws Exception {
// Load the fxml file and create a new stage for the pop-up dialog.
FXMLLoader loader = FXMLLoaderFactory.opcUaTrendLoader();
AnchorPane page = (AnchorPane) loader.getRoot();
// Create the dialog Stage.
Stage dialogStage = new Stage(StageStyle.DECORATED);
dialogStage.setTitle(DesignerLocalizer.instance().getLangString("opc.ua.trend"));
dialogStage.initModality(Modality.NONE);
// dialogStage.initOwner(primaryStage);
Scene scene = new Scene(page);
dialogStage.setScene(scene);
// get the controller
OpcUaTrendController opcUaTrendController = loader.getController();
opcUaTrendController.setDialogStage(dialogStage);
opcUaTrendController.setApp(this);
// add the trend chart
SplitPane chartPane = opcUaTrendController.initializeTrend();
opcUaTrendController.setUpdatePeriodMsec(eventResolver.getUpdatePeriod());
AnchorPane.setBottomAnchor(chartPane, 50.0);
AnchorPane.setLeftAnchor(chartPane, 5.0);
AnchorPane.setRightAnchor(chartPane, 5.0);
AnchorPane.setTopAnchor(chartPane, 50.0);
page.getChildren().add(0, chartPane);
// set the script resolver
opcUaTrendController.setScriptResolver(eventResolver);
// show the window
opcUaTrendController.getDialogStage().show();
}
private Axis createLeftYAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
Axis axis = new Axis(Orientation.VERTICAL, Position.LEFT);
axis.setMinValue(MIN);
axis.setMaxValue(MAX);
axis.setPrefWidth(AXIS_WIDTH);
axis.setAutoScale(AUTO_SCALE);
AnchorPane.setTopAnchor(axis, 0d);
AnchorPane.setBottomAnchor(axis, 25d);
AnchorPane.setLeftAnchor(axis, 0d);
return axis;
}
void showMessagingTrendDialog(EventResolver eventResolver) throws Exception {
// Load the fxml file
FXMLLoader loader = FXMLLoaderFactory.messagingTrendLoader();
AnchorPane page = (AnchorPane) loader.getRoot();
// Create the dialog Stage.
Stage dialogStage = new Stage(StageStyle.DECORATED);
dialogStage.setTitle(DesignerLocalizer.instance().getLangString("rmq.event.trend"));
dialogStage.initModality(Modality.NONE);
Scene scene = new Scene(page);
dialogStage.setScene(scene);
// get the controller
RmqTrendController messagingTrendController = loader.getController();
messagingTrendController.setDialogStage(dialogStage);
messagingTrendController.setApp(this);
// add the trend chart
SplitPane chartPane = messagingTrendController.initializeTrend();
AnchorPane.setBottomAnchor(chartPane, 50.0);
AnchorPane.setLeftAnchor(chartPane, 5.0);
AnchorPane.setRightAnchor(chartPane, 5.0);
AnchorPane.setTopAnchor(chartPane, 50.0);
page.getChildren().add(0, chartPane);
// set the script resolver
messagingTrendController.setEventResolver(eventResolver);
// subscribe to broker
messagingTrendController.subscribeToDataSource();
// show the window
messagingTrendController.getDialogStage().show();
}
void showJMSTrendDialog(EventResolver eventResolver) throws Exception {
// Load the fxml file
FXMLLoader loader = FXMLLoaderFactory.jmsTrendLoader();
AnchorPane page = (AnchorPane) loader.getRoot();
// Create the dialog Stage.
Stage dialogStage = new Stage(StageStyle.DECORATED);
dialogStage.setTitle(DesignerLocalizer.instance().getLangString("jms.event.trend"));
dialogStage.initModality(Modality.NONE);
Scene scene = new Scene(page);
dialogStage.setScene(scene);
// get the controller
JmsTrendController jmsTrendController = loader.getController();
jmsTrendController.setDialogStage(dialogStage);
jmsTrendController.setApp(this);
// add the trend chart
SplitPane chartPane = jmsTrendController.initializeTrend();
AnchorPane.setBottomAnchor(chartPane, 50.0);
AnchorPane.setLeftAnchor(chartPane, 5.0);
AnchorPane.setRightAnchor(chartPane, 5.0);
AnchorPane.setTopAnchor(chartPane, 50.0);
page.getChildren().add(0, chartPane);
// set the script resolver
jmsTrendController.setEventResolver(eventResolver);
// subscribe to broker
jmsTrendController.subscribeToDataSource();
// show the window
jmsTrendController.getDialogStage().show();
}
@Override public void init() {
xAxisBottom = new Axis(0, 1000, Orientation.HORIZONTAL, AxisType.LOGARITHMIC, Position.BOTTOM);
xAxisBottom.setPrefHeight(20);
AnchorPane.setLeftAnchor(xAxisBottom, 20d);
AnchorPane.setRightAnchor(xAxisBottom, 20d);
AnchorPane.setBottomAnchor(xAxisBottom, 0d);
yAxisLeft = new Axis(0, 1000, Orientation.VERTICAL, AxisType.LOGARITHMIC, Position.LEFT);
yAxisLeft.setPrefWidth(20);
AnchorPane.setLeftAnchor(yAxisLeft, 0d);
AnchorPane.setTopAnchor(yAxisLeft, 20d);
AnchorPane.setBottomAnchor(yAxisLeft, 20d);
}
public static void anchorFirmly(Node node) {
AnchorPane.setLeftAnchor(node, 0.);
AnchorPane.setRightAnchor(node, 0.);
AnchorPane.setBottomAnchor(node, 0.);
AnchorPane.setTopAnchor(node, 0.);
}
private AnchorPane createBisqDAOContent() {
AnchorPane anchorPane = new AnchorPane();
anchorPane.setMinWidth(373);
GridPane bisqDAOPane = new GridPane();
AnchorPane.setTopAnchor(bisqDAOPane, 0d);
bisqDAOPane.setVgap(5);
bisqDAOPane.setMaxWidth(373);
int rowIndex = 0;
TitledGroupBg theBisqDaoTitledGroup = addTitledGroupBg(bisqDAOPane, rowIndex, 3, Res.get("dao.news.bisqDAO.title"));
theBisqDaoTitledGroup.getStyleClass().addAll("last", "dao-news-titled-group");
Label daoTeaserContent = addMultilineLabel(bisqDAOPane, ++rowIndex, Res.get("dao.news.bisqDAO.description"));
daoTeaserContent.getStyleClass().add("dao-news-teaser");
Hyperlink hyperlink = addHyperlinkWithIcon(bisqDAOPane, ++rowIndex, Res.get("dao.news.bisqDAO.readMoreLink"), "https://bisq.network/docs/dao");
hyperlink.getStyleClass().add("dao-news-link");
GridPane pastContributorsPane = new GridPane();
AnchorPane.setBottomAnchor(pastContributorsPane, 0d);
pastContributorsPane.setVgap(5);
pastContributorsPane.setMaxWidth(373);
rowIndex = 0;
TitledGroupBg contributorsTitledGroup = addTitledGroupBg(pastContributorsPane, rowIndex, 4, Res.get("dao.news.pastContribution.title"));
contributorsTitledGroup.getStyleClass().addAll("last", "dao-news-titled-group");
Label pastContributionDescription = addMultilineLabel(pastContributorsPane, ++rowIndex, Res.get("dao.news.pastContribution.description"));
pastContributionDescription.getStyleClass().add("dao-news-content");
Tuple3<Label, BsqAddressTextField, VBox> tuple = addLabelBsqAddressTextField(pastContributorsPane, ++rowIndex,
Res.get("dao.news.pastContribution.yourAddress"),
Layout.FIRST_ROW_DISTANCE);
addressTextField = tuple.second;
Button requestNowButton = addPrimaryActionButton(pastContributorsPane, ++rowIndex, Res.get("dao.news.pastContribution.requestNow"), 0);
requestNowButton.setMaxWidth(Double.MAX_VALUE);
GridPane.setHgrow(requestNowButton, Priority.ALWAYS);
requestNowButton.setOnAction(e -> GUIUtil.openWebPage("https://bisq.network/docs/dao/genesis"));
anchorPane.getChildren().addAll(bisqDAOPane, pastContributorsPane);
return anchorPane;
}
public Interpreter(ArmSimulator simulator) {
try {
mainPane = FXMLLoader.load(getClass().getResource("/resources/ConsoleView.fxml"));
} catch (IOException e) {
e.printStackTrace();
}
this.simulator = simulator;
this.dockNode = new DockNode(mainPane, "Interpreter");
this.mainPane.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
this.dockNode.getStylesheets().add("/resources/style.css");
ScrollPane scrollPane = (ScrollPane) mainPane.lookup("#scrollPane");
this.textField = new TextField();
this.textField.setId("consoleInput");
this.mainPane.getChildren().add(this.textField);
AnchorPane.setBottomAnchor(this.textField, (double)0);
AnchorPane.setLeftAnchor(this.textField, (double)23);
AnchorPane.setRightAnchor(this.textField, (double)0);
this.textFlow = new TextFlow();
this.textFlow.setPadding(new Insets(5));
this.textFlow.setId("textConsole");
scrollPane.setContent(this.textFlow);
output = new OutputStream() {
private StringBuffer currentLine = new StringBuffer();
@Override
public void write(int b) throws IOException {
this.currentLine.append((char)b);
if (b == '\n') {
Platform.runLater(() -> {
textFlow.getChildren().add(new Text(currentLine.toString()));
this.currentLine.setLength(0);
scrollPane.setVvalue(scrollPane.getHmax());
});
}
}
};
}
/**
* Creates a new instance of a console and redirect the java output to it
*/
public ConsoleView() {
try {
mainPane = FXMLLoader.load(getClass().getResource("/resources/ConsoleView.fxml"));
} catch (IOException e) {
e.printStackTrace();
}
this.dockNode = new DockNode(mainPane, "Console", new ImageView(dockImage));
this.dockNode.setPrefSize(1000, 1500);
this.dockNode.setClosable(false);
dockNode.setMaxHeight(300); //mmm
this.mainPane.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
this.dockNode.getStylesheets().add("/resources/style.css");
ScrollPane scrollPane = (ScrollPane) mainPane.lookup("#scrollPane");
this.textField = new TextField();
this.textField.setId("consoleInput");
this.mainPane.getChildren().add(this.textField);
AnchorPane.setBottomAnchor(this.textField, (double)0);
AnchorPane.setLeftAnchor(this.textField, (double)23);
AnchorPane.setRightAnchor(this.textField, (double)0);
this.textFlow = new TextFlow();
this.textFlow.setPadding(new Insets(5));
this.textFlow.setId("textConsole");
scrollPane.setContent(this.textFlow);
output = new OutputStream() {
private ConcurrentLinkedQueue<Character> consoleBuffer = new ConcurrentLinkedQueue<>();
@Override
public void write(int b) throws IOException {
this.consoleBuffer.add((char)b);
if (b == '\n') {
ArrayList<Byte> list = new ArrayList<>();
while (!this.consoleBuffer.peek().equals('\n')) {
list.add((byte) (char) this.consoleBuffer.poll());
}
list.add((byte) (char) this.consoleBuffer.poll());
String currentLine = new String(Bytes.toArray(list), "ASCII");
Platform.runLater(() -> {
textFlow.getChildren().add(new Text(currentLine));
scrollPane.setVvalue(scrollPane.getHmax());
if (textFlow.getChildren().size() > 100) {
textFlow.getChildren().clear();
}
});
}
}
};
}
protected TradeStepView(PendingTradesViewModel model) {
this.model = model;
preferences = model.dataModel.preferences;
trade = model.dataModel.getTrade();
checkNotNull(trade, "Trade must not be null at TradeStepView");
ScrollPane scrollPane = new ScrollPane();
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
scrollPane.setFitToHeight(true);
scrollPane.setFitToWidth(true);
AnchorPane.setLeftAnchor(scrollPane, 10d);
AnchorPane.setRightAnchor(scrollPane, 10d);
AnchorPane.setTopAnchor(scrollPane, 10d);
AnchorPane.setBottomAnchor(scrollPane, 0d);
getChildren().add(scrollPane);
gridPane = new GridPane();
gridPane.setHgap(Layout.GRID_GAP);
gridPane.setVgap(Layout.GRID_GAP);
ColumnConstraints columnConstraints1 = new ColumnConstraints();
columnConstraints1.setHgrow(Priority.ALWAYS);
ColumnConstraints columnConstraints2 = new ColumnConstraints();
columnConstraints2.setHgrow(Priority.ALWAYS);
gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
scrollPane.setContent(gridPane);
AnchorPane.setLeftAnchor(this, 0d);
AnchorPane.setRightAnchor(this, 0d);
AnchorPane.setTopAnchor(this, -10d);
AnchorPane.setBottomAnchor(this, 0d);
addContent();
errorMessageListener = (observable, oldValue, newValue) -> {
if (newValue != null)
new Popup().error(newValue).show();
};
clockListener = new ClockWatcher.Listener() {
@Override
public void onSecondTick() {
}
@Override
public void onMinuteTick() {
updateTimeLeft();
}
};
}