Package org.gudy.azureus2.ui.swt.shells

Examples of org.gudy.azureus2.ui.swt.shells.MessageBoxShell


   *
   *
   * @since 4.1.0.5
   */
  private void noDevices() {
    new MessageBoxShell(
        SWT.OK,
        "No Devices Found",
        "We couldn't find any devices.  Maybe you didn't install the Vuze Transcoder Plugin?").open(null);
    skinnedDialog.close();
  }
View Full Code Here


                }
              }

            }.start();
          } else {
            new MessageBoxShell(SWT.OK,
                MSG_ALREADY_EXISTS, new String[] {
                  " ",
                  dm.getDisplayName(),
                  MessageText.getString(MSG_ALREADY_EXISTS_NAME),
                }).open(null);
View Full Code Here

                    job.getName(),
                    job.getTarget().getDevice().getName(),
                    String.valueOf( job.getPercentComplete())
                });

            MessageBoxShell mb = new MessageBoxShell(
                title,
                text,
                new String[] {
                    MessageText.getString("UpdateWindow.quit"),
                    MessageText.getString("Content.alert.notuploaded.button.abort")
                }, 1);
           
            mb.open(null);
           
            mb.waitUntilClosed();
           
            return mb.getResult() == 0;

          }catch ( Throwable e ){
           
            Debug.out(e);
           
View Full Code Here

          String title = MessageText.getString(prefix + "title");
          String text = MessageText.getString(prefix + "text", new String[] {
            dm.getDisplayName()
          });

          MessageBoxShell mb = new MessageBoxShell(title, text,
              new String[] {
                MessageText.getString(prefix + "button.delete"),
                MessageText.getString(prefix + "button.cancel")
              }, 1);
          mb.setRelatedObject(dm);

          mb.open(null);
          int result = mb.waitUntilClosed();
          if (result != 0) {
            throw new GlobalManagerDownloadRemovalVetoException("", true);
          }
        }
      }
View Full Code Here

          String title = MessageText.getString(prefix + "title");
          String text = MessageText.getString(prefix + "text", new String[] {
            dm.getDisplayName()
          });

          MessageBoxShell mb = new MessageBoxShell(title, text,
              new String[] {
                MessageText.getString(prefix + "button.delete"),
                MessageText.getString(prefix + "button.cancel")
              }, 1);
          mb.setRelatedObject(dm);

          mb.open(null);
          int result = mb.waitUntilClosed();
          if (result != 0) {
            throw new GlobalManagerDownloadRemovalVetoException("", true);
          }
        }
      }
