コード例 #1
0
ファイル: ItemAppImpl.java プロジェクト: txtdis/JavaFX
 private TabPane tabPane() {
   TabPane tabPane = new TabPane();
   tabPane.setStyle("-fx-tab-min-width: 80;");
   tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
   tabPane.getTabs().addAll(tabs);
   return tabPane;
 }
コード例 #2
0
ファイル: EditorTabManager.java プロジェクト: finanzer/epubfx
  public void openImageFile(Resource resource) {
    Tab tab = new Tab();
    tab.setClosable(true);
    if (resource == null) {
      Dialogs.create()
          .owner(tabPane)
          .title("Datei nicht vorhanden")
          .message(
              "Die angeforderte Datei ist nicht vorhanden und kann deshalb nicht geöffnet werden.")
          .showError();
      return;
    }
    tab.setText(resource.getFileName());

    ImageResource imageResource = (ImageResource) resource;
    ImageViewerPane pane = new ImageViewerPane();
    pane.setImageResource(imageResource);

    ImageView imageView = pane.getImageView();
    imageView.setImage(imageResource.asNativeFormat());
    imageView.setFitHeight(-1);
    imageView.setFitWidth(-1);

    Label imagePropertiesLabel = pane.getImagePropertiesLabel();
    imagePropertiesLabel.setText(imageResource.getImageDescription());

    tab.setContent(pane);
    tab.setUserData(resource);
    tabPane.getTabs().add(tab);
    tabPane.getSelectionModel().select(tab);
  }
コード例 #3
0
ファイル: EditorTabManager.java プロジェクト: finanzer/epubfx
 private boolean isTabAlreadyOpen(Resource resource) {
   boolean found = false;
   List<Tab> tabs = tabPane.getTabs();
   for (Tab tab : tabs) {
     if (tab.getUserData().equals(resource)) {
       tabPane.getSelectionModel().select(tab);
       found = true;
     }
   }
   return found;
 }
コード例 #4
0
  private void addTab(String playerOrChannelName, AbstractChatTab tab) {
    nameToChatTab.put(playerOrChannelName, tab);
    tab.setOnClosed(event -> nameToChatTab.remove(playerOrChannelName));

    if (chatService.isDefaultChannel(tab.getId())) {
      chatsTabPane.getTabs().add(0, tab);
    } else {
      chatsTabPane.getTabs().add(tab);
    }

    chatsTabPane.getSelectionModel().select(0);
  }
