use of com.jfoenix.controls.JFXTooltip in project JFoenix by jfoenixadmin.
the class MainController method init.
/**
* init fxml when loaded.
*/
@PostConstruct
public void init() throws Exception {
// init the title hamburger icon
final JFXTooltip burgerTooltip = new JFXTooltip("Open drawer");
drawer.setOnDrawerOpening(e -> {
final Transition animation = titleBurger.getAnimation();
burgerTooltip.setText("Close drawer");
animation.setRate(1);
animation.play();
});
drawer.setOnDrawerClosing(e -> {
final Transition animation = titleBurger.getAnimation();
burgerTooltip.setText("Open drawer");
animation.setRate(-1);
animation.play();
});
titleBurgerContainer.setOnMouseClicked(e -> {
if (drawer.isClosed() || drawer.isClosing()) {
drawer.open();
} else {
drawer.close();
}
});
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/ui/popup/MainPopup.fxml"));
loader.setController(new InputController());
toolbarPopup = new JFXPopup(loader.load());
optionsBurger.setOnMouseClicked(e -> toolbarPopup.show(optionsBurger, PopupVPosition.TOP, PopupHPosition.RIGHT, -12, 15));
JFXTooltip.setVisibleDuration(Duration.millis(3000));
JFXTooltip.install(titleBurgerContainer, burgerTooltip, Pos.BOTTOM_CENTER);
// create the inner flow and content
context = new ViewFlowContext();
// set the default controller
Flow innerFlow = new Flow(ButtonController.class);
final FlowHandler flowHandler = innerFlow.createHandler(context);
context.register("ContentFlowHandler", flowHandler);
context.register("ContentFlow", innerFlow);
final Duration containerAnimationDuration = Duration.millis(320);
drawer.setContent(flowHandler.start(new ExtendedAnimatedFlowContainer(containerAnimationDuration, SWIPE_LEFT)));
context.register("ContentPane", drawer.getContent().get(0));
// side controller will add links to the content flow
Flow sideMenuFlow = new Flow(SideMenuController.class);
final FlowHandler sideMenuFlowHandler = sideMenuFlow.createHandler(context);
drawer.setSidePane(sideMenuFlowHandler.start(new ExtendedAnimatedFlowContainer(containerAnimationDuration, SWIPE_LEFT)));
}
Aggregations