コード例 #1
0
 private void SetListText(TextLabel rowOne, TextLabel rowTwo, Item currentItem) {
   if (currentItem instanceof Album) {
     rowOne.SetText(
         String.format("Artist: %s; Album: %s", currentItem.getCreator(), currentItem.getName()));
     rowTwo.SetText(
         String.format(
             "Genre: %s; Year: %d; Rating: %.2f; Cost: %.2f",
             currentItem.getGenre(),
             currentItem.getYearOfRelease(),
             currentItem.getRating(),
             currentItem.getPrice()));
   } else if (currentItem instanceof Film) {
     rowOne.SetText(
         String.format(
             "Title: %s; Producer: %s", currentItem.getName(), currentItem.getCreator()));
     rowTwo.SetText(
         String.format(
             "Genre: %s; Year: %d; Rating: %.2f; Cost: %.2f",
             currentItem.getGenre(),
             currentItem.getYearOfRelease(),
             currentItem.getRating(),
             currentItem.getPrice()));
   } else if (currentItem instanceof Audiobook) {
     rowOne.SetText(
         String.format(
             "Title: %s; Author: %s",
             currentItem.getName(), currentItem.getCreator(), currentItem.getRating()));
     rowTwo.SetText(
         String.format(
             "Genre: %s; Year: %d; Rating: %.2f; Cost: %.2f",
             currentItem.getGenre(),
             currentItem.getYearOfRelease(),
             currentItem.getRating(),
             currentItem.getPrice()));
   }
 }
コード例 #2
0
 private void SetModify(int itemIndex) {
   Item current = DataLoader.getItemById(itemIndex);
   if (current != null) {
     CurrentModifyWindowId = itemIndex;
     ModifyItem.SetParent(MainFrame);
     Driver.GetGuiMain().GetTextBoxes();
     ((TextLabel) ModifyItem.GetChild("Id")).SetText("ID #" + itemIndex);
     ((TextBox) ModifyItem.GetChild("TitleInput")).SetText(current.getName());
     ((TextBox) ModifyItem.GetChild("ArtistInput")).SetText(current.getCreator());
     ((TextBox) ModifyItem.GetChild("YearInput")).SetText("" + current.getYearOfRelease());
     ((TextBox) ModifyItem.GetChild("GenreInput")).SetText(current.getGenre());
     ((TextBox) ModifyItem.GetChild("CostInput")).SetText("" + current.getPrice());
     ((TextBox) ModifyItem.GetChild("DurationInputH")).SetText("" + current.getHour());
     ((TextBox) ModifyItem.GetChild("DurationInputM")).SetText("" + current.getMinute());
     ((TextBox) ModifyItem.GetChild("DurationInputS")).SetText("" + current.getSecond());
     ((TextBox) ModifyItem.GetChild("PreviewInput")).SetText("" + current.getPreview());
     ((CheckBox) ModifyItem.GetChild("HiddenInput")).SetSelected(current.isVisible());
     ((CheckBox) ModifyItem.GetChild("HiddenInput"))
         .SetText(
             ((CheckBox) ModifyItem.GetChild("HiddenInput")).GetSelected() ? "true" : "false");
   }
 }