Пример #1
0
 public Parent createContent() {
   ToolBar toolbar = new ToolBar();
   toolbar.getItems().add(new Button("Home"));
   toolbar.getItems().add(new Button("Options"));
   toolbar.getItems().add(new Button("Help"));
   return toolbar;
 }
Пример #2
0
 public void initView() {
   try {
     // check if 3d sample and on supported platform
     loadCode();
     // create code view
     WebView webView = getWebView();
     webView.setPrefWidth(300);
     engine.loadContent(htmlCode);
     ToolBar codeToolBar = new ToolBar();
     codeToolBar.setId("code-tool-bar");
     Button copyCodeButton = new Button("Copy Source");
     copyCodeButton.setOnAction(
         new EventHandler<ActionEvent>() {
           public void handle(ActionEvent actionEvent) {
             Map<DataFormat, Object> clipboardContent = new HashMap<DataFormat, Object>();
             clipboardContent.put(DataFormat.PLAIN_TEXT, rawCode);
             clipboardContent.put(DataFormat.HTML, htmlCode);
             Clipboard.getSystemClipboard().setContent(clipboardContent);
           }
         });
     codeToolBar.getItems().addAll(copyCodeButton);
     setTop(codeToolBar);
     setCenter(webView);
   } catch (Exception e) {
     e.printStackTrace();
     setCenter(new Text("Failed to create sample because of [" + e.getMessage() + "]"));
   }
 }
 public ToolBarSample() {
   super(200, 100);
   ToolBar toolbar = new ToolBar();
   toolbar.getItems().add(new Button("Home"));
   toolbar.getItems().add(new Button("Options"));
   toolbar.getItems().add(new Button("Help"));
   getChildren().add(toolbar);
 }
  @Override
  public void processContents(MElementContainer<MUIElement> container) {
    IPresentationEngine renderer =
        (IPresentationEngine) context.get(IPresentationEngine.class.getName());
    ToolBar toolbar = (ToolBar) container.getWidget();

    boolean isFirst = true;
    for (MUIElement element : container.getChildren()) {
      Node node = (Node) renderer.createGui(element);
      if (node != null) {
        if (!isFirst) {
          toolbar.getItems().add(new Separator());
        }
        toolbar.getItems().add(node);
        isFirst = false;
      }
    }
  }
 public void addPerspective(final Perspective perspective, Resources resources) {
   Command command = createCommand(perspective);
   FxToggleTool tool = FxToggleTool.create();
   tool.setCommand(command);
   PerspectiveToggle toggle = new ToolPerspectiveToggle(tool, resources);
   perspective.configureToggle(toggle);
   toolbar.getItems().add(tool.getNode());
   tool.registerWithGroup(buttonGroup);
 }
Пример #6
0
 private void setupToolbar(ToolBar toolBar) {
   toolBar.setOnMousePressed(
       new EventHandler<MouseEvent>() {
         @Override
         public void handle(MouseEvent event) {
           mouseDragOffsetX = event.getSceneX();
           mouseDragOffsetY = event.getSceneY();
         }
       });
   toolBar.setOnMouseDragged(
       new EventHandler<MouseEvent>() {
         @Override
         public void handle(MouseEvent event) {
           if (IrisWindow.isMac()) {
             Stage stage = (Stage) topPane.getScene().getWindow();
             stage.setX(event.getScreenX() - mouseDragOffsetX);
             stage.setY(event.getScreenY() - mouseDragOffsetY);
           }
         }
       });
 }
  @Override
  public void createWidget(MUIElement element, MElementContainer<MUIElement> parent) {
    if (!(element instanceof MTrimBar)) {
      return;
    }
    final MTrimBar trimBar = (MTrimBar) element;

    ToolBar toolBar = new ToolBar();

    switch (trimBar.getSide().getValue()) {
      case SideValue.TOP_VALUE:
      case SideValue.BOTTOM_VALUE:
        toolBar.setOrientation(Orientation.HORIZONTAL);
        break;
      case SideValue.LEFT_VALUE:
      case SideValue.RIGHT_VALUE:
        toolBar.setOrientation(Orientation.VERTICAL);
        break;
    }

    element.setWidget(toolBar);
  }
Пример #8
0
  private void createToolBar() {
    createUrlTextField();
    createShowConsoleButton();
    createShowAlertsButton();
    createFirebugButton();
    createScreenShotButton();
    createProxyRequestsButton();

    toolBar = new ToolBar();

    toolBar
        .getItems()
        .addAll(
            urlTextField,
            consoleToggleButton,
            showAlertsToggleButton,
            firebugButton,
            screenShotButton,
            proxyRequestsToggleButton);
  }
