ModulesDashboardTile(Module module) {
   getStyleClass().addAll("dashboard-modules-tile");
   Label titleLabel = new Label(module.descriptor().getName());
   titleLabel.getStyleClass().add("dashboard-modules-tile-title");
   titleLabel.setGraphic(module.graphic());
   Label textLabel = new Label(module.descriptor().getDescription());
   textLabel.getStyleClass().add("dashboard-modules-tile-text");
   textLabel.setMinHeight(USE_PREF_SIZE);
   topTile.getChildren().addAll(titleLabel, textLabel);
   button.getStyleClass().add("dashboard-modules-invisible-button");
   button.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
   button.setOnAction(e -> eventStudio().broadcast(activeteModule(module.id())));
   armed.bind(button.armedProperty());
   VBox inner = new VBox(new StackPane(topTile, button));
   prefHeightProperty().bind(inner.heightProperty());
   setMaxHeight(USE_PREF_SIZE);
   setMinHeight(USE_PREF_SIZE);
   inner.getStyleClass().add("dashboard-modules-tile-inner");
   getChildren().add(inner);
   module
       .descriptor()
       .getSupportURL()
       .ifPresent(
           url -> {
             Button playButton = AwesomeDude.createIconButton(AwesomeIcon.YOUTUBE_PLAY, "");
             playButton.getStyleClass().add("pdfsam-toolbar-button");
             playButton.setOnAction(e -> eventStudio().broadcast(new OpenUrlRequest(url)));
             toolButtons.getChildren().add(playButton);
             toolButtons.getStyleClass().add("dashboard-modules-toolbar");
             inner.getChildren().add(toolButtons);
           });
 }
 public void deleteEmployee(EmployeeVO employeeVO) {
   LOG.info("Enter : deleteEmployee");
   try {
     DialogResponse response =
         Dialogs.showConfirmDialog(
             new Stage(),
             "Do you want to delete selected customer(s)",
             "Confirm",
             "Delete customer",
             DialogOptions.OK_CANCEL);
     if (response.equals(DialogResponse.OK)) {
       helpDAO.deleteEmployees(employeeVO);
       message.setText(CommonConstants.EMPLOYEE_DELETE_SUCCESS);
       message.getStyleClass().remove("failure");
       message.getStyleClass().add("success");
       message.setVisible(true);
       fillTableFromData();
     }
   } catch (Exception e) {
     message.setText(CommonConstants.FAILURE);
     message.getStyleClass().remove("success");
     message.getStyleClass().add("failure");
     message.setVisible(true);
     LOG.error(e.getMessage());
   }
   LOG.info("Exit : deleteEmployee");
 }
  public LibraryListCell(final EditorController ec) {
    super();
    this.editorController = ec;

    graphic.getStyleClass().add("list-cell-graphic"); // NOI18N
    classNameLabel.getStyleClass().add("library-classname-label"); // NOI18N
    qualifierLabel.getStyleClass().add("library-qualifier-label"); // NOI18N
    sectionLabel.getStyleClass().add("library-section-label"); // NOI18N

    graphic.getChildren().add(iconImageView);
    graphic.getChildren().add(classNameLabel);
    graphic.getChildren().add(qualifierLabel);
    graphic.getChildren().add(sectionLabel);

    final EventHandler<MouseEvent> mouseEventHandler =
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(final MouseEvent e) {
            handleMouseEvent(e);
          }
        };
    // Mouse events
    this.addEventHandler(MouseEvent.ANY, mouseEventHandler);

    setOnDragDetected(
        new EventHandler<MouseEvent>() {

          @Override
          public void handle(MouseEvent t) {
            //                System.out.println("LibraryListCell - setOnDragDetected.handle");
            final LibraryListItem listItem = LibraryListCell.this.getItem();
            final FXOMDocument fxomDocument = editorController.getFxomDocument();

            if ((listItem != null) && (fxomDocument != null)) {
              final ILibraryItem item = LibraryListCell.this.getItem().getLibItem();
              if (item != null) {
                final ListView<LibraryListItem> list = LibraryListCell.this.getListView();
                final Dragboard db = list.startDragAndDrop(TransferMode.COPY);

                final Window ownerWindow = getScene().getWindow();
                final LibraryDragSource dragSource =
                    new LibraryDragSource(
                        editorController.getDocumentWindowController().getFluidonFile(),
                        item,
                        fxomDocument,
                        ownerWindow);
                assert editorController.getDragController().getDragSource()
                    == null; // GG_INVERT cause exception
                editorController.getDragController().begin(dragSource);

                db.setContent(dragSource.makeClipboardContent());
                db.setDragView(dragSource.makeDragView());
              }
            }
          }
        });
  }
Example #4
0
 public FxComboView(MigPane parent, String name) {
   this.parent = parent;
   MigPane comboBody = new MigPane(LayoutUtils.fillWithoutInsets());
   comboBody.add(charms, new CC().wrap());
   comboBody.add(description, new CC().wrap());
   comboBody.add(buttonPanel, new CC().wrap());
   charms.getStyleClass().add("comboCharms");
   description.getStyleClass().add("comboDescription");
   titledCombo.setContent(comboBody);
   displayComboName(name);
 }