View Full Code Here

    skinnableManagerSWT.addSkinnableListener(MessageBoxShell.class.toString(),
        new UISkinnableSWTListener() {
          public void skinBeforeComponents(Composite composite,
              Object skinnableObject, Object[] relatedObjects) {

            MessageBoxShell shell = (MessageBoxShell) skinnableObject;

            TOTorrent torrent = null;
            DownloadManager dm = (DownloadManager) LogRelationUtils.queryForClass(
                relatedObjects, DownloadManager.class);
            if (dm != null) {
              torrent = dm.getTorrent();
            } else {
              torrent = (TOTorrent) LogRelationUtils.queryForClass(
                  relatedObjects, TOTorrent.class);
            }

            if (torrent != null && shell.getLeftImage() == null) {
              byte[] contentThumbnail = PlatformTorrentUtils.getContentThumbnail(torrent);
              if (contentThumbnail != null) {
                try {
                  ByteArrayInputStream bis = new ByteArrayInputStream(
                      contentThumbnail);
                  final Image img = new Image(Display.getDefault(), bis);

                  shell.setLeftImage(img);

                  composite.addDisposeListener(new DisposeListener() {
                    public void widgetDisposed(DisposeEvent e) {
                      if (!img.isDisposed()) {
                        img.dispose();
                      }
                    }
                  });
                } catch (Exception e) {

                }
              }
            }
          }

          public void skinAfterComponents(Composite composite,
              Object skinnableObject, Object[] relatedObjects) {
          }
        });

    skinnableManagerSWT.addSkinnableListener(
        MessageSlideShell.class.toString(), new UISkinnableSWTListener() {

          public void skinBeforeComponents(Composite composite,
              Object skinnableObject, Object[] relatedObjects) {
            if (skinnableObject instanceof MessageSlideShell) {
              final Image image = new Image(composite.getDisplay(), 250, 300);

              TOTorrent torrent = null;
              DownloadManager dm = (DownloadManager) LogRelationUtils.queryForClass(
                  relatedObjects, DownloadManager.class);
              if (dm != null) {
                torrent = dm.getTorrent();
              } else {
                torrent = (TOTorrent) LogRelationUtils.queryForClass(
                    relatedObjects, TOTorrent.class);
              }

              MessageSlideShell shell = (MessageSlideShell) skinnableObject;

              byte[] contentThumbnail = PlatformTorrentUtils.getContentThumbnail(torrent);
              GC gc = new GC(image);
              try {
                gc.setBackground(gc.getDevice().getSystemColor(
                    SWT.COLOR_WIDGET_BACKGROUND));
                gc.fillRectangle(image.getBounds());

                if (contentThumbnail != null) {

                  try {
                    ByteArrayInputStream bis = new ByteArrayInputStream(
                        contentThumbnail);
                    final Image img = new Image(Display.getDefault(), bis);
                    Rectangle imgBounds = img.getBounds();
                    double pct = 35.0 / imgBounds.height;
                    int w = (int) (imgBounds.width * pct);

                    try {
                      gc.setAdvanced(true);
                      gc.setInterpolation(SWT.HIGH);
                    } catch (Exception e) {
                      // not important if we can't set advanced
                    }

                    gc.drawImage(img, 0, 0, imgBounds.width, imgBounds.height,
                        0, 265, w, 35);
                    img.dispose();
                  } catch (Exception e) {

                  }

                }
              } finally {
                gc.dispose();
              }
              shell.setImgPopup(image);

              composite.addListener(SWT.Dispose, new Listener() {
                public void handleEvent(Event event) {
                  if (!image.isDisposed()) {
                    image.dispose();
View Full Code Here

   * @since 4.1.0.5
   */
  private void createProfileList(SWTSkinObjectContainer soList,
      String source) {
    if (selectedTranscodeTarget == null && selectedDeviceTemplate == null) {
      new MessageBoxShell(SWT.OK, "No Device", "No Device Selected!?").open(null);
      shell.dispose();
      return;
    }

    if (selectedTranscodeTarget != null) {
      try {
        TranscodeProfile defaultProfile = selectedTranscodeTarget.getDefaultTranscodeProfile();
        if (defaultProfile != null) {
          // user chose not to ask
         
          if ( selectedTranscodeTarget.getTranscodeRequirement() == TranscodeTarget.TRANSCODE_NEVER ){
              // take note of never-xcode override
            selectedProfile = selectedTranscodeTarget.getBlankProfile();
          }else{
            selectedProfile = defaultProfile;
          }
          shell.dispose();
          return;
        }
      } catch (TranscodeException e) {
      }
    }

    if (transcodeProfiles.length == 0 || selectedTranscodeTarget.getTranscodeRequirement() == TranscodeTarget.TRANSCODE_NEVER ){
      if ( selectedTranscodeTarget != null ){
        selectedProfile = selectedTranscodeTarget.getBlankProfile();
        shell.dispose();
        return;
      }
      new MessageBoxShell(SWT.OK, "No Profiles", "No Profiles for "
          + selectedTranscodeTarget.getDevice().getName()).open(null);
      shell.dispose();
      return;
    }

View Full Code Here

   *
   *
   * @since 4.1.0.5
   */
  private void noDevices() {
    new MessageBoxShell(
        SWT.OK,
        "No Devices Found",
        "We couldn't find any devices.  Maybe you didn't install the Vuze Transcoder Plugin?").open(null);
    shell.dispose();
  }
View Full Code Here

  // @see com.aelitis.azureus.ui.UIFunctions#getUserPrompter(java.lang.String, java.lang.String, java.lang.String[], int)
  public UIFunctionsUserPrompter getUserPrompter(String title, String text,
      String[] buttons, int defaultOption) {

    MessageBoxShell mb = new MessageBoxShell(title, text, buttons,
        defaultOption);
    return mb;
  }
View Full Code Here

      if (dataReceive >= 1024) {
        maxBandwidth = dataReceive / 1024;
      }
    }

    SpeedScaleShell speedScale = new SpeedScaleShell() {
      public String getStringValue(int value, String sValue) {
        if (sValue != null) {
          return prefix + ": " + sValue;
        }
        if (value == 0) {
          return MessageText.getString("MyTorrentsView.menu.setSpeed.unlimited");
        }
        if (value == -1) {
          return MessageText.getString("ConfigView.auto");
        }
        return prefix
            + ": "
            + (value == 0 ? MessageText.getString("ConfigView.unlimited")
                : DisplayFormatters.formatByteCountToKiBEtcPerSec(
                    getValue() * 1024, true));
      }
    };
    int max = unlim ? (isUpSpeed ? 100 : 800) : maxBandwidth * 5;
    if (max < 50) {
      max = 50;
    }
    speedScale.setMaxValue(max);
    speedScale.setMaxTextValue(9999999);

    final String config_prefix = "config.ui.speed.partitions.manual."
        + (isUpSpeed ? "upload" : "download") + ".";
    int lastValue = COConfigurationManager.getIntParameter(config_prefix
        + "last", -10);

    Integer[] speed_limits;
    if (COConfigurationManager.getBooleanParameter(config_prefix + "enabled",
        false)) {
      speed_limits = parseSpeedPartitionString(COConfigurationManager.getStringParameter(
          config_prefix + "values", ""));
    } else {
      speed_limits = getGenericSpeedList(6, maxBandwidth);
    }
    if (speed_limits != null) {
      for (int i = 0; i < speed_limits.length; i++) {
        int value = speed_limits[i].intValue();
        if (value > 0) {
          speedScale.addOption(DisplayFormatters.formatByteCountToKiBEtcPerSec(
              value * 1024, true), value);
          if (value == lastValue) {
            lastValue = -10;
          }
        }
      }
    }
    speedScale.addOption(
        MessageText.getString("MyTorrentsView.menu.setSpeed.unlimited"), 0);
    speedScale.addOption(MessageText.getString("ConfigView.auto"), -1);

    if (lastValue > 0) {
      speedScale.addOption(DisplayFormatters.formatByteCountToKiBEtcPerSec(
          lastValue * 1024, true), lastValue);
    }

    // SWT BUG: on windows/linux, if mouse is down on shell open, all mouse events
    // will not reflect this
    if (speedScale.open(auto ? -1 : maxBandwidth, Constants.isWindows
        || Constants.isLinux)) {
      int value = speedScale.getValue();

      if (!speedScale.wasMenuChosen() || lastValue == value) {
        COConfigurationManager.setParameter(config_prefix + "last",
            maxBandwidth);
      }

      if (value >= 0) {
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.ui.swt.shells.MessageBoxShell

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.