コード例 #1
0
  /** Creates the album playback view. */
  private void display() {
    scrollPos = 0;

    songScroller = new ScrollPane();
    songScroller.setMinWidth(PaneUtil.WIDTH - GoogleUINaviController.COVER_SIZE - 10);
    songScroller.setStyle("-fx-background-color:transparent;");
    songScroller.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);

    songBox = new VBox(6);
    songBox.setPadding(new Insets(3, 2, 2, 2));
    int track = 1;
    for (Song song : album.getSongs()) {
      HBox trackBox = new HBox();

      trackBox.setId(String.valueOf(song.getMID()));
      trackBox.setAlignment(Pos.BASELINE_LEFT);
      trackBox.setPadding(new Insets(2, 5, 2, 5));
      if (track == 1) {
        trackBox.setStyle(STYLE_ACTIVE);
        lastSongSelection = trackBox;
      } else {
        trackBox.setStyle(STYLE_INACTIVE);
      }

      BorderPane innerTrackBox = new BorderPane();
      HBox posBox = new HBox(5);
      posBox.setMinWidth(40);
      posBox.getChildren().add(createTrackText(track + "."));
      innerTrackBox.setLeft(posBox);
      HBox nameBox = new HBox(5);
      nameBox.setMinWidth(385);

      String name = song.getName();
      if (name.endsWith(".mp3")) {
        name = name.substring(0, name.length() - 4);
      }
      nameBox.getChildren().add(createTrackText(" " + name));
      innerTrackBox.setCenter(nameBox);
      innerTrackBox.setRight(createTrackText(song.getDuration()));

      trackBox.getChildren().add(innerTrackBox);
      songBox.getChildren().add(trackBox);

      track++;
    }

    songScroller.setOpacity(0);
    songScroller.setContent(songBox);
    albumNode.getChildren().add(songScroller);
  }
コード例 #2
0
  /*
   * Creates an artifact details popup. This popup's content is a tabbed view, with a tab for general properties,
   * creator properties, and relationships.
   * @param artifact
   */
  private void createArtifactDetailsPopup(PackageArtifact artifact) {

    // The property popup will consist of the three tabs, general, creator and relationships.
    TabPane propertiesPopup = new TabPane();
    propertiesPopup.getStyleClass().add(PROPERTIES_POPUP_CLASS);

    // Create the general tab, all the properties that are not creator properties, as
    // defined by the ontology will be located here.
    Tab generalTab = new Tab();
    generalTab.setClosable(false);
    generalTab.setText(labels.get(Labels.LabelKey.PACKAGE_ARTIFACT_GENERAL));
    ScrollPane generalPane = new ScrollPane();
    generalPane.setHvalue(500);
    generalPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    generalPane.setContent(createGeneralTab(artifact));
    generalPane.setMinWidth(500);
    generalPane.setFitToWidth(true);
    generalTab.setContent(generalPane);

    propertiesPopup.getTabs().add(generalTab);

    // Displays all the properties that are labeled as creator properties by the
    // ontology.
    Tab creatorTab = new Tab();
    creatorTab.setClosable(false);
    ScrollPane creatorPane = new ScrollPane();
    creatorPane.setHvalue(500);
    creatorPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    creatorPane.setContent(createCreatorTab(artifact));
    creatorPane.setMinWidth(500);
    creatorPane.setFitToWidth(true);
    creatorTab.setText(labels.get(Labels.LabelKey.PACKAGE_ARTIFACT_CREATOR));
    creatorTab.setContent(creatorPane);

    if (creatorPane.getContent() != null) {
      propertiesPopup.getTabs().add(creatorTab);
    }

    // Create the relationship tab that displays all relationships the artifact has.
    Tab relationshipTab = new Tab();
    relationshipTab.setClosable(false);
    relationshipTab.setText(labels.get(Labels.LabelKey.PACKAGE_ARTIFACT_RELATIONSHIPS));
    ScrollPane relationshipPane = new ScrollPane();
    relationshipPane.setHvalue(500);
    relationshipPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    relationshipPane.setContent(createRelationshipTab(artifact));
    relationshipPane.setMinWidth(500);
    relationshipPane.setFitToWidth(true);
    relationshipTab.setContent(relationshipPane);
    propertiesPopup.getTabs().add(relationshipTab);

    // Create the inheritance tab that displays all inheritable properties that an artifact has.
    Tab inheritanceTab = new Tab();
    inheritanceTab.setClosable(false);
    inheritanceTab.setText(labels.get(Labels.LabelKey.PACKAGE_ARTIFACT_INHERITANCE));
    ScrollPane inheritancePane = new ScrollPane();
    inheritancePane.setHvalue(500);
    inheritancePane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    inheritancePane.setContent(createInheritanceTab(artifact));
    inheritancePane.setMinWidth(500);
    inheritancePane.setFitToWidth(true);
    inheritanceTab.setContent(inheritancePane);
    propertiesPopup.getTabs().add(inheritanceTab);

    artifactDetailsLayout.setCenter(propertiesPopup);

    HBox popupControls = new HBox(24);
    popupControls.setAlignment(Pos.CENTER_RIGHT);

    popupControls.getStyleClass().add(VIEW_FOOTER_CLASS);
    popupControls.setPrefHeight(40);

    popupControls.getChildren().add(cancelPopupLink);

    popupControls.getChildren().add(applyPopupButton);

    artifactDetailsLayout.setBottom(popupControls);
  }