Example #5
0
 public void appendDescriptiveLine(String description) {
   String descriptionWithLineBreaks =
       insertLineBreakEveryXCharacters(description, "\n", DEFAULT_TOOLTIP_WIDTH);
   Label label = new Label(descriptionWithLineBreaks);
   label.getStyleClass().add("italicText");
   addAsLine(label);
 }
  public TextFieldWithCopyIcon() {
    Label copyIcon = new Label();
    copyIcon.setLayoutY(3);
    copyIcon.getStyleClass().add("copy-icon");
    Tooltip.install(copyIcon, new Tooltip("Copy to clipboard"));
    AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
    AnchorPane.setRightAnchor(copyIcon, 0.0);
    copyIcon.setOnMouseClicked(
        e -> {
          String text = getText();
          if (text != null && text.length() > 0) {
            String copyText;
            if (copyWithoutCurrencyPostFix) {
              String[] strings = text.split(" ");
              if (strings.length > 1) copyText = strings[0]; // exclude the BTC postfix
              else copyText = text;
            } else {
              copyText = text;
            }
            Utilities.copyToClipboard(copyText);
          }
        });
    textField = new TextField();
    textField.setEditable(false);
    textField.textProperty().bindBidirectional(text);
    AnchorPane.setRightAnchor(copyIcon, 5.0);
    AnchorPane.setRightAnchor(textField, 30.0);
    AnchorPane.setLeftAnchor(textField, 0.0);
    textField.focusTraversableProperty().set(focusTraversableProperty().get());
    // TODO app wide focus
    // focusedProperty().addListener((ov, oldValue, newValue) -> textField.requestFocus());

    getChildren().addAll(textField, copyIcon);
  }
  public MaterialToolbar() {
    getStyleClass().add("material-toolbar");
    mainIcon = new AnimatedIcon();
    mainIcon.setIconFill(Color.WHITE);

    changeViewAnimationCircle = new Circle();
    changeViewAnimationCircle.setOpacity(0);
    changeViewAnimationCircle.setManaged(false);

    currentTitle = new Label("Main");
    currentTitle.getStyleClass().add("material-toolbar-text");

    changeViewAnimationTitle = new Label();
    changeViewAnimationTitle.setOpacity(0);
    changeViewAnimationTitle.getStyleClass().add("material-toolbar-text");

    background = new Rectangle();
    background.setManaged(false);
    background.setFill(Color.DARKSLATEBLUE);

    backgroundClip = new Rectangle();
    backgroundClip.setFill(Color.BLACK);
    backgroundClip.xProperty().bind(background.xProperty());
    backgroundClip.yProperty().bind(background.yProperty());
    backgroundClip.widthProperty().bind(background.widthProperty());
    backgroundClip.heightProperty().bind(background.heightProperty());
    changeViewAnimationCircle.setClip(backgroundClip);

    actionBox = new HBox();
    actionBox.setSpacing(6);

    getChildren()
        .addAll(
            mainIcon,
            changeViewAnimationCircle,
            currentTitle,
            changeViewAnimationTitle,
            background,
            actionBox);

    background.toBack();
    changeViewAnimationCircle.toFront();
    changeViewAnimationTitle.toFront();
    currentTitle.toFront();
    mainIcon.toFront();
    actionBox.toFront();
  }
  public TitledBorder() {
    titleLabel.setText("default title");
    titleLabel.getStyleClass().add("bordered-titled-title");
    StackPane.setAlignment(titleLabel, Pos.TOP_CENTER);

    getStyleClass().add("bordered-titled-border");
    getChildren().addAll(titleLabel, contentPane);
  }
Example #9
0
 @Override
 protected void updateItem(final Tab tab, boolean empty) {
   super.updateItem(tab, empty);
   if (tab != null) {
     tab.getUnreadProperty()
         .addListener(
             new ChangeListener<Boolean>() {
               @Override
               public void changed(
                   ObservableValue<? extends Boolean> observableValue,
                   Boolean oldValue,
                   Boolean newValue) {
                 if (newValue) {
                   getStyleClass().add("unread");
                 } else {
                   getStyleClass().remove("unread");
                 }
               }
             });
     Entity entity = tab.getEntity();
     setPrefHeight(32);
     if (entity instanceof Server) {
       setPrefHeight(40);
       Label net = new Label("network");
       net.getStyleClass().add("network");
       VBox box = new VBox();
       Label name = new Label(entity.getName());
       name.getStyleClass().add("network-name");
       box.getChildren().addAll(net, name);
       setGraphic(box);
     } else if (entity instanceof Channel) {
       final Label label = new Label(entity.getName().substring(1));
       label.getStyleClass().add("name");
       final HBox box = new HBox();
       box.getChildren().addAll(FontAwesome.createIcon(FontAwesome.COMMENTS), label);
       setGraphic(box);
     } else if (entity instanceof User) {
       final Label label = new Label(entity.getName());
       label.getStyleClass().add("name");
       final HBox box = new HBox();
       box.getChildren().addAll(FontAwesome.createIcon(FontAwesome.USER), label);
       setGraphic(box);
     }
   }
 }