コード例 #5
0
  @FXML
  public void handleInspectionButton() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setInitialDirectory(new File("C:\\Users\\Christoph\\OneDrive\\newAnalysis"));
    fileChooser.setTitle("Choose Invariant File");
    fileChooser.getExtensionFilters().addAll(new ExtensionFilter("Invariant Files", "*.txt"));

    File selectedFile = fileChooser.showOpenDialog(stage);
    if (selectedFile != null) {
      try {
        FXMLLoader loader = new FXMLLoader();
        BorderPane root =
            (BorderPane)
                loader.load(getClass().getResource("InvariantInspectorTab.fxml").openStream());
        InvariantInspectorTabController controller =
            (InvariantInspectorTabController) loader.getController();
        controller.setPrimaryStage(stage);
        controller.loadData(selectedFile);

        Tab tab = new Tab();
        tab.setContent(root);

        tabPane.getTabs().add(tab);

      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }
コード例 #6
0
ファイル: EditorTabManager.java プロジェクト: finanzer/epubfx
  public void setTabPane(TabPane tabPane) {
    this.tabPane = tabPane;

    tabPane
        .getSelectionModel()
        .selectedItemProperty()
        .addListener(
            new ChangeListener<Tab>() {
              @Override
              public void changed(
                  ObservableValue<? extends Tab> observable, Tab oldValue, Tab newValue) {
                Resource resource;
                if (newValue != null && newValue.getContent() instanceof CodeEditor) {
                  resource = (Resource) newValue.getUserData();
                  currentSearchableResource.set(resource);
                  currentEditor.setValue(
                      (CodeEditor) tabPane.getSelectionModel().getSelectedItem().getContent());

                  if (newValue.getContent() instanceof XHTMLCodeEditor) {
                    currentXHTMLResource.set(resource);
                  } else if (newValue.getContent() instanceof CssCodeEditor) {
                    currentCssResource.set(resource);
                  } else if (newValue.getContent() instanceof XMLCodeEditor) {
                    currentXMLResource.set(resource);
                  }
                }
              }
            });
  }
コード例 #7
0
ファイル: SandboxStage.java プロジェクト: punki/jitwatch
  private void loadDefaultEditors() {
    tabPane.getTabs().clear();

    addEditor(new File(Sandbox.SANDBOX_SOURCE_DIR.toFile(), "SimpleInliningTest.java"));

    saveEditorPaneConfig();
  }
コード例 #8
0
  @FXML
  private void refreshClicked(ActionEvent event) {

    populateAdminHeaders();
    Tab t = tabPane.getSelectionModel().getSelectedItem();
    if (t != null) {
      if (t == customersTab) {
        customerTabController.reloadData();
      }
      if (t == lineInfoTab) {
        lineInfoTabController.reloadData();
      }
      if (t == pausedCustTab) {
        pausedCustTabController.reloadData();
      }
      if (t == hawkerTab) {
        hawkerTabController.reloadData();
      }
      if (t == lineDistTab) {
        lineDistTabController.reloadData();
      }
      if (t == additionalItemsTab) {
        additionalItemsTabController.reloadData();
      }
      if (t == productsTab) {
        productsTabController.reloadData();
      }
      if (t == stopHistoryTab) {
        stopHistTabController.reloadData();
      }
    }
  }
コード例 #9
0
ファイル: SandboxStage.java プロジェクト: punki/jitwatch
  private void saveUnsavedEditors() {
    for (Tab tab : tabPane.getTabs()) {
      EditorPane pane = (EditorPane) tab.getContent();

      pane.promptSave();
    }
  }
コード例 #10
0
ファイル: WorkSpaceTabVC.java プロジェクト: brandonho36/SLogo
 public void addNewTab(UserInterfaceVC pane) {
   myWorkSpaces.add(pane);
   Tab t = new Tab();
   t.setContent(pane.getGroup());
   t.setText("Work Space " + String.valueOf(numTabs + 1));
   numTabs++;
   myTabPane.getTabs().add(t);
 }
コード例 #11
0
ファイル: TabService.java プロジェクト: jaredmorgs/AsciidocFX
  public void addImageTab(Path imagePath) {

    TabPane previewTabPane = controller.getPreviewTabPane();

    ImageTab tab = new ImageTab();
    tab.setPath(imagePath);
    tab.setText(imagePath.getFileName().toString());

    if (previewTabPane.getTabs().contains(tab)) {
      previewTabPane.getSelectionModel().select(tab);
      return;
    }

    Image image = new Image(IOHelper.pathToUrl(imagePath));
    ImageView imageView = new ImageView(image);
    imageView.setPreserveRatio(true);

    imageView.setFitWidth(previewTabPane.getWidth());

    previewTabPane
        .widthProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              imageView.setFitWidth(previewTabPane.getWidth());
            });

    Tooltip tip = new Tooltip(imagePath.toString());
    Tooltip.install(tab.getGraphic(), tip);

    ScrollPane scrollPane = new ScrollPane();
    scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
    scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
    scrollPane.setContent(imageView);
    scrollPane.addEventFilter(
        ScrollEvent.SCROLL,
        e -> {
          if (e.isControlDown() && e.getDeltaY() > 0) {
            // zoom in
            imageView.setFitWidth(imageView.getFitWidth() + 16.0);
          } else if (e.isControlDown() && e.getDeltaY() < 0) {
            // zoom out
            imageView.setFitWidth(imageView.getFitWidth() - 16.0);
          }
        });

    tab.setContent(scrollPane);

    TabPane tabPane = previewTabPane;
    tabPane.getTabs().add(tab);
    tabPane.getSelectionModel().select(tab);
  }
