private Label createNoMatchingUsersLabel() {
   Label noMatchingUsersLabel = new Label(MESSAGE_NO_MATCHES);
   noMatchingUsersLabel.setPrefHeight(40);
   noMatchingUsersLabel.setPrefWidth(398);
   noMatchingUsersLabel.setAlignment(Pos.CENTER);
   return noMatchingUsersLabel;
 }
 protected void addLabel(String name) {
   Label label = new Label(myResource.getString(name));
   label.setPrefWidth(myScene.getWidth() / 7);
   label.setBackground(
       new Background(new BackgroundFill(Color.CADETBLUE, new CornerRadii(0), new Insets(0))));
   getChildren().add(label);
 }
  public AlertHandler(String message, EventHandler<ActionEvent> confirmHandler) {
    super(14);

    // add controls to the popup.
    final Label promptMessage = new Label(message);
    final ImageView alertImage = new ImageView(ResourceUtil.getImage("alert_48.png"));
    alertImage.setFitHeight(32);
    alertImage.setPreserveRatio(true);
    promptMessage.setGraphic(alertImage);
    promptMessage.setWrapText(true);
    promptMessage.setPrefWidth(350);

    // action button text setup.
    HBox buttonBar = new HBox(20);
    final Button confirmButton = new Button(getString("dialog.continue"));
    confirmButton.setDefaultButton(true);

    buttonBar.getChildren().addAll(confirmButton);

    // layout the popup.
    setPadding(new Insets(10));
    getStyleClass().add("alert-dialog");
    getChildren().addAll(promptMessage, buttonBar);

    final DropShadow dropShadow = new DropShadow();
    setEffect(dropShadow);

    // confirm and close the popup.
    confirmButton.setOnAction(confirmHandler);
  }
  /**
   * Creates the inheritance tab in the popup.
   *
   * @param artifact The popup artifact
   * @return inheritance tab or null if nothing to do
   */
  public VBox createInheritanceTab(final PackageArtifact artifact) {

    final VBox inheritanceBox = new VBox(12);
    inheritanceBox.getStyleClass().add(PACKAGE_TOOL_POPUP_PROPERTY_TAB);
    boolean hasInheritableProperties = false;

    // create label to explain what this tab is about.
    Label inheritanceTabIntroLabel = new Label(labels.get(Labels.LabelKey.INHERITANCE_TAB_INTRO));
    inheritanceTabIntroLabel.setPrefWidth(450);
    inheritanceTabIntroLabel.setWrapText(true);
    inheritanceBox.getChildren().add(inheritanceTabIntroLabel);

    // create label to explain usage of buttons.
    Label inheritanceButtonExplainedLabel =
        new Label(labels.get(Labels.LabelKey.INHERITANCE_BUTTON_EXPLAINED));
    inheritanceButtonExplainedLabel.setPrefWidth(450);
    inheritanceButtonExplainedLabel.setWrapText(true);
    inheritanceBox.getChildren().add(inheritanceButtonExplainedLabel);

    Separator groupSeparator = new Separator();
    inheritanceBox.getChildren().add(groupSeparator);

    // Loop through properties for the given artifact.
    for (String propertyName : packageOntologyService.getProperties(artifact).keySet()) {
      // If the property is inheritable, create a button which would allow the values to be apply to
      // children
      // appropriately
      if (packageOntologyService.isInheritableProperty(artifact, propertyName)) {
        inheritanceBox.getChildren().add(createInheritanceBox(artifact.getType(), propertyName));

        groupSeparator = new Separator();
        inheritanceBox.getChildren().add(groupSeparator);
        hasInheritableProperties = true;
      }
    }

    if (!hasInheritableProperties) {
      Label noInheritablePropertyLabel =
          new Label(labels.get(Labels.LabelKey.NO_INHERITABLE_PROPERTY));
      inheritanceTabIntroLabel.setPrefWidth(450);
      inheritanceTabIntroLabel.setWrapText(true);
      inheritanceBox.getChildren().add(noInheritablePropertyLabel);
    }

    return inheritanceBox;
  }
 private Label createNoExistingAssigneeLabel() {
   Label noExistingAssignee = new Label(MESSAGE_NO_ASSIGNEE);
   noExistingAssignee.setPrefHeight(40);
   FontLoader fontLoader = Toolkit.getToolkit().getFontLoader();
   double width =
       fontLoader.computeStringWidth(noExistingAssignee.getText(), noExistingAssignee.getFont());
   noExistingAssignee.setPrefWidth(width);
   return noExistingAssignee;
 }