Example #10
0
 private VBox setUpTop() {
   topLabel = new Label("Лучший онлайн12 121 12 12121212 1212 12 12 12  кредит №" + counter++);
   topLabel.setWrapText(true);
   topLabel.getStyleClass().add("credit-view_top-label");
   topContainer = new VBox(topLabel);
   topContainer.getStyleClass().add("credit-view_top-container");
   this.setTop(topContainer);
   return topContainer;
 }
 private void configuraStileToolbar() {
   save.setId("tbb-save");
   this.setId("toolBar");
   this.setMinHeight(55);
   this.setMaxHeight(55);
   save.setMinSize(60, 45);
   save.getStyleClass().add("toolBar-button");
   labelTitolo.getStyleClass().add("titolo");
 }
Example #12
0
 public static void addInfRow(String labelText, VBox content) {
   // this one is used for adding rows in the Insert New VM Form
   HBox formRow = new HBox();
   formRow.getStyleClass().add("vmform-infRow");
   Label rowLabel = new Label(labelText);
   rowLabel.getStyleClass().add("vmform-label");
   TextField rowTF = new TextField();
   formRow.getChildren().addAll(rowLabel, rowTF);
   content.getChildren().add(formRow);
 }
 private TooltipContent() {
   Label open = new Label("OPEN:");
   Label close = new Label("CLOSE:");
   Label high = new Label("HIGH:");
   Label low = new Label("LOW:");
   open.getStyleClass().add("candlestick-tooltip-label");
   close.getStyleClass().add("candlestick-tooltip-label");
   high.getStyleClass().add("candlestick-tooltip-label");
   low.getStyleClass().add("candlestick-tooltip-label");
   setConstraints(open, 0, 0);
   setConstraints(openValue, 1, 0);
   setConstraints(close, 0, 1);
   setConstraints(closeValue, 1, 1);
   setConstraints(high, 0, 2);
   setConstraints(highValue, 1, 2);
   setConstraints(low, 0, 3);
   setConstraints(lowValue, 1, 3);
   getChildren().addAll(open, openValue, close, closeValue, high, highValue, low, lowValue);
 }
Example #14
0
 private static void addHeader(String labelText, ToggleButton btn, Integer size, VBox content) {
   HBox headerRow = new HBox(size);
   Label lname = new Label(labelText);
   lname.getStyleClass().add("popover-label");
   btn.setPrefSize(50, 10);
   // this is so everytime user closes popover in edit, and when user
   // revisits it popover is
   // in edit mode
   btn.setSelected(false);
   headerRow.getChildren().addAll(lname, btn);
   content.getChildren().add(headerRow);
 }
 private void wrapInHBox() {
   i18nHBox = new HBox();
   i18nHBox.setAlignment(Pos.CENTER);
   EditorUtils.replaceNode(textNode, i18nHBox, null);
   Label percentLabel = new Label(PERCENT_STR);
   percentLabel.getStyleClass().add("symbol-prefix"); // NOI18N
   i18nHBox.getChildren().addAll(percentLabel, textNode);
   HBox.setHgrow(percentLabel, Priority.NEVER);
   // we have to set a small pref width for the text node else it will
   // revert to it's API set pref width which is too wide
   textNode.setPrefWidth(30.0);
   HBox.setHgrow(textNode, Priority.ALWAYS);
 }
Example #16
0
 private void updateContentText() {
   String contentText = getDialogPane().getContentText();
   grid.getChildren().remove(contentTextLabel);
   if (contentText != null && !contentText.isEmpty()) {
     if (contentTextLabel != null) {
       contentTextLabel.setText(contentText);
     } else {
       contentTextLabel = new Label(getDialogPane().getContentText());
       contentTextLabel.getStyleClass().add("command-link-message"); // $NON-NLS-1$
     }
     grid.add(contentTextLabel, 0, 0);
   }
 }
