Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.Image


    gridData.horizontalIndent = 15;
    gridData.horizontalSpan = 2;
    cMaxUploadSpeedOptionsArea.setLayoutData(gridData);

    ImageLoader imageLoader = ImageLoader.getInstance();
    Image img = imageLoader.getImage("subitem");

    label = new Label(cMaxUploadSpeedOptionsArea, SWT.NULL);
    img.setBackground(label.getBackground());
    gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    label.setLayoutData(gridData);
    label.setImage(img);

    gridData = new GridData();
    final BooleanParameter enable_seeding_rate = new BooleanParameter(
        cMaxUploadSpeedOptionsArea, "enable.seedingonly.upload.rate",
        "ConfigView.label.maxuploadspeedseeding");
    enable_seeding_rate.setLayoutData(gridData);

    gridData = new GridData();
    final IntParameter paramMaxUploadSpeedSeeding = new IntParameter(
        cMaxUploadSpeedOptionsArea, "Max Upload Speed Seeding KBs", 0, -1);
    paramMaxUploadSpeedSeeding.setLayoutData(gridData);
    enable_seeding_rate
        .setAdditionalActionPerformer(new ChangeSelectionActionPerformer(
            paramMaxUploadSpeedSeeding.getControl()));

    if (userMode < 2) {
      // wiki link

      Composite cWiki = new Composite(cSection, SWT.COLOR_GRAY);
      gridData = new GridData(GridData.VERTICAL_ALIGN_FILL
          | GridData.HORIZONTAL_ALIGN_FILL);
      gridData.horizontalSpan = 2;
      cWiki.setLayoutData(gridData);
      layout = new GridLayout();
      layout.numColumns = 4;
      layout.marginHeight = 0;
      cWiki.setLayout(layout);

      gridData = new GridData();
      gridData.horizontalIndent = 6;
      gridData.horizontalSpan = 2;
      label = new Label(cWiki, SWT.NULL);
      label.setLayoutData(gridData);
      label.setText(MessageText.getString("Utils.link.visit") + ":");

      gridData = new GridData();
      gridData.horizontalIndent = 10;
      gridData.horizontalSpan = 2;
      new LinkLabel(cWiki, gridData, "ConfigView.section.transfer.speeds.wiki",
          "http://wiki.vuze.com/w/Good_settings");
    }

    if ( userMode > 1 ){
   
      gridData = new GridData();
      label = new Label(cSection, SWT.NULL);
      label.setLayoutData(gridData);
      Messages.setLanguageText(label, "ConfigView.label.maxuploadswhenbusymin" );

      gridData = new GridData();
      new IntParameter(cSection, "max.uploads.when.busy.inc.min.secs", 0, -1).setLayoutData(gridData);
    }
   
    // max download speed
    gridData = new GridData();
    label = new Label(cSection, SWT.NULL);
    label.setLayoutData(gridData);
    Messages.setLanguageText(label, "ConfigView.label.maxdownloadspeed");
   
    gridData = new GridData();
    final IntParameter paramMaxDownSpeed = new IntParameter(cSection,
        "Max Download Speed KBs", 0, -1);
    paramMaxDownSpeed.setLayoutData(gridData);
       
      // max upload/download limit dependencies
   
    Listener l = new Listener() {
 
      public void handleEvent(Event event) {
        boolean disableAuto = false;
        boolean disableAutoSeeding = false;
       
        if(enable_seeding_rate.isSelected())
        {
          disableAutoSeeding = event.widget == paramMaxUploadSpeedSeeding.getControl();
          disableAuto = event.widget == paramMaxDownSpeed.getControl() || event.widget == paramMaxUploadSpeed.getControl();
        } else
        {
          disableAuto = true;
          disableAutoSeeding = true;
        }
         
         
        if(disableAuto)
          COConfigurationManager.setParameter(TransferSpeedValidator.AUTO_UPLOAD_ENABLED_CONFIGKEY, false);
        if(disableAutoSeeding)
          COConfigurationManager.setParameter(TransferSpeedValidator.AUTO_UPLOAD_SEEDING_ENABLED_CONFIGKEY, false);
      }
    };
   
    paramMaxDownSpeed.getControl().addListener(SWT.Selection, l);
    paramMaxUploadSpeed.getControl().addListener(SWT.Selection, l);
    paramMaxUploadSpeedSeeding.getControl().addListener(SWT.Selection, l);
   
   
    paramMaxUploadSpeed.addChangeListener(new ParameterChangeAdapter() {
      ParameterChangeAdapter me = this;

      public void parameterChanged(Parameter p, boolean internal) {
        CoreWaiterSWT.waitForCoreRunning(new AzureusCoreRunningListener() {

          public void azureusCoreRunning(AzureusCore core) {
            if (paramMaxUploadSpeed.isDisposed()) {
              paramMaxUploadSpeed.removeChangeListener(me);
              return;
            }

            // we don't want to police these limits when auto-speed is running as
            // they screw things up bigtime

            if (TransferSpeedValidator.isAutoSpeedActive(core.getGlobalManager())) {

              return;
            }

            int up_val = paramMaxUploadSpeed.getValue();
            int down_val = paramMaxDownSpeed.getValue();

            if (up_val != 0
                && up_val < COConfigurationManager.CONFIG_DEFAULT_MIN_MAX_UPLOAD_SPEED) {

              if ((down_val == 0) || down_val > (up_val * 2)) {

                paramMaxDownSpeed.setValue(up_val * 2);
              }
            } else {

              if (down_val != manual_max_download_speed[0]) {

                paramMaxDownSpeed.setValue(manual_max_download_speed[0]);
              }
            }
          }

        });
      };
    });

    paramMaxDownSpeed.addChangeListener(new ParameterChangeAdapter() {
      ParameterChangeAdapter me = this;

      public void parameterChanged(Parameter p, boolean internal) {
        CoreWaiterSWT.waitForCoreRunning(new AzureusCoreRunningListener() {

          public void azureusCoreRunning(AzureusCore core) {
            if (paramMaxDownSpeed.isDisposed()) {
              paramMaxDownSpeed.removeChangeListener(me);
              return;
            }

            // we don't want to police these limits when auto-speed is running as
            // they screw things up bigtime

            if (TransferSpeedValidator.isAutoSpeedActive(core.getGlobalManager())) {

              return;
            }

            int up_val = paramMaxUploadSpeed.getValue();
            int down_val = paramMaxDownSpeed.getValue();

            manual_max_download_speed[0] = down_val;

            if (up_val < COConfigurationManager.CONFIG_DEFAULT_MIN_MAX_UPLOAD_SPEED) {

              if (up_val != 0 && up_val < (down_val * 2)) {

                paramMaxUploadSpeed.setValue((down_val + 1) / 2);

              } else if (down_val == 0) {

                paramMaxUploadSpeed.setValue(0);
              }
            }
          }
        });
      }
    });
   
    if (userMode > 0) {
     
        // bias upload to incomplete
     
      BooleanParameter bias_upload = new BooleanParameter(
          cSection,
          "Bias Upload Enable",
          "ConfigView.label.xfer.bias_up" );
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      bias_upload.setLayoutData(gridData);
     

      final Composite bias_slack_area = new Composite(cSection, SWT.NULL);
      layout = new GridLayout();
      layout.numColumns = 3;
      layout.marginWidth = 0;
      layout.marginHeight = 0;
      bias_slack_area.setLayout(layout);
      gridData = new GridData();
      gridData.horizontalIndent = 15;
      gridData.horizontalSpan = 2;
      bias_slack_area.setLayoutData(gridData);

      label = new Label(bias_slack_area, SWT.NULL);
      gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      label.setLayoutData(gridData);
      label.setImage(img);
     
      label = new Label(bias_slack_area, SWT.NULL);
      Messages.setLanguageText(label, "ConfigView.label.xfer.bias_slack");

      IntParameter bias_slack = new IntParameter(
          bias_slack_area, "Bias Upload Slack KBs", 1, -1);
     
     
      final Composite bias_unlimited_area = new Composite(cSection, SWT.NULL);
      layout = new GridLayout();
      layout.numColumns = 2;
      layout.marginWidth = 0;
      layout.marginHeight = 0;
      bias_unlimited_area.setLayout(layout);
      gridData = new GridData();
      gridData.horizontalIndent = 15;
      gridData.horizontalSpan = 2;
      bias_unlimited_area.setLayoutData(gridData);

      label = new Label(bias_unlimited_area, SWT.NULL);
      gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      label.setLayoutData(gridData);
      label.setImage(img);

     
      BooleanParameter bias_no_limit = new BooleanParameter(
          bias_unlimited_area,
          "Bias Upload Handle No Limit",
          "ConfigView.label.xfer.bias_no_limit" );
           
      bias_upload.setAdditionalActionPerformer(
          new ChangeSelectionActionPerformer(
          new Parameter[]{ bias_slack, bias_no_limit} ));
    }

    if (userMode > 0) {
     
        // AUTO GROUP
     
      Group auto_group = new Group(cSection, SWT.NULL);
     
      Messages.setLanguageText(auto_group, "group.auto");
     
      GridLayout auto_layout = new GridLayout();
     
      auto_layout.numColumns = 2;

      auto_group.setLayout(auto_layout);

      gridData = new GridData(GridData.FILL_HORIZONTAL);
      gridData.horizontalSpan = 2;
      auto_group.setLayoutData(gridData);

      BooleanParameter auto_adjust = new BooleanParameter(
          auto_group,
          "Auto Adjust Transfer Defaults",
          "ConfigView.label.autoadjust" );
     
      gridData = new GridData();
      gridData.horizontalSpan = 2;

      auto_adjust.setLayoutData( gridData );

      // max uploads
      gridData = new GridData();
      label = new Label(auto_group, SWT.NULL);
      label.setLayoutData(gridData);
      Messages.setLanguageText(label, "ConfigView.label.maxuploads");

      gridData = new GridData();
      IntParameter paramMaxUploads = new IntParameter(auto_group, "Max Uploads",
          2, -1);
      paramMaxUploads.setLayoutData(gridData);

        // max uploads when seeding
     
      final Composite cMaxUploadsOptionsArea = new Composite(auto_group, SWT.NULL);
      layout = new GridLayout();
      layout.numColumns = 3;
      layout.marginWidth = 0;
      layout.marginHeight = 0;
      cMaxUploadsOptionsArea.setLayout(layout);
      gridData = new GridData();
      gridData.horizontalIndent = 15;
      gridData.horizontalSpan = 2;
      cMaxUploadsOptionsArea.setLayoutData(gridData);
      label = new Label(cMaxUploadsOptionsArea, SWT.NULL);
      img.setBackground(label.getBackground());
      gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      label.setLayoutData(gridData);
      label.setImage(img);
     
      gridData = new GridData();
      BooleanParameter enable_seeding_uploads = new BooleanParameter(
          cMaxUploadsOptionsArea, "enable.seedingonly.maxuploads",
          "ConfigView.label.maxuploadsseeding");
      enable_seeding_uploads.setLayoutData(gridData);

      gridData = new GridData();
      final IntParameter paramMaxUploadsSeeding = new IntParameter(
          cMaxUploadsOptionsArea, "Max Uploads Seeding", 2, -1);
      paramMaxUploadsSeeding.setLayoutData(gridData);

     
     
      ////

      gridData = new GridData();
      label = new Label(auto_group, SWT.NULL);
      label.setLayoutData(gridData);
      Messages.setLanguageText(label, "ConfigView.label.max_peers_per_torrent");

      gridData = new GridData();
      IntParameter paramMaxClients = new IntParameter(auto_group,
          "Max.Peer.Connections.Per.Torrent");
      paramMaxClients.setLayoutData(gridData);

     
      /////
     
        // max peers when seeding
     
      final Composite cMaxPeersOptionsArea = new Composite(auto_group, SWT.NULL);
      layout = new GridLayout();
      layout.numColumns = 3;
      layout.marginWidth = 0;
      layout.marginHeight = 0;
      cMaxPeersOptionsArea.setLayout(layout);
      gridData = new GridData();
      gridData.horizontalIndent = 15;
      gridData.horizontalSpan = 2;
      cMaxPeersOptionsArea.setLayoutData(gridData);
      label = new Label(cMaxPeersOptionsArea, SWT.NULL);
      img.setBackground(label.getBackground());
      gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      label.setLayoutData(gridData);
      label.setImage(img);
     
      gridData = new GridData();
View Full Code Here


 

  public Composite configSectionCreate(final Composite parent) {
    ImageLoader imageLoader = ImageLoader.getInstance();
    Image imgOpenFolder = imageLoader.getImage("openFolderButton");     

    GridData gridData;
    GridLayout layout;

    Composite gStats = new Composite(parent, SWT.NULL);
    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    gStats.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 3;
    gStats.setLayout(layout);

    // row

    gridData = new GridData();
    gridData.horizontalSpan = 3;
    BooleanParameter enableStats =
        new BooleanParameter(gStats, "Stats Enable",
                             "ConfigView.section.stats.enable");
    enableStats.setLayoutData(gridData);

    Control[] controls = new Control[14];

    // row

    Label lStatsPath = new Label(gStats, SWT.NULL);
    Messages.setLanguageText(lStatsPath, "ConfigView.section.stats.defaultsavepath"); //$NON-NLS-1$

    gridData = new GridData();
    gridData.widthHint = 150;
    final StringParameter pathParameter = new StringParameter(gStats, "Stats Dir", ""); //$NON-NLS-1$ //$NON-NLS-2$
    pathParameter.setLayoutData(gridData);
    controls[0] = lStatsPath;
    controls[1] = pathParameter.getControl();
    Button browse = new Button(gStats, SWT.PUSH);
    browse.setImage(imgOpenFolder);
    imgOpenFolder.setBackground(browse.getBackground());
    browse.setToolTipText(MessageText.getString("ConfigView.button.browse"));
    controls[2] = browse;
    browse.addListener(SWT.Selection, new Listener() {
      /* (non-Javadoc)
       * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
View Full Code Here

  public void setOrientation(int orientation) {
    this.orientation = orientation;
  }
 
  public Image getBackgroundImage() {
    Image imageRowBG = row.getBackgroundImage();
    if (imageRowBG != null) {
      Rectangle bounds = super.getBounds();
     
      int wInside = bounds.width - (marginWidth * 2);
      int hInside = bounds.height - (marginHeight * 2);
      Image imageCellBG = new Image(Display.getDefault(), wInside, hInside);
      GC gc = new GC(imageCellBG);
      gc.drawImage(imageRowBG, bounds.x + marginWidth, 0 + marginHeight,
          wInside, hInside, 0, 0, wInside, hInside);
      gc.dispose();
     
      return imageCellBG;
    }
   
    TableOrTreeSWT table = row.getTable();
   
    Rectangle bounds = super.getBounds();
   
    if (bounds.isEmpty()) {
      return null;
    }
   
    Image image = new Image(Display.getDefault(), bounds.width
        - (marginWidth * 2), bounds.height - (marginHeight * 2));
   
    GC gc = new GC(image);
    gc.setForeground(getBackground());
    gc.setBackground(getBackground());
View Full Code Here

 
    private Image createImage(String resourcePath) throws IOException {
        InputStream in = null;
        try {
            in = getResourceAsStream(resourcePath);
            return new Image(Display.getCurrent(),in);
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (IOException e) {                  
View Full Code Here

        _toolbarComposite.addListener(SWT.Resize, new Listener() {
            public void handleEvent(Event event) {
                int height= _toolbarComposite.getClientArea().height;

                    Image image= createGradientImage(height, event.display);
                    _toolbarComposite.setBackgroundImage(image);

            }
        });
       
View Full Code Here

    }
   
    private Image createGradientImage(int height, Display display) {
        int width= 50;

        Image result= new Image(display, width, height);

        GC gc= new GC(result);

        Color colorC= createColor(SWT.COLOR_WIDGET_BACKGROUND, SWT.COLOR_LIST_BACKGROUND, 35, display);
        Color colorD= createColor(SWT.COLOR_WIDGET_BACKGROUND, SWT.COLOR_LIST_BACKGROUND, 45, display);
View Full Code Here

 
  private Image createImage(String resourcePath) throws IOException {
    InputStream in = null;
    try {
      in = getResourceAsStream(resourcePath);
      return new Image(Display.getCurrent(),in);
    } finally {
      if (in != null) {
        try {
          in.close();
        } catch (IOException e) {         
View Full Code Here

    }

    @Override
    protected void drawCompositeImage(int width, int height) {
        drawImage(_baseImage.getImageData(), 0, 0);
        Image overlayImage = Plugin.getDefault().getImageRegistry().get(Plugin.IMAGE_WORLD);
        ImageData overlayImageData = overlayImage.getImageData();
        int xValue = 5;
        int yValue = 0;
        drawImage (overlayImageData, xValue, yValue);       
    }
View Full Code Here

 
  private Image createImage(String resourcePath) throws IOException {
    InputStream in = null;
    try {
      in = getResourceAsStream(resourcePath);
      return new Image(Display.getCurrent(),in);
    } finally {
      if (in != null) {
        try {
          in.close();
        } catch (IOException e) {         
View Full Code Here

*
*/
public class PieUtils {

  private static Image computePie(Display display,int width,int height,int percent) {
    Image image = new Image(display,width,height);
    GC gcImage = new GC(image);
    gcImage.setForeground(Colors.blue);
    int angle = (percent * 360) / 100;
    gcImage.setBackground(Colors.blues[Colors.BLUES_MIDDARK]);
    gcImage.fillArc(0,0,width,height,90-angle,angle);
View Full Code Here

TOP

Related Classes of org.eclipse.swt.graphics.Image

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.