コード例 #12
0
ファイル: WorkSpaceTabVC.java プロジェクト: brandonho36/SLogo
  public void setTabTitles() {

    for (Tab t : myTabPane.getTabs()) {

      t.setText("Work Space " + String.valueOf(numTabs + 1));

      numTabs++;
    }
  }
コード例 #13
0
  @Override
  public void onUserJoinedChannel(String channelName, ChatUser chatUser) {
    Platform.runLater(
        () -> {
          addAndGetChannelTab(channelName);

          if (isCurrentUser(chatUser)) {
            connectingProgressPane.setVisible(false);
            chatsTabPane.setVisible(true);
          }
        });
  }
コード例 #14
0
ファイル: SandboxStage.java プロジェクト: punki/jitwatch
  private void loadLastEditorPanes() {
    List<String> panes = config.getLastEditorPaneList();

    if (panes.size() == 0) {
      loadDefaultEditors();
    } else {
      tabPane.getTabs().clear();

      for (String panePath : panes) {
        addEditor(new File(panePath));
      }
    }
  }
コード例 #15
0
ファイル: EditorTabManager.java プロジェクト: finanzer/epubfx
 public void refreshAll() {
   List<Tab> tabs = tabPane.getTabs();
   for (Tab tab : tabs) {
     Resource resource = (Resource) tab.getUserData();
     if (tab.getContent() instanceof CodeEditor) {
       CodeEditor editor = (CodeEditor) tab.getContent();
       try {
         editor.setCode(new String(resource.getData(), "UTF-8"));
       } catch (IOException e) {
         logger.error("", e);
       }
     }
   }
 }
コード例 #16
0
  /*
   * Sets up the default configuration
   */
  public UserBorderPane() {

    // sets up the appropriate functionality for the menu
    configureMenuBar();

    // When a certain key is pressed
    this.addEventHandler(KeyEvent.KEY_PRESSED, this);

    // adds the tabs to the left of the screen
    contentTab.setSide(Side.LEFT);

    // adds tab pane to the center
    this.setCenter(contentTab);
  }
コード例 #17
0
ファイル: SandboxStage.java プロジェクト: punki/jitwatch
  private void saveEditorPaneConfig() {
    List<String> editorPanePaths = new ArrayList<>();

    for (Tab tab : tabPane.getTabs()) {
      EditorPane pane = (EditorPane) tab.getContent();

      if (pane != null && pane.getSourceFile() != null) {
        String editorPanePath = pane.getSourceFile().getAbsolutePath();
        editorPanePaths.add(editorPanePath);
      }
    }

    config.setLastEditorPaneList(editorPanePaths);
    config.saveConfig();
  }
コード例 #18
0
  private void setupScene() {

    splitPane = new SplitPane();
    splitPane.setOrientation(Orientation.HORIZONTAL);
    scene = new Scene(splitPane, 800, 600);

    Insuliin insuliin = new Insuliin();

    TabPane tabPane = new TabPane();
    Tab tab1 = new Tab();
    Tab tab2 = new Tab();
    tab1.setText("Toidud");
    tab2.setText("Salvestused");

    tab1.setContent(tabel2.vBox);
    tabPane.getTabs().addAll(tab1, tab2);

    splitPane.getItems().addAll(insuliin.vBox, tabPane);
    splitPane.setDividerPositions(0.5f);

    lava.setScene(scene);
    lava.setTitle("ülemine ja alumine");
    lava.show();
  }