Example #17
0
  private GridPane getSubGrid() {
    subGrid = new GridPane();

    topPane = getTopPane();
    bottomPane = getBottomPane();

    topPane.setPadding(new Insets(50));
    bottomPane.setPadding(new Insets(50));
    subGrid.setPadding(new Insets(0, 100, 0, 100));

    // Css styling
    topPane.getStyleClass().add("TopPaneBorder");
    bottomPane.getStyleClass().add("TopPaneBorder");

    topTitleL.getStyleClass().add("topPaneTitle");
    bottomTitle.getStyleClass().add("topPaneTitle");

    bottomPane.setHgap(10);
    bottomPane.setVgap(5);
    bottomPane.setAlignment(Pos.CENTER_LEFT);

    topPane.setVgap(10);
    topPane.setHgap(10);
    topPane.setAlignment(Pos.CENTER);

    subGrid.setAlignment(Pos.CENTER);
    subGrid.setMargin(topPane, new Insets(10));
    subGrid.setMargin(bottomPane, new Insets(10));

    subGrid.setConstraints(topPane, 0, 1, 1, 1, HPos.CENTER, VPos.CENTER);
    subGrid.setConstraints(bottomPane, 0, 2, 1, 1, HPos.LEFT, VPos.CENTER);

    subGrid.getChildren().addAll(topPane, bottomPane);

    return subGrid;
  }
  private void configureColor() {
    ChatPrefs chatPrefs = preferencesService.getPreferences().getChat();

    if (playerInfoBean.getSocialStatus() == SELF) {
      usernameLabel.getStyleClass().add(CSS_CLASS_SELF);
      clanLabel.getStyleClass().add(CSS_CLASS_SELF);
      return;
    }

    Color color = null;
    ChatUser chatUser = chatService.createOrGetChatUser(playerInfoBean.getUsername());

    if (chatPrefs.getChatColorMode().equals(CUSTOM)) {
      if (chatPrefs.getUserToColor().containsKey(playerInfoBean.getUsername())) {
        color = chatPrefs.getUserToColor().get(playerInfoBean.getUsername());
      }

      // FIXME: something here returned NPE when starting chat and users starting messaging aeolus
      // on non-dev server
      chatPrefs
          .getUserToColor()
          .addListener(
              (MapChangeListener<? super String, ? super Color>)
                  change -> {
                    if (playerInfoBean.getUsername().equals(change.getKey())) {
                      Color newColor = chatPrefs.getUserToColor().get(playerInfoBean.getUsername());
                      assignColor(newColor);
                    }
                  });
    } else if (chatPrefs.getChatColorMode().equals(ChatColorMode.RANDOM) && colorsAllowedInPane) {
      color = ColorGeneratorUtil.generateRandomHexColor();
    }

    chatUser.setColor(color);
    assignColor(color);
  }
  private void updateContentGroup() {

    /*
     * fxomRoot
     */

    final String statusMessageText, statusStyleClass;
    contentGroup.getChildren().clear();

    if (fxomDocument == null) {
      statusMessageText = "FXOMDocument is null"; // NOI18N
      statusStyleClass = "stage-prompt"; // NOI18N
    } else if (fxomDocument.getFxomRoot() == null) {
      statusMessageText = I18N.getString("content.label.status.invitation");
      statusStyleClass = "stage-prompt"; // NOI18N
    } else {
      final Object userSceneGraph = fxomDocument.getSceneGraphRoot();
      if (userSceneGraph instanceof Node) {
        final Node rootNode = (Node) userSceneGraph;
        assert rootNode.getParent() == null;
        contentGroup.getChildren().add(rootNode);
        layoutContent(true /* applyCSS */);
        if (layoutException == null) {
          statusMessageText = ""; // NOI18N
          statusStyleClass = "stage-prompt-default"; // NOI18N
        } else {
          contentGroup.getChildren().clear();
          statusMessageText = I18N.getString("content.label.status.cannot.display");
          statusStyleClass = "stage-prompt"; // NOI18N
        }
      } else {
        statusMessageText = I18N.getString("content.label.status.cannot.display");
        statusStyleClass = "stage-prompt"; // NOI18N
      }
    }

    backgroundPane.setText(statusMessageText);
    backgroundPane.getStyleClass().clear();
    backgroundPane.getStyleClass().add(statusStyleClass);

    // If layoutException != null, then this layout call is required
    // so that backgroundPane updates its message... Strange...
    backgroundPane.layout();

    adjustWorkspace();
  }
Example #20
0
  public StackView(
      final Context context, final CardImager imager, final Stage stage, final CardStack stack) {
    super(context);
    this.stack = stack;
    stack.register(this);
    cardView = new CardView(context, imager, stage);
    cardView.setParent(this);
    stackSize = new Label();
    stackSize.getStyleClass().add(STYLE_STACK_SIZE);
    stackSize.setMouseTransparent(true);

    pane = new StackPane();
    pane.getChildren().add(cardView.getPane());
    pane.getChildren().add(stackSize);

    setPane(pane);
    updateStackSizeLabel();
    updateCardView();
  }
  private GridPane buildRecordingGrid(Recording recording) {
    GridPane grid = new GridPane();
    grid.setHgap(5);
    grid.setVgap(5);

    Label status = new Label();
    status.setAlignment(Pos.CENTER);
    status.setMinWidth(STATUS_MIN_WIDTH);
    updateStatusIcon(recording, status);
    recording
        .fileExistsActionProperty()
        .addListener(observable -> updateStatusIcon(recording, status));

    Label title = new Label();
    title.setMinWidth(TITLE_MIN_WIDTH);
    title.textProperty().bind(recording.fullTitleProperty());

    Label destination = new Label();
    destination.getStyleClass().add("destination");
    destination.textProperty().bind(recording.destinationProperty().asString());
    LocalDate dateArchived = recording.getDateArchived();
    if (dateArchived != null) {
      String dateArchivedText =
          String.format("Archived %s", DateUtils.formatArchivedOnDate(dateArchived));
      Tooltip tooltip = new Tooltip(dateArchivedText);
      title.setTooltip(tooltip);
      destination.setTooltip(tooltip);
    }

    ReplaceOrRenameActionBar actionBar = new ReplaceOrRenameActionBar(recording, userPrefs);
    actionBar.setMinWidth(ACTION_BAR_MIN_WIDTH);
    GridPane.setHalignment(actionBar, HPos.RIGHT);
    GridPane.setHgrow(actionBar, Priority.ALWAYS);
    GridPane.setMargin(actionBar, new Insets(0, 0, 0, 10));

    grid.add(status, 0, 0, 1, 2);
    grid.add(title, 1, 0);
    grid.add(destination, 1, 1);
    grid.add(actionBar, 2, 0, 1, 2);

    return grid;
  }