Example #6
0
  public static Tuple2<Label, VBox> getTradeInputBox(HBox amountValueBox, String descriptionText) {
    Label descriptionLabel = new Label(descriptionText);
    descriptionLabel.setId("input-description-label");
    descriptionLabel.setPrefWidth(170);

    VBox box = new VBox();
    box.setSpacing(4);
    box.getChildren().addAll(descriptionLabel, amountValueBox);
    return new Tuple2<>(descriptionLabel, box);
  }
  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;
  }
    public FileGridCell() {
      Label titleLabel = new Label();
      titleLabel.setPrefWidth(80);
      titleLabel.setWrapText(true);
      titleLabel.setTextAlignment(TextAlignment.CENTER);
      title = titleLabel.textProperty();

      ImageView iconView = new ImageView();
      icon = iconView.imageProperty();

      VBox vbox = new VBox(iconView, titleLabel);
      vbox.setAlignment(Pos.TOP_CENTER);

      setGraphic(vbox);
    }
Example #9
0
  @Override
  public void initUI() {
    AnchorPane anchorPane = new AnchorPane();
    anchorPane.setPrefHeight(90.0);
    anchorPane.setPrefWidth(384.0);

    Label label = new Label(getApplication().getMessageSource().getMessage("name.label"));
    TextField input = new TextField();
    input.setPrefWidth(200.0);

    Button button = new Button();
    button.setPrefWidth(200.0);
    JavaFXUtils.configure(
        button, (JavaFXAction) actionFor(controller, "sayHello").getToolkitAction());

    Label output = new Label();
    label.setPrefWidth(360.0);

    model.inputProperty().bindBidirectional(input.textProperty());
    model.outputProperty().bindBidirectional(output.textProperty());

    anchorPane.getChildren().addAll(label, input, button, output);

    setLeftAnchor(label, 14.0);
    setTopAnchor(label, 14.0);
    setLeftAnchor(input, 172.0);
    setTopAnchor(input, 11.0);
    setLeftAnchor(button, 172.0);
    setTopAnchor(button, 45.0);
    setLeftAnchor(output, 14.0);
    setTopAnchor(output, 80.0);

    Tab tab = new Tab("Java");
    tab.setGraphic(new FontAwesomeIcon(FontAwesome.FA_COFFEE));
    tab.setClosable(false);
    tab.setContent(anchorPane);
    parentView.getTabPane().getTabs().add(tab);
  }
  private void createViewTab(final HeatChartMaster heatChart) {

    for (Tab selTab : pane.getTabs()) {
      if (selTab.getId() != null && selTab.getId().equalsIgnoreCase(heatChart.getChartNumber())) {
        pane.getSelectionModel().select(selTab);
        return;
      }
    }

    Tab tab = new Tab("View Heat Chart : " + heatChart.getChartNumber());
    tab.setId(heatChart.getChartNumber());

    VBox main = ViewLayout.getMainVBox("Heat Chart", "Details");

    GridPane form = new GridPane();
    form.setHgap(ViewLayout.H_SPACE);
    form.setVgap(ViewLayout.V_SPACE);

    Label equipmentLabel = new Label("Equipment");
    equipmentLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);

    final ViewBox equipmentTextField = new ViewBox("Equipment", heatChart.equipmentProperty());

    Label customerLabel = new Label("Customer");
    customerLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);

    final ViewBox customerTextField = new ViewBox("Customer", heatChart.customerProperty());

    Label poDetailsLabel = new Label("PO Details");
    poDetailsLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);

    final ViewBox poDetailsTextField = new ViewBox("PO Details", heatChart.poDetailsProperty());

    Label drawingLabel = new Label("Drawing No.");
    drawingLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);

    final ViewBox drawingTextField = new ViewBox("Drawing No.", heatChart.drawingNumberProperty());

    Label suryeyorLabel = new Label("Surveyor");
    suryeyorLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);

    final ViewBox suryeyorTextField = new ViewBox("Suryeyor", heatChart.surveyorProperty());

    Label tagNumberLabel = new Label("Tag Number");
    suryeyorLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);

    final ViewBox tagNumberTextField = new ViewBox("Tag Number", heatChart.tagNumberProperty());

    form.add(equipmentLabel, 0, 0);
    form.add(equipmentTextField, 1, 0);
    form.add(customerLabel, 2, 0);
    form.add(customerTextField, 3, 0);
    form.add(poDetailsLabel, 4, 0);
    form.add(poDetailsTextField, 5, 0);
    form.add(drawingLabel, 0, 1);
    form.add(drawingTextField, 1, 1);
    form.add(suryeyorLabel, 2, 1);
    form.add(suryeyorTextField, 3, 1);
    form.add(tagNumberLabel, 4, 1);
    form.add(tagNumberTextField, 5, 1);

    main.getChildren().addAll(form);

    final ObservableList<HeatChartSheets> data = FXCollections.observableArrayList();

    TableView<HeatChartSheets> table = TableUtil.createViewHeatChartSheetTable();

    data.setAll(heatChart.getHeatChartSheets());
    table.setItems(data);

    main.getChildren().addAll(ControlsUtil.makeScrollable(table));

    final HBox buttons = new HBox(ViewLayout.H_SPACE);
    buttons.setTranslateY(32);
    final Button printButton = new Button("Print");
    printButton.getStyleClass().add("submit-button");
    buttons.getChildren().addAll(printButton);

    main.getChildren().addAll(buttons);

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

          @Override
          public void handle(ActionEvent e) {

            printHeatChart.setHeatChart(heatChart);
            printHeatChart.restart();
          }
        });

    Context.getWindowBottomText()
        .textProperty()
        .bind(Bindings.format("%s", printHeatChart.stateProperty()));

    printHeatChart
        .stateProperty()
        .addListener(
            new ChangeListener<Worker.State>() {

              @Override
              public void changed(
                  ObservableValue<? extends Worker.State> observable,
                  Worker.State oldValue,
                  Worker.State newState) {

                if (newState == Worker.State.SUCCEEDED) {
                  Alert.showAlert(
                      Context.getWindowStage(),
                      "Alert",
                      "Alert",
                      "The report has been saved as " + printHeatChart.getValue());
                  Context.getHostServices().showDocument(printHeatChart.getValue());
                } else if (newState == Worker.State.FAILED) {
                  Alert.showAlert(
                      Context.getWindowStage(),
                      "Error",
                      "Error",
                      "Some error cooured. Details : " + printHeatChart.getException().getCause());
                }
              }
            });

    tab.setContent(ControlsUtil.makeScrollable(main));
    pane.getTabs().add(tab);
  }
    public MediaControl(final MediaPlayer mp) {
      this.mp = mp;
      setStyle("-fx-background-color: #bfc2c7;"); // TODO: Use css file
      mediaView = new MediaView(mp);
      Pane mvPane = new Pane() {};

      mvPane.getChildren().add(mediaView);
      mvPane.setStyle("-fx-background-color: black;"); // TODO: Use css file
      setCenter(mvPane);
      mediaBar = new HBox();
      mediaBar.setPadding(new Insets(5, 10, 5, 10));
      mediaBar.setAlignment(Pos.CENTER_LEFT);
      BorderPane.setAlignment(mediaBar, Pos.CENTER);

      final Button playButton = new Button();
      playButton.setGraphic(imageViewPlay);
      playButton.setOnAction(
          new EventHandler<ActionEvent>() {
            public void handle(ActionEvent e) {
              updateValues();
              Status status = mp.getStatus();
              if (status == Status.UNKNOWN || status == Status.HALTED) {
                // don't do anything in these states
                return;
              }

              if (status == Status.PAUSED || status == Status.READY || status == Status.STOPPED) {
                // rewind the movie if we're sitting at the end
                if (atEndOfMedia) {
                  mp.seek(mp.getStartTime());
                  atEndOfMedia = false;
                  playButton.setGraphic(imageViewPlay);
                  // playButton.setText(">");
                  updateValues();
                }
                mp.play();
                playButton.setGraphic(imageViewPause);
                // playButton.setText("||");
              } else {
                mp.pause();
              }
            }
          });
      mp.currentTimeProperty()
          .addListener(
              new ChangeListener<Duration>() {
                @Override
                public void changed(
                    ObservableValue<? extends Duration> observable,
                    Duration oldValue,
                    Duration newValue) {
                  updateValues();
                }
              });
      mp.setOnPlaying(
          new Runnable() {
            public void run() {
              // System.out.println("onPlaying");
              if (stopRequested) {
                mp.pause();
                stopRequested = false;
              } else {
                playButton.setGraphic(imageViewPause);
                // playButton.setText("||");
              }
            }
          });
      mp.setOnPaused(
          new Runnable() {
            public void run() {
              // System.out.println("onPaused");
              playButton.setGraphic(imageViewPlay);
              // playButton.setText("||");
            }
          });
      mp.setOnReady(
          new Runnable() {
            public void run() {
              duration = mp.getMedia().getDuration();
              updateValues();
            }
          });

      mp.setCycleCount(repeat ? MediaPlayer.INDEFINITE : 1);
      mp.setOnEndOfMedia(
          new Runnable() {
            public void run() {
              if (!repeat) {
                playButton.setGraphic(imageViewPlay);
                // playButton.setText(">");
                stopRequested = true;
                atEndOfMedia = true;
              }
            }
          });
      mediaBar.getChildren().add(playButton);
      // Add spacer
      Label spacer = new Label("   ");
      mediaBar.getChildren().add(spacer);
      // Time label
      Label timeLabel = new Label("Time: ");
      timeLabel.setMinWidth(Control.USE_PREF_SIZE);
      mediaBar.getChildren().add(timeLabel);
      // Time slider
      timeSlider = new Slider();
      HBox.setHgrow(timeSlider, Priority.ALWAYS);
      timeSlider.setMinWidth(50);
      timeSlider.setMaxWidth(Double.MAX_VALUE);
      timeSlider
          .valueProperty()
          .addListener(
              new InvalidationListener() {
                public void invalidated(Observable ov) {
                  if (timeSlider.isValueChanging()) {
                    // multiply duration by percentage calculated by slider position
                    if (duration != null) {
                      mp.seek(duration.multiply(timeSlider.getValue() / 100.0));
                    }
                    updateValues();
                  }
                }
              });
      mediaBar.getChildren().add(timeSlider);
      // Play label
      playTime = new Label();
      playTime.setPrefWidth(130);
      playTime.setMinWidth(50);
      mediaBar.getChildren().add(playTime);
      // Volume label
      Label volumeLabel = new Label("Vol: ");
      volumeLabel.setMinWidth(Control.USE_PREF_SIZE);
      mediaBar.getChildren().add(volumeLabel);
      // Volume slider
      volumeSlider = new Slider();
      volumeSlider.setPrefWidth(70);
      volumeSlider.setMaxWidth(Region.USE_PREF_SIZE);
      volumeSlider.setMinWidth(30);
      volumeSlider
          .valueProperty()
          .addListener(
              new InvalidationListener() {
                public void invalidated(Observable ov) {}
              });
      volumeSlider
          .valueProperty()
          .addListener(
              new ChangeListener<Number>() {
                @Override
                public void changed(
                    ObservableValue<? extends Number> observable,
                    Number oldValue,
                    Number newValue) {
                  if (volumeSlider.isValueChanging()) {
                    mp.setVolume(volumeSlider.getValue() / 100.0);
                  }
                }
              });
      mediaBar.getChildren().add(volumeSlider);
      setBottom(mediaBar);
    }
  /**
   * Handles the creation of group properties, group properties are properties that are linked together in some manner.
   * Group properties are constructed using the {@code createPropertyBox) method found below.
   *
   * @param artifact
   * @param propertyName
   * @param propertyType
   * @param empty
   * @param container
   * @return  the VBox
   */
  private VBox createGroupPropertySection(
      PackageArtifact artifact,
      String propertyName,
      String propertyType,
      boolean empty,
      PackageDescriptionViewImpl.ArtifactPropertyContainer container) {
    VBox complexPropertyBox = new VBox(8);
    Separator separator = new Separator();
    complexPropertyBox.getChildren().add(separator);

    // If the artifact has the property and we're not adding an empty field add the sub property
    // values
    if (artifact.getPropertyNames().contains(propertyName) && !empty) {
      for (PackageArtifact.PropertyValueGroup group :
          artifact.getPropertyValueGroups(propertyName)) {
        Map<String, Set<StringProperty>> subPropertyFields = new HashMap<>();

        Label propertyNameLabel = new Label(ontologyLabels.get(propertyName));
        propertyNameLabel.setPrefWidth(100);
        propertyNameLabel.setWrapText(true);
        complexPropertyBox.getChildren().add(propertyNameLabel);

        List<String> sortedProperties = new ArrayList<>();

        // Get the creator property set and then create a sorted list from it.
        sortedProperties.addAll(packageOntologyService.getGroupPropertyNames(propertyType));
        sortProperties(sortedProperties, artifact, propertyType);

        for (String fieldName : sortedProperties) {
          Set<String> values = group.getSubPropertyValues(fieldName);
          int maxOccurs =
              packageOntologyService.getPropertyMaxOccurrences(artifact, fieldName, propertyType);
          int minOccurs =
              packageOntologyService.getPropertyMinOccurrences(artifact, fieldName, propertyType);
          boolean systemGenerated =
              packageOntologyService.isSystemSuppliedProperty(artifact, fieldName);
          Set<StringProperty> fields = new HashSet<>();
          complexPropertyBox
              .getChildren()
              .add(
                  new TextPropertyBox(
                      artifact,
                      propertyName,
                      ontologyLabels.get(fieldName),
                      fieldName,
                      values,
                      maxOccurs,
                      fields,
                      minOccurs,
                      systemGenerated,
                      packageOntologyService,
                      labels,
                      messages,
                      applyButtonValidationListener));
          subPropertyFields.put(fieldName, fields);
        }
        container.subProperties.add(subPropertyFields);
      }
      // Otherwise just add the empty text fields for the possible property values.
    } else {
      Map<String, Set<StringProperty>> subPropertyFields = new HashMap<>();

      Label propertyNameLabel = new Label(ontologyLabels.get(propertyName));
      propertyNameLabel.setPrefWidth(100);
      propertyNameLabel.setWrapText(true);
      complexPropertyBox.getChildren().add(propertyNameLabel);

      List<String> sortedProperties = new ArrayList<>();

      // Get the creator property set and then create a sorted list from it.
      sortedProperties.addAll(packageOntologyService.getGroupPropertyNames(propertyType));
      sortProperties(sortedProperties, artifact, propertyType);

      // For each field create a property box
      for (String fieldName : sortedProperties) {
        // String fieldType = packageOntologyService.getComplexPropertySubPropertyType(propertyType,
        // fieldName);
        int maxOccurs =
            packageOntologyService.getPropertyMaxOccurrences(artifact, fieldName, propertyType);
        int minOccurs =
            packageOntologyService.getPropertyMinOccurrences(artifact, fieldName, propertyType);
        boolean systemGenerated =
            packageOntologyService.isSystemSuppliedProperty(artifact, fieldName);
        Set<StringProperty> fields = new HashSet<>();
        complexPropertyBox
            .getChildren()
            .add(
                new TextPropertyBox(
                    artifact,
                    propertyName,
                    ontologyLabels.get(fieldName),
                    fieldName,
                    null,
                    maxOccurs,
                    fields,
                    minOccurs,
                    systemGenerated,
                    packageOntologyService,
                    labels,
                    messages,
                    applyButtonValidationListener));

        subPropertyFields.put(fieldName, fields);
      }

      container.subProperties.add(subPropertyFields);
    }
    return complexPropertyBox;
  }
  private void createEditTab(final UserMaster user) {

    for (Tab selTab : getTabs()) {
      if (selTab.getId() != null && selTab.getId().equalsIgnoreCase(user.getUserName())) {
        getSelectionModel().select(selTab);
        return;
      }
    }

    Tab tab = new Tab("Edit User : "******"User", "Details");

    GridPane form = new GridPane();
    form.setHgap(ViewLayout.H_SPACE);
    form.setVgap(ViewLayout.V_SPACE);

    Label userNameLabel = new Label("User Name");
    userNameLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);

    ViewBox userNameTextBox = new ViewBox(user.userNameProperty());

    Label passwordLabel = new Label("Password");
    passwordLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);

    final PasswordBox passwordBox = new PasswordBox("Password", user.passwordProperty());

    Label confirmPasswordLabel = new Label("Confirm Password");
    confirmPasswordLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);

    final PasswordBox confirmPasswordBox =
        new PasswordBox("Confirm Password", user.confirmPasswordProperty());

    Label roleLabel = new Label("Role");
    roleLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);

    final RoleEditableComboBox roleChoiceBox =
        new RoleEditableComboBox("Role", user.roleProperty());

    form.add(userNameLabel, 0, 0);
    form.add(userNameTextBox, 1, 0);
    form.add(passwordLabel, 0, 1);
    form.add(passwordBox, 1, 1);
    form.add(confirmPasswordLabel, 0, 2);
    form.add(confirmPasswordBox, 1, 2);
    form.add(roleLabel, 0, 3);
    form.add(roleChoiceBox, 1, 3);

    main.getChildren().addAll(form);

    final HBox buttons = new HBox(ViewLayout.H_SPACE);
    buttons.setTranslateY(32);
    final Button updateButton = new Button("Update");
    updateButton.getStyleClass().add("submit-button");
    main.getChildren().addAll(buttons);

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

          @Override
          public void handle(ActionEvent e) {

            if (Validator.validateUserData(user)) {

              ServiceManager.getUserDetailsService(user, PersistType.UPDATE).restart();
            }
          }
        });
    buttons.getChildren().addAll(updateButton);

    tab.setContent(ControlsUtil.makeScrollable(main));
    getTabs().add(tab);
  }
  private void adjustWorkspace() {
    final Bounds backgroundBounds, extensionBounds;

    final Object userSceneGraph;
    if (fxomDocument == null) {
      userSceneGraph = null;
    } else {
      userSceneGraph = fxomDocument.getSceneGraphRoot();
    }
    if ((userSceneGraph instanceof Node) && (layoutException == null)) {
      final Node rootNode = (Node) userSceneGraph;

      final Bounds rootBounds = rootNode.getLayoutBounds();

      if (rootBounds.isEmpty()
          || (rootBounds.getWidth() == 0.0)
          || (rootBounds.getHeight() == 0.0)) {
        backgroundBounds = new BoundingBox(0.0, 0.0, 0.0, 0.0);
        extensionBounds = new BoundingBox(0.0, 0.0, 0.0, 0.0);
      } else {
        final double scale;
        if ((rootBounds.getDepth() > 0) && autoResize3DContent) {
          // Content is 3D
          final double scaleX = AUTORESIZE_SIZE / rootBounds.getWidth();
          final double scaleY = AUTORESIZE_SIZE / rootBounds.getHeight();
          final double scaleZ = AUTORESIZE_SIZE / rootBounds.getDepth();
          scale = Math.min(scaleX, Math.min(scaleY, scaleZ));
        } else {
          scale = 1.0;
        }
        contentGroup.setScaleX(scale);
        contentGroup.setScaleY(scale);
        contentGroup.setScaleZ(scale);

        final Bounds contentBounds = rootNode.localToParent(rootBounds);
        backgroundBounds =
            new BoundingBox(
                0.0,
                0.0,
                contentBounds.getMinX() + contentBounds.getWidth(),
                contentBounds.getMinY() + contentBounds.getHeight());

        final Bounds unclippedRootBounds = computeUnclippedBounds(rootNode);
        assert unclippedRootBounds.getHeight() != 0.0;
        assert unclippedRootBounds.getWidth() != 0.0;
        assert rootNode.getParent() == contentGroup;

        final Bounds unclippedContentBounds = rootNode.localToParent(unclippedRootBounds);
        extensionBounds = computeExtensionBounds(backgroundBounds, unclippedContentBounds);
      }
    } else {
      backgroundBounds = new BoundingBox(0.0, 0.0, 320.0, 150.0);
      extensionBounds = new BoundingBox(0.0, 0.0, 0.0, 0.0);
    }

    backgroundPane.setPrefWidth(backgroundBounds.getWidth());
    backgroundPane.setPrefHeight(backgroundBounds.getHeight());
    extensionRect.setX(extensionBounds.getMinX());
    extensionRect.setY(extensionBounds.getMinY());
    extensionRect.setWidth(extensionBounds.getWidth());
    extensionRect.setHeight(extensionBounds.getHeight());

    contentSubScene.setWidth(contentGroup.getLayoutBounds().getWidth());
    contentSubScene.setHeight(contentGroup.getLayoutBounds().getHeight());
  }
  public void createAgencyTab() {

    Tab agencyTab = new Tab("Agency");
    final AgencyProperty agency = new AgencyProperty();

    VBox main = ViewLayout.getMainVBox("Add Agency", "Details");

    GridPane agencyForm = new GridPane();
    agencyForm.setHgap(ViewLayout.H_SPACE);
    agencyForm.setVgap(ViewLayout.V_SPACE);

    Label agencyCodeLabel = new Label("Agency Code");
    agencyCodeLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);
    final ViewIntegerBox agencyCodeBox =
        new ViewIntegerBox(agency.get().getAgencyCode(), agency.get().agencyCodeProperty());

    Label agencyNameLabel = new Label("Agency Name");
    agencyNameLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);
    final AgencyComboBox agencyNameBox = new AgencyComboBox("Agency Name", agency);

    Label agencyRemarksLabel = new Label("Remarks");
    agencyRemarksLabel.setPrefWidth(ViewLayout.LABEL_WIDTH);
    final TextBox agencyRemarksTextBox = new TextBox("Remarks", agency.get().remarksProperty());

    Button agencyButton = new Button("Submit");
    agencyButton.getStyleClass().add("submit-button");
    agencyButton.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent e) {

            if (agencyNameBox.getText().trim().length() > 0) {
              if (agencyRemarksTextBox.getText().trim().length() == 0) {
                agency.get().setRemarks(agency.get().getAgencyName());
              }

              PersistValidationDetails pvd =
                  ServiceManager.getValidationDetailsService(
                      "Agency", agency.get(), PersistType.UPDATE);

              pvd.restart();

              pvd.setOnSucceeded(
                  new EventHandler<WorkerStateEvent>() {

                    @Override
                    public void handle(WorkerStateEvent e) {

                      agency.get().clean();
                    }
                  });
            } else {
              Alert.showAlert(
                  Context.getWindowStage(), "Error", "Error", "Please enter agency name.");
            }
          }
        });

    agencyForm.add(agencyCodeLabel, 0, 0);
    agencyForm.add(agencyCodeBox, 1, 0);
    agencyForm.add(agencyNameLabel, 0, 1);
    agencyForm.add(agencyNameBox, 1, 1);
    agencyForm.add(agencyRemarksLabel, 0, 2);
    agencyForm.add(agencyRemarksTextBox, 1, 2);
    agencyForm.add(agencyButton, 1, 3);

    main.getChildren().add(agencyForm);

    agencyTab.setContent(ControlsUtil.makeScrollable(main));
    agencyTab.setClosable(false);
    getTabs().add(agencyTab);
  }