コード例 #19
0
 @Override
 public void changed(
     ObservableValue<? extends TreeItem<Box>> observableValue,
     TreeItem<Box> boxTreeItem,
     TreeItem<Box> boxTreeItem2) {
   if (boxTreeItem2 == null) {
     return;
   }
   String id = Path.createPath(boxTreeItem2.getValue());
   Tab t = null;
   for (Tab tab : tabPane.getTabs()) {
     if (tab.getId().equals(id)) {
       tabPane.getSelectionModel().select(tab);
       t = tab;
     }
   }
   if (t == null) {
     t = new Tab(id);
     t.setId(id);
     tabPane.getTabs().addAll(t);
     t.setContent(new BoxPane(boxTreeItem2.getValue()));
     tabPane.getSelectionModel().select(t);
   }
 }
コード例 #20
0
ファイル: SandboxStage.java プロジェクト: punki/jitwatch
  private void addEditor(File filename) {
    final EditorPane pane = new EditorPane(this);

    if (filename != null) {
      pane.loadSource(filename);
    }

    final Tab tab = new Tab();
    tab.setContent(pane);
    tab.setText(pane.getName());

    EventHandler<Event> closeHandler =
        new EventHandler<Event>() {
          @Override
          public void handle(Event e) {
            if (pane.isModified()) {
              pane.promptSave();
            }

            tabPane.getTabs().remove(tab);
          }
        };

    // JavaFX 2.2 (from Java 7) has no onCloseRequestProperty
    if (JITWatchUI.IS_JAVA_FX2) {
      tab.setOnClosed(closeHandler);
    } else {
      // Use reflection to call setOnCloseRequestProperty for Java 8
      try {
        MethodType mt = MethodType.methodType(void.class, EventHandler.class);

        MethodHandle mh = MethodHandles.lookup().findVirtual(Tab.class, "setOnCloseRequest", mt);

        // fails with invokeExact due to generic type erasure?
        mh.invoke(tab, closeHandler);

      } catch (Throwable t) {
        logger.error("Exception: {}", t.getMessage(), t);
      }
    }

    tabPane.getTabs().add(tab);

    pane.requestFocus();

    setVMLanguage(pane);
    saveEditorPaneConfig();
  }
コード例 #21
0
ファイル: WebKitBrowser.java プロジェクト: sumitlakra/BurpKit
  private void createStatusBar() {
    statusBar = new StatusBar();
    statusBar.setText("Alerts");

    Button alertsButton = new Button();
    alertsButton.textProperty().bind(numberOfAlerts);
    alertsButton.setBackground(
        new Background(new BackgroundFill(Color.ORANGE, new CornerRadii(2), new Insets(4))));
    alertsButton.setOnAction(
        event -> {
          isDetailNodeVisible.setValue(true);
          detailPane.getSelectionModel().select(0);
        });

    statusBar.getLeftItems().add(alertsButton);
    statusBar.progressProperty().bind(webEngine.getLoadWorker().progressProperty());
  }
コード例 #22
0
ファイル: EditorTabManager.java プロジェクト: finanzer/epubfx
  public void refreshImageViewer(Resource resourceToUpdate) {
    List<Tab> tabs = tabPane.getTabs();
    for (Tab tab : tabs) {
      Resource resource = (Resource) tab.getUserData();
      if (resourceToUpdate.equals(resource)) {
        ImageResource imageResource = (ImageResource) resourceToUpdate;
        logger.info("refreshing image resource");
        ImageViewerPane imageViewerPane = (ImageViewerPane) tab.getContent();
        ImageView imageView = imageViewerPane.getImageView();
        imageView.setImage(imageResource.asNativeFormat());
        imageView.setFitHeight(-1);
        imageView.setFitWidth(-1);

        Label imagePropertiesLabel = imageViewerPane.getImagePropertiesLabel();
        imagePropertiesLabel.setText(imageResource.getImageDescription());
      }
    }
  }
