use of eu.hansolo.tilesfx.Tile in project Smartcity-Smarthouse by TechnionYP5777.
the class Controller method updateTile.
private void updateTile(WidgetType type, final String path, Integer position) {
log.info("creating tile for: type=[" + type + "], path=[" + path + "], pos=[" + position + "]");
final BasicWidget w;
try {
w = (BasicWidget) type.getImplementingClass().getConstructor(type.getClass()).newInstance(type);
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
e.printStackTrace();
return;
}
Tile tile = w.getTile();
setTileEventHandlers(tile, position);
pane.getChildren().set(position, tile);
if (path == null || "".equals(path))
return;
fileSystem.subscribe((rPath, data) -> {
log.info("dashbord rquested to be notified on " + path + " got notified on (p,d)=(" + rPath + "," + data + ").");
if (rPath.equals(path))
w.updateExisting(Double.valueOf((String) data), path);
}, path);
}
use of eu.hansolo.tilesfx.Tile in project Smartcity-Smarthouse by TechnionYP5777.
the class TempDashboard method updateTile.
public void updateTile(String type) {
switch(type) {
case "Clock":
Tile clockTile = TileBuilder.create().prefSize(150, 150).skinType(SkinType.CLOCK).title("Clock Tile").text("Whatever text").dateVisible(true).locale(Locale.US).running(true).build();
clockTile.setOnMouseClicked(e -> {
openConfiguration();
});
pane.getChildren().set(lastLoc, clockTile);
case "Numeric":
break;
case "Pie Chart":
break;
default:
break;
}
}
use of eu.hansolo.tilesfx.Tile in project Smartcity-Smarthouse by TechnionYP5777.
the class ConfigurationController method setListeners.
private static void setListeners(final BasicWidget widget) {
Tile t = widget.getTile();
t.setOnMouseEntered(e -> {
if (!chosenColor.equals(t.getForegroundColor()))
t.setForegroundBaseColor(enteredTileColor);
});
t.setOnMouseExited(e -> {
if (!chosenColor.equals(t.getForegroundColor()))
t.setForegroundBaseColor(normalTileColor);
});
t.setOnMouseClicked(e -> {
chosenType = widget.getType();
widgets.get(widget.getTitle()).stream().forEach(otherT -> otherT.getTile().setForegroundBaseColor(normalTileColor));
t.setForegroundBaseColor(chosenColor);
});
}
use of eu.hansolo.tilesfx.Tile in project Smartcity-Smarthouse by TechnionYP5777.
the class Controller method initialize.
@Override
public void initialize(final URL location, final ResourceBundle __) {
pane.setPrefSize(1200, 800);
List<Tile> tiles = new ArrayList<>();
for (int i = 0; i < ROWS_NUM * TILES_IN_ROW; ++i) {
final Integer loc = i;
final Tile t = TileBuilder.create().prefSize(TILE_SIZE, TILE_SIZE).skinType(SkinType.TEXT).description("Choose a widget:\nClick me!\t\t").descriptionAlignment(Pos.CENTER).textVisible(true).build();
setTileEventHandlers(t, loc);
tiles.add(t);
}
pane.getChildren().addAll(tiles);
pane.setBackground(new Background(new BackgroundFill(Tile.BACKGROUND.darker(), null, null)));
// pane.setPadding(new Insets(5));
// pane.setPrefHeight((TILE_SIZE+8)*ROWS_NUM);
// pane.setPrefWidth((TILE_SIZE+8)*TILES_IN_ROW);
}
Aggregations