Example #22
0
  private static void addRow(
      String labelText, String textFormText, Integer size, VBox content, boolean addToEnd) {
    HBox formRow = new HBox(size);
    formRow.getStyleClass().add("popover-form");
    Label rowLabel = new Label(labelText);
    rowLabel.getStyleClass().add("popover-form-label");
    TextField rowTF = new TextField();
    rowTF.getStyleClass().add("popover-form-textfield-inactive");
    rowTF.setText(textFormText);
    rowTF.setEditable(false);

    // do you just add it to the form for befor the row with the button
    if (addToEnd) {
      formRow.getChildren().addAll(rowLabel, rowTF);
      content.getChildren().add(content.getChildren().size() - 1, formRow);
    } else {
      formRow.getChildren().addAll(rowLabel, rowTF);
      content.getChildren().add(formRow);
    }
  }
Example #23
0
  /**
   * Creates a default DockTitleBar with captions and dragging behavior.
   *
   * @param dockNode The docking node that requires a title bar.
   */
  public DockTitleBar(DockNode dockNode) {
    this.dockNode = dockNode;

    label = new Label("Dock Title Bar");
    label.textProperty().bind(dockNode.titleProperty());
    label.graphicProperty().bind(dockNode.graphicProperty());

    stateButton = new Button();
    stateButton.setOnAction(
        event -> {
          if (dockNode.isFloating()) {
            dockNode.setMaximized(!dockNode.isMaximized());
          } else {
            dockNode.setFloating(true);
          }
        });

    closeButton = new Button();
    closeButton.setOnAction(event -> dockNode.close());
    closeButton.visibleProperty().bind(dockNode.closableProperty());

    // create a pane that will stretch to make the buttons right aligned
    Pane fillPane = new Pane();
    HBox.setHgrow(fillPane, Priority.ALWAYS);

    getChildren().addAll(label, fillPane, stateButton, closeButton);

    this.addEventHandler(MouseEvent.MOUSE_PRESSED, this);
    this.addEventHandler(MouseEvent.DRAG_DETECTED, this);
    this.addEventHandler(MouseEvent.MOUSE_DRAGGED, this);
    this.addEventHandler(MouseEvent.MOUSE_RELEASED, this);

    label.getStyleClass().add("dock-title-label");
    closeButton.getStyleClass().add("dock-close-button");
    stateButton.getStyleClass().add("dock-state-button");
    this.getStyleClass().add("dock-title-bar");
  }
  private HBox createInheritanceBox(String artifactType, String propertyName) {
    HBox propertyBox = new HBox(30);

    VBox propNameAndExplation = new VBox();
    final Label propertyNameLabel = new Label(ontologyLabels.get(propertyName));
    propertyNameLabel.setPrefWidth(400);
    propertyNameLabel.getStyleClass().add(CssConstants.BOLD_TEXT_CLASS);
    // propertyNameLabel.setStyle(CssConstants.BOLD_TEXT_CLASS);

    StringBuilder sb = new StringBuilder();
    final String typeSeparator = ", ";
    for (String inheritingTypes : presenter.getInheritingTypes(artifactType, propertyName)) {
      sb.append(ontologyLabels.get(inheritingTypes));
      sb.append(typeSeparator);
    }
    sb.deleteCharAt(sb.lastIndexOf(typeSeparator));

    final Label descendantTypesLabel =
        new Label(
            String.format(labels.get(Labels.LabelKey.INHERITANCE_DESCENDANT_TYPE), sb.toString()));
    descendantTypesLabel.setPrefWidth(400);
    descendantTypesLabel.setWrapText(true);

    propNameAndExplation.getChildren().add(propertyNameLabel);
    propNameAndExplation.getChildren().add(descendantTypesLabel);

    // propertyBox.getChildren().add(propertyNameLabel);
    propertyBox.getChildren().add(propNameAndExplation);

    final CheckBox applyPropertyValueToChildrenCheckBox = new CheckBox();
    propertyBox.getChildren().add(applyPropertyValueToChildrenCheckBox);

    // Add inheritance to map
    metadataInheritanceButtonMap.put(propertyName, applyPropertyValueToChildrenCheckBox);
    return propertyBox;
  }
  private StackPane buildLeft() {

    StackPane sp = new StackPane();

    sp.setPadding(new Insets(0, 0, 0, 5.0));

    gpPackRow = 1;

    gpPack = new GridPane();

    gpPack.setHgap(15);
    gpPack.setVgap(10);

    Label name = new Label("Nome Viaggio Gruppo");
    name.getStyleClass().add("text-titlesmall");

    Label price = new Label("Prezzo");
    price.getStyleClass().add("text-titlesmall");

    Label citta = new Label("Città");
    citta.getStyleClass().add("text-titlesmall");

    Label tipoPern = new Label("Tipologia");
    tipoPern.getStyleClass().add("text-titlesmall");

    Label stelle = new Label("Stelle");
    stelle.getStyleClass().add("text-titlesmall");

    Label notti = new Label("Numero notti");
    notti.getStyleClass().add("text-titlesmall");

    Label cittaP = new Label("Partenza");
    cittaP.getStyleClass().add("text-titlesmall");

    Label tipoTras = new Label("Tipologia");
    tipoTras.getStyleClass().add("text-titlesmall");

    Label durata = new Label("Durata");
    durata.getStyleClass().add("text-titlesmall");

    Label evento = new Label("Nome evento");
    evento.getStyleClass().add("text-titlesmall");

    Label tipoEven = new Label("Tipologia");
    tipoEven.getStyleClass().add("text-titlesmall");

    Label pernotto = new Label("Pernotto");
    pernotto.getStyleClass().add("text-titlesmall");

    Label trasporto = new Label("Trasporto");
    trasporto.getStyleClass().add("text-titlesmall");

    Label eventi = new Label("Eventi");
    eventi.getStyleClass().add("text-titlesmall");

    Label caratteristiche = new Label("Caratteristiche Viaggio Gruppo");
    caratteristiche.getStyleClass().add("text-titlesmall");

    Label pacchetto = new Label("Pacchetto");
    pacchetto.getStyleClass().add("text-titlesmall");

    Label minL = new Label("Minimo numero partecipanti");
    minL.getStyleClass().add("text-titlesmall");

    Label maxL = new Label("Massimo numero partecipanti");
    maxL.getStyleClass().add("text-titlesmall");

    Label discountL = new Label("Sconto da applicare");
    discountL.getStyleClass().add("text-titlesmall");

    Label reservedL = new Label("Numero Prenotati");
    reservedL.getStyleClass().add("text-titlesmall");

    Separator separator = new Separator();
    gpPack.add(separator, 0, gpPackRow, 20, 1);
    gpPackRow++;

    gpPack.add(pacchetto, 1, 2, 3, 1);
    gpPack.add(pernotto, 4, 2, 3, 1);
    gpPack.add(trasporto, 8, 2, 2, 1);
    gpPack.add(eventi, 12, 2, 2, 1);
    gpPack.add(caratteristiche, 16, 2, 4, 1);

    gpPack.add(name, 0, 3);
    gpPack.add(price, 1, 3);
    gpPack.add(citta, 2, 3);

    gpPack.add(tipoPern, 4, 3);
    gpPack.add(stelle, 5, 3);
    gpPack.add(notti, 6, 3);

    gpPack.add(cittaP, 8, 3);
    gpPack.add(tipoTras, 9, 3);
    gpPack.add(durata, 10, 3);

    gpPack.add(evento, 12, 3);
    gpPack.add(tipoEven, 13, 3);

    gpPack.add(minL, 15, 3);
    gpPack.add(maxL, 16, 3);
    gpPack.add(discountL, 17, 3);
    gpPack.add(reservedL, 18, 3);

    Separator separator1 = new Separator();
    separator1.setOrientation(Orientation.VERTICAL);

    Separator separator2 = new Separator();
    separator2.setOrientation(Orientation.VERTICAL);

    Separator separator3 = new Separator();
    separator3.setOrientation(Orientation.VERTICAL);

    Separator separator4 = new Separator();
    separator4.setOrientation(Orientation.VERTICAL);

    Separator separator6 = new Separator();
    separator4.setOrientation(Orientation.VERTICAL);

    Separator separator7 = new Separator();
    separator4.setOrientation(Orientation.VERTICAL);

    gpPack.add(separator1, 3, 1, 1, 5);
    gpPack.add(separator2, 7, 1, 1, 5);
    gpPack.add(separator3, 11, 1, 1, 5);
    gpPack.add(separator4, 14, 1, 1, 5);
    gpPack.add(separator6, 19, 1, 1, 5);

    gpPackRow += 2;

    Separator separator5 = new Separator();
    gpPack.add(separator5, 0, gpPackRow, 20, 1);
    gpPackRow++;

    List<ViaggioGruppo> viaggi = prenotaViaggioControl.getTrips();
    if (viaggi != null) {
      for (ViaggioGruppo viaggioGruppo : viaggi) {
        this.addTrip(viaggioGruppo);
      }
    }

    sp.getChildren().add(gpPack);

    return sp;
  }