Пример #9
0
  public MyPortfolioTab(MyPortfolioProc p) {
    mpProc = p;
    root.getChildren().addAll(toolBar, mainTable, kmPanel);
    VBox.setVgrow(mainTable, Priority.ALWAYS);
    toolBar.getItems().addAll(portfolioBtn, ckShowGraphBox);
    splitPane.setOrientation(Orientation.VERTICAL);
    splitPane.getItems().addAll(root);
    final Stage parent = CandySimpleGuiMain.getInstance().getPrimaryStage();
    portfolioBtn.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent actionEvent) {
            if (portfolioDlg == null) {
              portfolioDlg = new PortfolioDlg(parent, true, "Edit Portfolio List");
            }
            portfolioDlg.sizeToScene();
            portfolioDlg.showAndWait();
            ArrayList<String> lst = portfolioDlg.getSymbolLst();
            if (lst != null) {
              processPortfolioLst(lst);
            }
          }
        });
    ckShowGraphBox.setSelected(false);
    ckShowGraphBox
        .selectedProperty()
        .addListener(
            new ChangeListener<Boolean>() {
              public void changed(
                  ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean newVal) {
                if (newVal) {
                  splitPane.getItems().addAll(chartBox);
                } else {
                  splitPane.getItems().remove(chartBox);
                }
              }
            });
    ckKeyStathBox.setSelected(false);
    ckKeyStathBox
        .selectedProperty()
        .addListener(
            new ChangeListener<Boolean>() {
              public void changed(
                  ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean newVal) {
                if (newVal) {
                  splitPane.getItems().addAll(chartBox);
                } else {
                  splitPane.getItems().remove(chartBox);
                }
              }
            });

    chartBox.getChildren().addAll(pieChart.getGUI(), lcChart);
    chartBox.setStyle("-fx-border-color: gray");
    HBox.setHgrow(lcChart, Priority.ALWAYS);

    setText(TAB_NAME);
    setContent(splitPane);
    setClosable(false);
    updateGuiData(mpProc.getGuiData());
    updatePieChart(mpProc.getPieChartData());
    updateLcChart(mpProc.getLcXData(), mpProc.getLcYData());
  }
