本文整理汇总了Java中com.gluonhq.charm.glisten.application.MobileApplication类的典型用法代码示例。如果您正苦于以下问题:Java MobileApplication类的具体用法?Java MobileApplication怎么用?Java MobileApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MobileApplication类属于com.gluonhq.charm.glisten.application包,在下文中一共展示了MobileApplication类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFloatingActionButtons
import com.gluonhq.charm.glisten.application.MobileApplication; //导入依赖的package包/类
private Layer createFloatingActionButtons() {
callActionButton = Util.createFAB(MaterialDesignIcon.CALL, e -> {
Dialog confirmCallDialog = new Dialog(OTNBundle.getString("OTN.VENUE.CALLDIALOG.TITLE"), OTNBundle.getString("OTN.VENUE.CALLDIALOG.CONTENT", getVenue().getName(), getVenue().getPhoneNumber())) {
{
rootNode.setPrefWidth(MobileApplication.getInstance().getView().getScene().getWidth() * 0.9);
}
};
Button cancel = new Button(OTNBundle.getString("OTN.VENUE.CALLDIALOG.NO"));
Button ok = new Button(OTNBundle.getString("OTN.VENUE.CALLDIALOG.YES"));
cancel.setOnAction(event -> confirmCallDialog.hide());
ok.setOnAction(event -> {
Services.get(DialerService.class).ifPresent(d -> d.call(getVenue().getPhoneNumber()));
confirmCallDialog.hide();
});
confirmCallDialog.getButtons().addAll(cancel, ok);
confirmCallDialog.showAndWait();
});
webActionButton = Util.createWebLaunchFAB(() -> getVenue().getUrl());
webActionButton.getStyleClass().add("secondary");
webActionButton.attachTo(callActionButton, Side.TOP);
return callActionButton.getLayer();
}
示例2: ImageViewLayer
import com.gluonhq.charm.glisten.application.MobileApplication; //导入依赖的package包/类
public ImageViewLayer(Image image) {
this.glassPane = MobileApplication.getInstance().getGlassPane();
this.glassPane.getLayers().add(this);
this.image = image;
this.imageView = new ImageView(image);
this.imageView.setScaleX(0);
this.imageView.setScaleY(0);
this.imageView.setVisible(false);
this.imageView.setPreserveRatio(true);
this.imageView.setOnMouseClicked(e -> {
hide();
dispose();
});
// if the image is wider than it is tall, then rotate 90 degrees so it displays better on
// mobile phones
configureImageView();
this.getChildren().add(imageView);
setBackgroundFade(Layer.DEFAULT_BACKGROUND_FADE_LEVEL);
setAutoHide(true);
}
示例3: MediaService
import com.gluonhq.charm.glisten.application.MobileApplication; //导入依赖的package包/类
public MediaService() {
MobileApplication.getInstance().addLayerFactory(POPUP_NAME, () -> {
imageView = new ImageView();
imageView.setFitHeight(50);
imageView.setPreserveRatio(true);
HBox adsBox = new HBox(imageView);
adsBox.getStyleClass().add("mediaBox");
return new SidePopupView(adsBox, Side.BOTTOM, false);
});
Services.get(LifecycleService.class).ifPresent(service -> {
service.addListener(LifecycleEvent.PAUSE, this::stopExecutor);
service.addListener(LifecycleEvent.RESUME, this::startExecutor);
});
startExecutor();
}
示例4: registerViewsAndDrawer
import com.gluonhq.charm.glisten.application.MobileApplication; //导入依赖的package包/类
public static void registerViewsAndDrawer(MobileApplication app) {
for (AppView view : REGISTRY.getViews()) {
view.registerView(app);
}
avatar = new Avatar();
Services.get(DisplayService.class).ifPresent(d -> {
if (d.isTablet()) {
avatar.getStyleClass().add("tablet");
}
});
NavigationDrawer.Header header = new NavigationDrawer.Header("Gluon Mobile",
"The Comments App", avatar);
drawerManager = new DrawerManager(app, header, REGISTRY.getViews());
drawerManager.installDrawer();
}
示例5: DrawerManager
import com.gluonhq.charm.glisten.application.MobileApplication; //导入依赖的package包/类
public DrawerManager(MobileApplication app, Node header, Collection<AppView> views) {
super(app, header, views);
service = Injector.instantiateModelOrService(Service.class);
for (Node item : getDrawer().getItems()) {
if (item instanceof NavigationDrawer.ViewItem &&
((NavigationDrawer.ViewItem) item).getViewName().equals(EDITION_VIEW.getId())) {
item.disableProperty().bind(service.userProperty().isNull());
break;
}
}
service.userProperty().addListener((obs, ov, nv) -> avatar.setImage(getAvatarImage()));
avatar.setImage(getAvatarImage());
}
示例6: RubikView
import com.gluonhq.charm.glisten.application.MobileApplication; //导入依赖的package包/类
public RubikView(String name) {
super(name);
rubik = new Rubik();
setCenter(rubik.getSubScene());
timer = new Timeline(
new KeyFrame(Duration.ZERO,
e -> clock.set(LocalTime.now().minusNanos(time.toNanoOfDay()).format(fmt))),
new KeyFrame(Duration.seconds(1)));
timer.setCycleCount(Animation.INDEFINITE);
timeLabel = new Label();
timeLabel.setStyle("-fx-text-fill: white; -fx-font-size: 0.9em;");
timeLabel.textProperty().bind(clock);
rubik.isSolved().addListener((ov,b,b1)->{
if(b1){
timer.stop();
MobileApplication.getInstance().showMessage("Solved in " + (rubik.getCount().get() + 1) + " movements!");
}
});
getStylesheets().add(RubikView.class.getResource("rubik.css").toExternalForm());
addEventHandler(MouseEvent.ANY, rubik.eventHandler);
}
示例7: apply
import com.gluonhq.charm.glisten.application.MobileApplication; //导入依赖的package包/类
private void apply() {
// update predicate with new search rules
updateSearchPredicate();
updateFilterApplied();
draftFilter.clear();
MobileApplication.getInstance().hideLayer(POPUP_FILTER_SESSIONS_MENU);
}
示例8: logOut
import com.gluonhq.charm.glisten.application.MobileApplication; //导入依赖的package包/类
@Override
public boolean logOut() {
loggedOut = false;
Dialog<Button> dialog = new Dialog<>();
Placeholder logoutDialogContent = new Placeholder("Confirm Logout", OTNBundle.getString("OTN.LOGOUT_DIALOG.CONTENT"), MaterialDesignIcon.HELP);
// FIXME: Too narrow Dialogs in Glisten
logoutDialogContent.setPrefWidth(MobileApplication.getInstance().getView().getScene().getWidth() - 40);
dialog.setContent(logoutDialogContent);
Button yesButton = new Button(OTNBundle.getString("OTN.LOGOUT_DIALOG.YES"));
Button noButton = new Button(OTNBundle.getString("OTN.LOGOUT_DIALOG.NO"));
yesButton.setOnAction(e -> {
loggedOut = removeAuthenticatedUser();
if (loggedOut) {
authenticatedUserId = "";
}
dialog.hide();
});
noButton.setOnAction(e -> dialog.hide());
dialog.getButtons().addAll(noButton, yesButton);
dialog.showAndWait();
return loggedOut;
}
示例9: main
import com.gluonhq.charm.glisten.application.MobileApplication; //导入依赖的package包/类
/**
* The main method to be called when the app starts on desktop MUST BE CALLED FROM EXTENDER
*
* @param args
*/
public static void main(@NotNull String[] args) {
//TODO submit to javafx
//TODO search for lowest extender with algorithm instead of just order
Log.debug("initializing");
Class<? extends Application> lastWorking = QuarkFXApplication.class;
Field f;
try {
f = ClassLoader.class.getDeclaredField("classes");
f.setAccessible(true);
//TODO: is suppress warning really necessary? Are there better ways?
@SuppressWarnings("unchecked") List<Class> classes = (List<Class>) f.get(ClassLoader.getSystemClassLoader());
for (Class c : classes) {
if (!c.equals(IGluon.class) && !c.equals(MobileApplication.class) && !c.equals(Application.class)) {
Log.debug("checking class: " + c.getSimpleName());
if (QuarkFXApplication.class.isAssignableFrom(c)) {
Log.debug("Found one: " + c.getSimpleName());
lastWorking = c;
} else {
break;
}
}
}
} catch (@NotNull NoSuchFieldException | IllegalAccessException e) {
Log.exception(QuarkFXApplication.class.getSimpleName(), "Error finding extending Class", e);
}
Log.debug("final caller: " + lastWorking.getSimpleName());
if (lastWorking.equals(QuarkFXApplication.class) || lastWorking.equals(MobileApplication.class) || lastWorking.equals(Application.class)) {
throw new YouDidShitException("could not determine extending class, did you forget to do it?");
}
if (args.length == 0 || args[0] == null || args[0].isEmpty()) {
Application.launch(lastWorking);
return;
}
QuarkFXApplication.args = args;
Application.launch(lastWorking);
}
示例10: updateAppBar
import com.gluonhq.charm.glisten.application.MobileApplication; //导入依赖的package包/类
@Override
protected void updateAppBar(AppBar appBar) {
appBar.setNavIcon(MaterialDesignIcon.ARROW_BACK.button(evt -> MobileApplication.getInstance().switchToPreviousView()));
trapProperty.addListener((obs, oldV, newV) -> {
if (newV != null) {
appBar.setTitleText("Trap "+newV.getNumber());
}
});
appBar.setTitleText("Trap "+trapProperty.get().getNumber());
}
示例11: LoadingLayer
import com.gluonhq.charm.glisten.application.MobileApplication; //导入依赖的package包/类
public LoadingLayer() {
setAutoHide(false);//Prevent users from removing the loading screen by pressing anywhere
spinner.setRadius(radius);
getChildren().add(spinner);
MobileApplication.getInstance().getGlassPane().getLayers().add(this);
setBackgroundFade(GlassPane.DEFAULT_BACKGROUND_FADE_LEVEL);
}
示例12: layoutChildren
import com.gluonhq.charm.glisten.application.MobileApplication; //导入依赖的package包/类
@Override
public void layoutChildren() {
spinner.setVisible(isShowing());
if (!isShowing()) {
return;
}
spinner.resizeRelocate(
(MobileApplication.getInstance().getGlassPane().getWidth() - radius*2)/2,
(MobileApplication.getInstance().getGlassPane().getHeight()- radius*2)/2,
radius*2, radius*2);
}
示例13: initialize
import com.gluonhq.charm.glisten.application.MobileApplication; //导入依赖的package包/类
public void initialize() {
imageView.setRotate(90);
control.showingProperty().addListener((obs, ov, nv) -> {
if (nv) {
AppBar appBar = MobileApplication.getInstance().getAppBar();
appBar.setNavIcon(MaterialDesignIcon.ARROW_BACK.button(e -> MobileApplication.getInstance().goHome()));
appBar.setTitleText("TRIP Mobile ControlBoard");
appBar.getActionItems().addAll(
MaterialDesignIcon.CAMERA.button(e -> start()),
MaterialDesignIcon.STOP.button(e -> stop()));
}
});
buttonUp.setOnAction(e -> {
System.out.println("Up");
endpoint.sendMessage("F");
});
buttonLeft.setOnAction(e -> {
System.out.println("Left");
endpoint.sendMessage("L");
});
buttonRight.setOnAction(e -> {
System.out.println("Right");
endpoint.sendMessage("R");
});
buttonDown.setOnAction(e -> {
System.out.println("Down");
endpoint.sendMessage("B");
});
buttonStop.setOnAction(e -> {
System.out.println("Stop");
endpoint.sendMessage("S");
});
}
示例14: initialize
import com.gluonhq.charm.glisten.application.MobileApplication; //导入依赖的package包/类
public void initialize() {
final Label labelTrip = new Label("TRIP");
labelTrip.getStyleClass().add("title");
final Label labelSubtitle = new Label("Test Robotics IoT Platform");
labelSubtitle.getStyleClass().add("subtitle");
VBox vBox1 = new VBox(20, labelTrip, new ImageView(new Image(getClass().getResourceAsStream("FullSizeRender.jpg"))), labelSubtitle);
vBox1.setAlignment(Pos.CENTER);
vBox1.setPadding(new Insets(10));
HBox hBox = new HBox(20,
new ImageView(new Image(getClass().getResourceAsStream("[email protected]"), 64, 64, true, true)),
new ImageView(new Image(getClass().getResourceAsStream("/icon.png"), 64, 64, true, true)));
hBox.setAlignment(Pos.CENTER);
final Label labelAuthors = new Label("Mark Heckler & José Pereda");
labelAuthors.getStyleClass().add("authors");
VBox vBox2 = new VBox(20, hBox, labelAuthors);
vBox2.setAlignment(Pos.CENTER);
vBox2.setPadding(new Insets(10));
cardPane.getCards().addAll(vBox1, vBox2);
home.showingProperty().addListener((obs, ov, nv) -> {
if (nv) {
AppBar appBar = MobileApplication.getInstance().getAppBar();
appBar.setNavIcon(MaterialDesignIcon.MENU.button(e -> MobileApplication.getInstance().showLayer(MENU_LAYER)));
appBar.setTitleText("TRIP Mobile Dashboard");
}
});
}
示例15: startExecutor
import com.gluonhq.charm.glisten.application.MobileApplication; //导入依赖的package包/类
private void startExecutor() {
scheduler = Executors.newScheduledThreadPool(1);
scheduler.scheduleAtFixedRate(() -> {
Platform.runLater(() -> {
MobileApplication.getInstance().hideLayer(POPUP_NAME);
imageView.setImage(getMedia());
MobileApplication.getInstance().showLayer(POPUP_NAME);
});
}, 2, 20, TimeUnit.SECONDS);
}