Example #26
0
  private Button createCommandLinksButton(ButtonType buttonType) {
    // look up the CommandLinkButtonType for the given ButtonType
    CommandLinksButtonType commandLink =
        typeMap.getOrDefault(buttonType, new CommandLinksButtonType(buttonType));

    // put the content inside a button
    final Button button = new Button();
    button.getStyleClass().addAll("command-link-button"); // $NON-NLS-1$
    button.setMaxHeight(Double.MAX_VALUE);
    button.setMaxWidth(Double.MAX_VALUE);
    button.setAlignment(Pos.CENTER_LEFT);

    final ButtonData buttonData = buttonType.getButtonData();
    button.setDefaultButton(buttonData != null && buttonData.isDefaultButton());
    button.setOnAction(ae -> setResult(buttonType));

    final Label titleLabel = new Label(commandLink.getButtonType().getText());
    titleLabel
        .minWidthProperty()
        .bind(
            new DoubleBinding() {
              {
                bind(titleLabel.prefWidthProperty());
              }

              @Override
              protected double computeValue() {
                return titleLabel.getPrefWidth() + 400;
              }
            });
    titleLabel.getStyleClass().addAll("line-1"); // $NON-NLS-1$
    titleLabel.setWrapText(true);
    titleLabel.setAlignment(Pos.TOP_LEFT);
    GridPane.setVgrow(titleLabel, Priority.NEVER);

    Label messageLabel = new Label(commandLink.getLongText());
    messageLabel.getStyleClass().addAll("line-2"); // $NON-NLS-1$
    messageLabel.setWrapText(true);
    messageLabel.setAlignment(Pos.TOP_LEFT);
    messageLabel.setMaxHeight(Double.MAX_VALUE);
    GridPane.setVgrow(messageLabel, Priority.SOMETIMES);

    Node commandLinkImage = commandLink.getGraphic();
    Node view =
        commandLinkImage == null
            ? new ImageView(
                CommandLinksDialog.class.getResource("arrow-green-right.png").toExternalForm())
            : //$NON-NLS-1$
            commandLinkImage;
    Pane graphicContainer = new Pane(view);
    graphicContainer.getStyleClass().add("graphic-container"); // $NON-NLS-1$
    GridPane.setValignment(graphicContainer, VPos.TOP);
    GridPane.setMargin(graphicContainer, new Insets(0, 10, 0, 0));

    GridPane grid = new GridPane();
    grid.minWidthProperty().bind(titleLabel.prefWidthProperty());
    grid.setMaxHeight(Double.MAX_VALUE);
    grid.setMaxWidth(Double.MAX_VALUE);
    grid.getStyleClass().add("container"); // $NON-NLS-1$
    grid.add(graphicContainer, 0, 0, 1, 2);
    grid.add(titleLabel, 1, 0);
    grid.add(messageLabel, 1, 1);

    button.setGraphic(grid);
    button.minWidthProperty().bind(titleLabel.prefWidthProperty());

    if (commandLink.isHidden) {
      button.setVisible(false);
      button.setPrefHeight(1);
    }
    return button;
  }
  /** {@inheritDoc} */
  @Override
  public void buildContent() {
    Calendar calendar = calendarView.calendarProperty().get();

    // get the maximum number of days in a week for this calendar.
    numberOfDaysPerWeek = calendar.getMaximum(Calendar.DAY_OF_WEEK);

    // get the maximum number of days a month could have.
    int maxNumberOfDaysInMonth = calendar.getMaximum(Calendar.DAY_OF_MONTH);

    // assume the first row has only 1 day, then distribute the rest among the remaining weeks and
    // add the first week.
    int numberOfRows =
        (int) Math.ceil((maxNumberOfDaysInMonth - 1) / (double) numberOfDaysPerWeek) + 1;

    // remove all controls
    getChildren().clear();

    int colOffset = calendarView.getShowWeeks() ? 1 : 0;

    if (calendarView.getShowWeeks()) {
      Label empty = new Label();
      empty.setMaxWidth(Double.MAX_VALUE);
      empty.getStyleClass().add(CSS_CALENDAR_WEEKDAYS);
      add(empty, 0, 0);
    }
    // iterate through the columns
    for (int i = 0; i < numberOfDaysPerWeek; i++) {
      Label label = new Label();
      label.getStyleClass().add(CSS_CALENDAR_WEEKDAYS);
      label.setMaxWidth(Double.MAX_VALUE);
      label.setAlignment(Pos.CENTER);
      add(label, i + colOffset, 0);
    }

    // iterate through the rows
    for (int rowIndex = 0; rowIndex < numberOfRows; rowIndex++) {

      if (calendarView.getShowWeeks()) {
        Label label = new Label();
        label.setMaxWidth(Double.MAX_VALUE);
        label.setMaxHeight(Double.MAX_VALUE);
        label.getStyleClass().add(CSS_CALENDAR_WEEK_NUMBER);
        add(label, 0, rowIndex + 1);
      }

      // iterate through the columns
      for (int colIndex = 0; colIndex < numberOfDaysPerWeek; colIndex++) {
        final Button button = new Button();
        button.setMaxWidth(Double.MAX_VALUE);
        button.setMaxHeight(Double.MAX_VALUE);

        GridPane.setVgrow(button, Priority.ALWAYS);
        GridPane.setHgrow(button, Priority.ALWAYS);
        button.setOnAction(
            new EventHandler<ActionEvent>() {
              @Override
              public void handle(ActionEvent actionEvent) {

                calendarView.selectedDate.set((Date) button.getUserData());
              }
            });
        // add the button, starting at second row.
        add(button, colIndex + colOffset, rowIndex + 1);
      }
    }
  }
  @Override
  protected void updateItem(ShoppingItem item, boolean empty) {
    super.updateItem(item, empty);

    if (item != null) {
      if (empty) {
        setText(null);
        setGraphic(null);
      } else {
        setText(null);

        BorderPane pane = new BorderPane();
        pane.setPadding(new Insets(2, 5, 2, 5));
        TextField txtField = new TextField((int) item.getAmount() + "");
        txtField.setMaxWidth(40);
        txtField.setDisable(false);
        txtField.setEditable(true);
        pane.setLeft(txtField);

        Label name = new Label(item.getProduct().getName());
        BorderPane.setAlignment(name, Pos.CENTER_LEFT);
        BorderPane.setMargin(name, new Insets(0, 0, 0, 10));
        name.getStyleClass().add("produktnamn");
        pane.setCenter(name);

        GridPane priceAndDelete = new GridPane();
        double cost = item.getTotal();
        Label price = new Label(String.format("%.2f", cost) + " kr");
        price.setTextAlignment(TextAlignment.CENTER);
        GridPane.setMargin(price, new Insets(0, 10, 0, 0));
        priceAndDelete.add(price, 0, 0);

        Button delete = new Button("X");
        priceAndDelete.add(delete, 1, 0);

        pane.setRight(priceAndDelete);
        setGraphic(pane);

        delete.setOnMouseClicked(
            new EventHandler<MouseEvent>() {
              @Override
              public void handle(MouseEvent event) {
                IMatDataHandler.getInstance().getShoppingCart().removeItem(item);
                IMatDataHandler.getInstance()
                    .getShoppingCart()
                    .fireShoppingCartChanged(item, false);
              }
            });

        // Listen for TextField text changes
        txtField
            .textProperty()
            .addListener(
                new ChangeListener<String>() {
                  @Override
                  public void changed(
                      ObservableValue<? extends String> observable,
                      String oldValue,
                      String newValue) {
                    try {
                      if (!txtField.getText().equals("")) {
                        int amount = Integer.parseInt(txtField.getText());
                        if (amount < 1) {
                          txtField.setText(1 + "");
                        } else if (amount > 99) {
                          txtField.setText(99 + "");
                        }
                        item.setAmount(Integer.parseInt(txtField.getText()));
                        double cost2 = item.getTotal();
                        price.setText(String.format("%.2f", cost2) + " kr");
                        // IMatDataHandler.getInstance().getShoppingCart().fireShoppingCartChanged(item, true);
                        lastValidProductAmountString = txtField.getText();
                      }
                    } catch (NumberFormatException e) {
                      txtField.setText(lastValidProductAmountString);
                    }
                  }
                });
      }
    } else {
      if (count < 1) {
        Label noProducts = new Label("Din kundvagn är tom");
        noProducts.getStyleClass().add("produktnamn");
        setGraphic(noProducts);
        count++;
      } else {
        setText(null);
        setGraphic(null);
      }
    }
  }