コード例 #23
0
ファイル: TabService.java プロジェクト: jaredmorgs/AsciidocFX
 public void initializeTabChangeListener(TabPane tabPane) {
   ReadOnlyObjectProperty<Tab> itemProperty = tabPane.getSelectionModel().selectedItemProperty();
   itemProperty.addListener(
       (observable, oldValue, selectedTab) -> {
         if (Objects.isNull(selectedTab)) return;
         threadService.runActionLater(
             () -> {
               EditorPane editorPane = ((MyTab) selectedTab).getEditorPane();
               if (Objects.nonNull(editorPane)) {
                 try {
                   editorPane.rerender();
                   editorPane.focus();
                 } catch (Exception e) {
                   logger.error("Problem occured after changing tab {}", selectedTab, e);
                 }
               }
             });
       });
 }
コード例 #24
0
ファイル: SandboxStage.java プロジェクト: punki/jitwatch
  @Override
  public void setModified(EditorPane pane, boolean isModified) {
    for (Tab tab : tabPane.getTabs()) {
      EditorPane currentPane = (EditorPane) tab.getContent();

      if (currentPane == pane) {
        String tabText = tab.getText();

        if (isModified) {
          if (!tabText.endsWith(S_ASTERISK)) {
            tab.setText(tabText + S_ASTERISK);
          }
        } else {
          if (tabText.endsWith(S_ASTERISK)) {
            tab.setText(tabText.substring(0, tabText.length() - 1));
          }
        }
      }
    }
  }
コード例 #25
0
ファイル: CodeTab.java プロジェクト: LapisBlue/Nocturne
  public CodeTab(TabPane pane, String className, String displayName) {
    this.className = className;
    this.setText(CLASS_PATH_SEPARATOR_PATTERN.matcher(displayName).replaceAll("."));

    pane.getTabs().add(this);

    FXMLLoader loader = new FXMLLoader(ClassLoader.getSystemResource("fxml/CodeTab.fxml"));
    loader.setResources(Main.getResourceBundle());
    loader.setRoot(this);
    loader.setController(this);

    try {
      loader.load();
    } catch (IOException e) {
      e.printStackTrace();
    }

    CODE_TABS.put(className, this);
    getTabPane().getSelectionModel().select(this);

    this.setOnClosed(event -> CODE_TABS.remove(this.getClassName()));
  }
コード例 #26
0
ファイル: SandboxStage.java プロジェクト: punki/jitwatch
  private void runSandbox(File fileToRun) {
    try {
      Platform.runLater(
          new Runnable() {
            @Override
            public void run() {
              taLog.setText(S_EMPTY);
            }
          });

      String language = comboBoxVMLanguage.getValue();

      if (language != null) {
        List<File> compileList = new ArrayList<>();

        for (Tab tab : tabPane.getTabs()) {
          EditorPane pane = (EditorPane) tab.getContent();

          File sourceFile = pane.getSourceFile();

          if (sourceFile != null) {
            if (LanguageManager.isCompilable(language, sourceFile)) {
              compileList.add(sourceFile);
            }
          }
        }

        if (compileList.size() > 0) {
          sandbox.runSandbox(language, compileList, fileToRun);
        } else {
          log("Nothing to compile?");
        }
      }
    } catch (Exception e) {
      logger.error("Sandbox failure", e);
    }
  }