Пример #10
0
  @Override
  public void start(Stage stage) throws Exception {

    // ----------MENU----------

    MenuBar menuBar = new MenuBar();

    Menu menuFile = new Menu("File");
    MenuItem menuItemPurchase = new MenuItem("New Purchase");
    MenuItem menuItemStore = new MenuItem("New Store");
    MenuItem menuItemCategory = new MenuItem("New Category");
    MenuItem menuItemExit = new MenuItem("Exit");
    menuFile.getItems().addAll(menuItemPurchase, menuItemStore, menuItemCategory, menuItemExit);

    Menu menuHelp = new Menu("Help");
    menuBar.getMenus().addAll(menuFile, menuHelp);

    // ----------TOOLBAR----------

    ToolBar toolBar = new ToolBar();
    Button buttonPurchase = new Button();
    Button buttonStore = new Button();
    Button buttonCategory = new Button();
    buttonPurchase.setGraphic(new ImageView("/pictures/purchase.png"));
    buttonStore.setGraphic(new ImageView("/pictures/store.png"));
    buttonCategory.setGraphic(new ImageView("/pictures/category.png"));
    toolBar.getItems().addAll(buttonPurchase, buttonStore, buttonCategory);

    buttonStore.setOnAction(
        new EventHandler<ActionEvent>() {

          public void handle(ActionEvent actionEvent) {
            Stage stage = new Stage();
            try {
              new StoreWindows().start(stage);
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        });

    // ----------WORKSPACE----------

    GridPane gridPane = new GridPane();
    gridPane.setAlignment(Pos.CENTER);
    gridPane.setVgap(10);
    gridPane.setHgap(10);
    gridPane.setPadding(new Insets(0, 25, 25, 0));

    Label storeLabel = new Label("Store: ");
    storeLabel.setId("simpleLabel");
    gridPane.add(storeLabel, 0, 1);

    final ComboBox<String> stores = new ComboBox<String>();
    gridPane.add(stores, 1, 1);

    Label categoryLabel = new Label("Category: ");
    categoryLabel.setId("simpleLabel");
    gridPane.add(categoryLabel, 2, 1);

    final ComboBox<String> categories = new ComboBox<String>();
    gridPane.add(categories, 3, 1);

    Button bCount = new Button("Count");
    HBox hBox = new HBox(10);
    hBox.setAlignment(Pos.BOTTOM_RIGHT);
    hBox.getChildren().add(bCount);
    gridPane.add(hBox, 4, 1);

    FlowPane flowPane1 = new FlowPane();
    flowPane1.setAlignment(Pos.CENTER);
    flowPane1.setPadding(new Insets(10, 25, 25, 10));

    final Text spentTitle = new Text("SPENT: ");
    spentTitle.setId("headline");
    flowPane1.getChildren().add(spentTitle);

    // ----------DATABASE----------

    Label statusLabel = new Label();
    DaoFactory daoFactory = new MySQLDaoFactory();
    try {
      Connection connection = daoFactory.getConnection();
      statusLabel.setText("Database connection: success");
      StoreDao storeDao = new MySQLStoreDao(connection);
      ArrayList<Store> storeList = (ArrayList) storeDao.getStores();
      for (Store store : storeList) {
        stores.getItems().add(store.getName());
      }
      CategoryDao categoryDao = new MySQLCategoryDao(connection);
      ArrayList<Category> categoryList = (ArrayList) categoryDao.getCategories();
      for (Category category : categoryList) {
        categories.getItems().add(category.getTitle());
      }
    } catch (SQLException e) {
      statusLabel.setText("Database connection: failed");
    }
    FlowPane footer = new FlowPane();

    footer.setPadding(new Insets(10, 10, 10, 10));
    footer.getChildren().add(statusLabel);

    bCount.setOnAction(
        new EventHandler<ActionEvent>() {

          public void handle(ActionEvent actionEvent) {
            try {
              PurchaseDao purchaseDao = new MySQLPurchaseDao(new MySQLDaoFactory().getConnection());
              spentTitle.setText(
                  "SPENT: " + purchaseDao.showSpent(stores.getValue(), categories.getValue()));
            } catch (SQLException e) {
              e.printStackTrace();
            }
          }
        });

    // ----------VIEW----------

    Scene scene = new Scene(new VBox(), 800, 600);
    scene.getStylesheets().add("css/style.css");
    ((VBox) scene.getRoot()).getChildren().addAll(menuBar, toolBar, gridPane, flowPane1, footer);

    stage.setScene(scene);
    stage.setTitle("Cash Organizer");
    stage.getIcons().add(new Image("pictures/icon.png"));
    stage.show();
  }
  /** Create and initialise the song panel. */
  public BasicSongPanel() {
    final VBox centrePanel = new VBox();
    transposeDialog = new TransposeDialog();
    GridPane topPanel = new GridPane();

    titleField = new TextField();
    GridPane.setHgrow(titleField, Priority.ALWAYS);
    Label titleLabel = new Label(LabelGrabber.INSTANCE.getLabel("title.label"));
    GridPane.setConstraints(titleLabel, 1, 1);
    topPanel.getChildren().add(titleLabel);
    titleLabel.setLabelFor(titleField);
    GridPane.setConstraints(titleField, 2, 1);
    topPanel.getChildren().add(titleField);

    authorField = new TextField();
    GridPane.setHgrow(authorField, Priority.ALWAYS);
    Label authorLabel = new Label(LabelGrabber.INSTANCE.getLabel("author.label"));
    GridPane.setConstraints(authorLabel, 1, 2);
    topPanel.getChildren().add(authorLabel);
    authorLabel.setLabelFor(authorField);
    GridPane.setConstraints(authorField, 2, 2);
    topPanel.getChildren().add(authorField);

    centrePanel.getChildren().add(topPanel);
    lyricsArea = new SpellTextArea();
    lyricsArea.setMaxHeight(Double.MAX_VALUE);

    final VBox mainPanel = new VBox();
    ToolBar lyricsToolbar = new ToolBar();
    transposeButton = getTransposeButton();
    nonBreakingLineButton = getNonBreakingLineButton();
    lyricsToolbar.getItems().add(transposeButton);
    lyricsToolbar.getItems().add(nonBreakingLineButton);
    lyricsToolbar.getItems().add(new Separator());
    Region spacer = new Region();
    HBox.setHgrow(spacer, Priority.ALWAYS);
    lyricsToolbar.getItems().add(spacer);
    dictSelector = new ComboBox<>();
    Tooltip.install(
        dictSelector, new Tooltip(LabelGrabber.INSTANCE.getLabel("dictionary.language.text")));
    for (Dictionary dict : DictionaryManager.INSTANCE.getDictionaries()) {
      dictSelector.getItems().add(dict);
    }
    dictSelector
        .selectionModelProperty()
        .get()
        .selectedItemProperty()
        .addListener(
            new ChangeListener<Dictionary>() {

              @Override
              public void changed(
                  ObservableValue<? extends Dictionary> ov, Dictionary t, Dictionary t1) {
                lyricsArea.setDictionary(dictSelector.getValue());
              }
            });

    dictSelector.getSelectionModel().select(QueleaProperties.get().getDictionary());
    lyricsToolbar.getItems().add(dictSelector);
    lyricsToolbar.getItems().add(getDictButton());
    VBox.setVgrow(mainPanel, Priority.ALWAYS);
    mainPanel.getChildren().add(lyricsToolbar);
    VBox.setVgrow(lyricsArea, Priority.ALWAYS);
    mainPanel.getChildren().add(lyricsArea);
    centrePanel.getChildren().add(mainPanel);
    setCenter(centrePanel);
  }