Example #29
0
 private Label createInfoOcticon() {
   Label label = new Label(OCTICON_INFO);
   label.setPadding(new Insets(0, 0, 5, 0));
   label.getStyleClass().addAll("octicon");
   return label;
 }
Example #30
0
  public GridPane build() {
    area = getNewGrid();

    for (int i = 0; i < eaTabs.size(); i++) {
      EATab eaTab = eaTabs.get(i);

      /*Label label = new Label(eaTab.getTabText() + "  Gen: 0");
      eaTab.fitnessGrapher.genHolder.addListener((val) -> {
      	label.setText(eaTab.getTabText() + "  Gen: " + (Integer)val);
      });*/

      final Label label = new Label(eaTab.getTabText() + "  Fit: --");
      eaTab.fitnessGrapher.fitHolder.addListener(
          (val) -> {
            label.setText(
                eaTab.getTabText() + "  Fit: " + (Math.round(((Double) val) * 100.0) / 100.0));
          });

      final Popup popup = new Popup();
      final Label popupMessage = new Label(label.getText());
      popupMessage.getStylesheets().add("./ui/css/style.css");
      popupMessage.getStyleClass().add("popup");

      label.setOnMouseEntered(
          event -> {
            popup.setAnchorX(event.getScreenX() + 20);
            popup.setAnchorY(event.getScreenY());
            popup.setAutoFix(true);
            popup.setHideOnEscape(true);
            popup.getContent().clear();
            popup.getContent().add(popupMessage);
            popup.show(GUI.stage);
          });

      label.setOnMouseExited(
          event -> {
            popup.hide();
          });

      Line line = new Line();
      line.setEndX(100);
      line.setStroke(Paint.valueOf("B4B4B4"));
      GridPane.setColumnSpan(line, 2);
      GridPane.setRowSpan(line, 1);
      GridPane.setHalignment(line, HPos.CENTER);
      GridPane.setValignment(line, VPos.CENTER);
      area.add(line, 0, i * 2 + 1);

      TetheredProgressBar progress = new TetheredProgressBar(eaTab.progressBar);

      StackPane sp = new StackPane();
      sp.getChildren().add(label);

      StackPane sp2 = new StackPane();
      sp2.getChildren().add(progress);

      VBox vbox = new VBox();
      vbox.getChildren().addAll(sp, sp2);

      HBox hbox = new HBox();

      TetheredButton button = new TetheredButton(eaTab.startButton);

      MenuButton mb = new MenuButton();
      mb.setText("...");
      MenuItem save = new MenuItem("Save");
      save.setOnAction(
          (event) -> {
            System.out.println("SAVE");
            fxController.saveEvolution(eaTab);
          });

      MenuItem close = new MenuItem("Close");
      close.setOnAction(
          (event) -> {
            fxController.closeTab(eaTab);
          });
      mb.getItems().addAll(save, close, new MenuItem("Send"));

      hbox.getChildren().addAll(button, mb);
      hbox.setSpacing(5);

      area.add(vbox, 0, i * 2);
      area.add(hbox, 1, i * 2);

      // button = null;
    }

    return area;
  }