use of javafx.geometry.Rectangle2D in project kanonizo by kanonizo.
the class KanonizoFrame method initialize.
@Override
public void initialize(URL location, ResourceBundle resources) {
assert sourceTree != null : "fx:id sourceTree was not injected";
this.fw = Framework.getInstance();
fw.addPropertyChangeListener(Framework.ROOT_FOLDER_PROPERTY_NAME, (e) -> {
File newRoot = (File) e.getNewValue();
rootFolderTextField.setText(newRoot.getAbsolutePath());
sourceTree.setRoot(GuiUtils.createDynamicFileTree(newRoot));
testTree.setRoot(GuiUtils.createDynamicFileTree(newRoot));
});
fw.addPropertyChangeListener(Framework.ALGORITHM_PROPERTY_NAME, (e) -> {
SearchAlgorithm alg = (SearchAlgorithm) e.getNewValue();
// remove existing children
paramLayout.getChildren().clear();
addParams(alg, paramLayout, true);
addErrors(alg);
});
fw.addPropertyChangeListener(Framework.INSTRUMENTER_PROPERTY_NAME, (e) -> {
org.kanonizo.framework.instrumentation.Instrumenter inst = (org.kanonizo.framework.instrumentation.Instrumenter) e.getNewValue();
instParamLayout.getChildren().clear();
addParams(inst, instParamLayout, false);
addErrors(inst);
});
fw.addPropertyChangeListener(Framework.LIBS_PROPERTY_NAME, (e) -> {
libs.getItems().add((File) e.getNewValue());
});
fw.setDisplay(this);
Screen main = Screen.getPrimary();
Rectangle2D bounds = main.getVisualBounds();
rootFolderTextField.setText(fw.getRootFolder().getAbsolutePath());
addSourceListeners();
addTestListeners();
addLibListeners();
selectRoot.setOnAction(ev -> selectRoot());
try {
algorithmChoices.getItems().addAll(Framework.getAvailableAlgorithms());
algorithmChoices.setConverter(new ReadableConverter());
algorithmChoices.valueProperty().addListener((ov, t, t1) -> {
SearchAlgorithm alg = (SearchAlgorithm) ov.getValue();
fw.setAlgorithm(alg);
});
algorithmChoices.getSelectionModel().select(fw.getAlgorithm());
instrumenterChoices.getItems().addAll(Framework.getAvailableInstrumenters());
instrumenterChoices.setConverter(new ReadableConverter());
instrumenterChoices.valueProperty().addListener((ov, t, t1) -> {
org.kanonizo.framework.instrumentation.Instrumenter inst = (org.kanonizo.framework.instrumentation.Instrumenter) ov.getValue();
fw.setInstrumenter(inst);
});
instrumenterChoices.getSelectionModel().select(fw.getInstrumenter());
} catch (Exception e) {
e.printStackTrace();
}
}
use of javafx.geometry.Rectangle2D in project DeskChan by DeskChan.
the class SeparateStage method resizeToDesktopSize.
protected void resizeToDesktopSize() {
Rectangle2D rect = getDesktopSize();
setX(rect.getMinX());
setY(rect.getMinY());
setWidth(rect.getWidth());
setHeight(rect.getHeight());
}
use of javafx.geometry.Rectangle2D in project DeskChan by DeskChan.
the class Character method setDefaultPosition.
@Override
public void setDefaultPosition() {
Rectangle2D screenBounds = Screen.getPrimary().getVisualBounds();
setPosition(new Point2D(screenBounds.getMaxX() - getWidth(), screenBounds.getMaxY() - getHeight()));
}
use of javafx.geometry.Rectangle2D in project DeskChan by DeskChan.
the class MovablePane method getCurrentPositionStorageKey.
private String getCurrentPositionStorageKey() {
if (positionStorageID == null) {
return null;
}
final StringBuilder key = new StringBuilder();
final Rectangle2D desktopSize = OverlayStage.getDesktopSize();
key.append(positionStorageID);
if (positionRelativeToDesktopSize) {
key.append('.');
key.append(desktopSize.getMinX());
key.append('_');
key.append(desktopSize.getMinY());
key.append('_');
key.append(desktopSize.getWidth());
key.append('_');
key.append(desktopSize.getHeight());
}
return key.toString();
}
use of javafx.geometry.Rectangle2D in project FXyzLib by Birdasaur.
the class Skybox method loadSingleImageViewports.
/**
* this will layout the viewports to this style pattern
* ____
* |top |
* ____|____|____ ____
* |left|fwd |rght|back|
* |____|____|____|____|
* |bot |
* |____|
*/
private void loadSingleImageViewports() {
layoutViews();
double width = singleImg.getWidth(), height = singleImg.getHeight();
// simple chack to see if cells will be square
if (width / 4 != height / 3) {
throw new UnsupportedOperationException("Image does not comply with size constraints");
}
double cellSize = singleImg.getWidth() - singleImg.getHeight();
recalculateSize(cellSize);
double topx = cellSize, topy = 0, botx = cellSize, boty = cellSize * 2, leftx = 0, lefty = cellSize, rightx = cellSize * 2, righty = cellSize, fwdx = cellSize, fwdy = cellSize, backx = cellSize * 3, backy = cellSize;
// add top padding x+, y+, width-, height
top.setViewport(new Rectangle2D(topx, topy, cellSize, cellSize));
// add left padding x, y+, width, height-
left.setViewport(new Rectangle2D(leftx, lefty, cellSize - 1, cellSize - 1));
// add front padding x+, y+, width-, height
back.setViewport(new Rectangle2D(fwdx, fwdy, cellSize, cellSize));
// add right padding x, y+, width, height-
right.setViewport(new Rectangle2D(rightx, righty, cellSize, cellSize));
// add back padding x, y+, width, height-
front.setViewport(new Rectangle2D(backx + 1, backy - 1, cellSize - 1, cellSize - 1));
// add bottom padding x+, y, width-, height-
bottom.setViewport(new Rectangle2D(botx, boty, cellSize, cellSize));
for (ImageView v : views) {
v.setImage(singleImg);
// System.out.println(v.getId() + v.getViewport() + cellSize);
}
}
Aggregations