コード例 #27
0
  @Override
  public void initialize(URL arg0, ResourceBundle arg1) {
    populateAdminHeaders();
    loadTabs();
    tabPane
        .getSelectionModel()
        .selectedItemProperty()
        .addListener(
            new ChangeListener<Tab>() {

              @Override
              public void changed(
                  ObservableValue<? extends Tab> observable, Tab oldValue, Tab newValue) {
                if (oldValue != null) {
                  if (oldValue == customersTab) {
                    customerTabController.releaseVariables();
                  }
                  if (oldValue == lineInfoTab) {
                    lineInfoTabController.releaseVariables();
                  }
                  if (oldValue == pausedCustTab) {
                    pausedCustTabController.releaseVariables();
                  }
                  if (oldValue == hawkerTab) {
                    hawkerTabController.releaseVariables();
                  }
                  if (oldValue == lineDistTab) {
                    lineDistTabController.releaseVariables();
                  }
                  if (oldValue == additionalItemsTab) {
                    additionalItemsTabController.releaseVariables();
                  }
                  if (oldValue == productsTab) {
                    productsTabController.releaseVariables();
                  }
                  if (oldValue == stopHistoryTab) {
                    stopHistTabController.releaseVariables();
                  }
                  System.gc();
                }

                if (newValue != null) {
                  if (newValue == customersTab) {
                    customerTabController.reloadData();
                  }
                  if (newValue == lineInfoTab) {
                    lineInfoTabController.reloadData();
                  }
                  if (newValue == pausedCustTab) {
                    pausedCustTabController.reloadData();
                  }
                  if (newValue == hawkerTab) {
                    hawkerTabController.reloadData();
                  }
                  if (newValue == lineDistTab) {
                    lineDistTabController.reloadData();
                  }
                  if (newValue == additionalItemsTab) {
                    additionalItemsTabController.reloadData();
                  }
                  if (newValue == productsTab) {
                    productsTabController.reloadData();
                  }
                  if (newValue == stopHistoryTab) {
                    stopHistTabController.reloadData();
                  }
                }
              }
            });
    tabPane.getSelectionModel().selectFirst();

    /*logoutButton.setOnKeyPressed(new EventHandler<KeyEvent>() {

    	@Override
    	public void handle(KeyEvent event) {
    		if (event.getCode() == KeyCode.ENTER) {
    			try {
    				logoutClicked(new ActionEvent());
    			} catch (IOException e) {
    				Main._logger.debug("Error :",e);
    				e.printStackTrace();
    			}
    		}
    	}
    });*/
  }
コード例 #28
0
  private void loadTabs() {
    tabPane.getTabs().clear();
    try {
      FXMLLoader customerTabLoader = new FXMLLoader(getClass().getResource("A-CustomersTab.fxml"));
      Parent custroot = (Parent) customerTabLoader.load();
      customerTabController = customerTabLoader.<ACustomerInfoTabController>getController();
      customersTab = new Tab();
      customersTab.setText("Customers");
      customersTab.setContent(custroot);

      hawkerTab = new Tab();
      FXMLLoader hawkerTabLoader = new FXMLLoader(getClass().getResource("A-HawkerInfoTab.fxml"));
      Parent hawkerroot = (Parent) hawkerTabLoader.load();
      hawkerTabController = hawkerTabLoader.<AHawkerInfoTabController>getController();
      hawkerTab.setText("Hawkers");
      hawkerTab.setContent(hawkerroot);

      hawkerTab.setOnSelectionChanged(
          new EventHandler<Event>() {

            @Override
            public void handle(Event event) {

              hawkerTabController.reloadData();
            }
          });

      lineInfoTab = new Tab();
      FXMLLoader lineInfoTabLoader = new FXMLLoader(getClass().getResource("A-LineInfoTab.fxml"));
      Parent lineinforoot = (Parent) lineInfoTabLoader.load();
      lineInfoTabController = lineInfoTabLoader.<ALineInfoTabController>getController();
      lineInfoTab.setText("Line Information");
      lineInfoTab.setContent(lineinforoot);

      lineDistTab = new Tab();
      FXMLLoader lineDistTabLoader =
          new FXMLLoader(getClass().getResource("A-LineDistributorTab.fxml"));
      Parent linedistroot = (Parent) lineDistTabLoader.load();
      lineDistTabController = lineDistTabLoader.<ALineDistributorTabController>getController();
      lineDistTab.setText("Line Distribution Boy");
      lineDistTab.setContent(linedistroot);

      additionalItemsTab = new Tab();
      FXMLLoader additionalItemsTabLoader =
          new FXMLLoader(getClass().getResource("AdditionalItems.fxml"));
      Parent additionalItemsRoot = (Parent) additionalItemsTabLoader.load();
      additionalItemsTabController =
          additionalItemsTabLoader.<AdditionalItemsController>getController();
      additionalItemsTab.setText("Additional Items");
      additionalItemsTab.setContent(additionalItemsRoot);

      productsTab = new Tab();
      FXMLLoader productsTabLoader = new FXMLLoader(getClass().getResource("AProductsTab.fxml"));
      Parent productsRoot = (Parent) productsTabLoader.load();
      productsTabController = productsTabLoader.<AProductsTabController>getController();
      productsTab.setText("Products");
      productsTab.setContent(productsRoot);

      pausedCustTab = new Tab();
      FXMLLoader pausedCustTabLoader =
          new FXMLLoader(getClass().getResource("A-PausedCustomersTab.fxml"));
      Parent pausedcustroot = (Parent) pausedCustTabLoader.load();
      pausedCustTabController = pausedCustTabLoader.<APausedCustomerTabController>getController();
      pausedCustTab.setText("Stopped Customers");
      pausedCustTab.setContent(pausedcustroot);

      stopHistoryTab = new Tab();
      FXMLLoader stopHistTabLoader = new FXMLLoader(getClass().getResource("AStopHistoryTab.fxml"));
      Parent stopHistRoot = (Parent) stopHistTabLoader.load();
      stopHistTabController = stopHistTabLoader.<AStopHistoryTabController>getController();
      stopHistoryTab.setText("Stop History");
      stopHistoryTab.setContent(stopHistRoot);

      tabPane
          .getTabs()
          .addAll(
              hawkerTab,
              lineInfoTab,
              customersTab,
              lineDistTab,
              productsTab,
              additionalItemsTab,
              pausedCustTab,
              stopHistoryTab);
    } catch (IOException e) {

      Main._logger.debug("Error :", e);
      e.printStackTrace();
    }
  }
コード例 #29
0
  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);
  }
コード例 #30
0
  @Override
  public Node showView() {

    Tab tab = new Tab("View Heat CHart : Search");

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

      final ObservableList<HeatChartMaster> mailboxData = FXCollections.observableArrayList();
      main.getChildren()
          .addAll(SearchBoxUtil.getHeatChartSearchBox("Heat Chart Number", mailboxData));

      final TableView<HeatChartMaster> tableMailbox = TableUtil.createSearchHeatChartTable();

      main.getChildren().add(ControlsUtil.makeScrollable(tableMailbox));

      tableMailbox.setItems(mailboxData);

      tableMailbox.setOnMouseClicked(
          new EventHandler<MouseEvent>() {

            @Override
            public void handle(MouseEvent mouseEvent) {

              if (mouseEvent.getClickCount() == 2) {

                HeatChartMaster selHeatChart = tableMailbox.getSelectionModel().getSelectedItem();
                if (selHeatChart != null) {

                  createViewTab(selHeatChart);
                }
              }
            }
          });

      EventHandler<ActionEvent> viewHeatChartEventHandler =
          new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent e) {

              HeatChartMaster heatChart = tableMailbox.getSelectionModel().getSelectedItem();
              if (heatChart != null) {

                createViewTab(heatChart);
              }
            }
          };

      tableMailbox.setContextMenu(
          TableContextMenu.getViewHeatChartContextMenu(viewHeatChartEventHandler));

      tab.setContent(ControlsUtil.makeScrollable(main));
      tab.setClosable(false);
      pane.getTabs().add(tab);
      pane.setSide(Side.TOP);

      return pane;
    } catch (HibernateException e) {
      LoggerUtil.getLogger().debug(e);
      Alert.showAlert(
          Context.getWindowStage(),
          "Error",
          "Error",
          "Some error occured. Details...\n" + e.getMessage());

      return new ErrorView().showView();
    } catch (MalformedURLException ex) {
      LoggerUtil.getLogger().debug(ex);
      Alert.showAlert(
          Context.getWindowStage(),
          "Error",
          "Error",
          "Some error occured. Details...\n" + ex.getMessage());

      return new ErrorView().showView();
    }
  }