Package org.jmule.ui.swt.skin

Examples of org.jmule.ui.swt.skin.SWTSkin


  public void getCoreComponents() {
   
  }

  public void initUIComponents() {
    SWTSkin skin = null;
    try {
        skin = (SWTSkin)JMuleUIManager.getJMuleUI().getSkin();
    }catch(Throwable t) { }
   
    display = SWTThread.getDisplay();
   
    final Shell shell1=new Shell(display,SWT.ON_TOP);
    shell=new Shell(shell1,SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
   
    MouseAdapter link_listener = new MouseAdapter() {
      public void mouseDoubleClick(MouseEvent arg0) {
        String path = (String) ((CLabel) arg0.widget).getData();
        if (!Utils.launchProgram(path))
          Utils.showWarningMessage(shell, _._("aboutwindow.error_open_url.title")
              , Localizer._("aboutwindow.error_open_url",path));
      }
      public void mouseDown(MouseEvent arg0) {
        String path = (String) ((CLabel) arg0.widget).getData();
        if (!Utils.launchProgram(path))
          Utils.showWarningMessage(shell, _._("aboutwindow.error_open_url.title")
              , Localizer._("aboutwindow.error_open_url",path));
      }
    };
   
    GridData layout_data;
    GridLayout layout;
    Composite content;
   
    layout = new GridLayout(1,false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
   
    shell.setLayout(layout);
   
    // Top gradient
    final Canvas window_top = new Canvas(shell,SWT.NONE);
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    layout_data.heightHint = TOP_GRADIENT_HEIGHT;
    window_top.setLayoutData(layout_data);
    window_top.addPaintListener(new PaintListener() {
      public void paintControl(PaintEvent arg0) {
        Rectangle rect = shell.getClientArea ();
        GC gc = arg0.gc;
        gc.setForeground (GRADIENT_COLOR_2);
        gc.setBackground (GRADIENT_COLOR_1);
        gc.fillGradientRectangle (rect.x, rect.y, rect.width, rect.height, false);
        Image image = SWTImageRepository.getImage(logo_image);
        gc.drawImage(image, rect.width - image.getImageData().width - 10, 5);
       
        gc.setForeground(new Color(SWTThread.getDisplay(),0,0,0));
        Font font = new Font(display,"Arial",14,SWT.NONE );
        gc.setFont(font);
        gc.drawText(JMConstants.JMULE_NAME, 20, TOP_GRADIENT_HEIGHT / 2 - 15,true);
       
        gc.setForeground(new Color(SWTThread.getDisplay(),0,0,0));
        font = new Font(display,"Arial",10,SWT.NONE );
        gc.setFont(font);
        gc.drawText("Version : " + JMConstants.JMULE_VERSION, 17, TOP_GRADIENT_HEIGHT / 2 + 5,true);
      }
    });
   
    Composite window_content = new Composite(shell,SWT.NONE);
    window_content.setLayoutData(new GridData(GridData.FILL_BOTH));
   
    FillLayout fill_layout = new FillLayout();
    fill_layout.marginHeight = 0;
    fill_layout.marginWidth = 0;
    window_content.setLayout(fill_layout);
   
    CTabFolder tab_list = new CTabFolder(window_content, SWT.BORDER);
    tab_list.setLayout(new FillLayout());
    tab_list.setSimple(false);
    tab_list.setUnselectedImageVisible(false);
    tab_list.setUnselectedCloseVisible(false);
   
    CTabItem general_tab = new CTabItem(tab_list,SWT.NONE);
    content = new Composite(tab_list,SWT.NONE);
    general_tab.setControl(content);
    general_tab.setText(_._("aboutwindow.tab.general"));
    layout = new GridLayout(1,false);
    layout.marginTop +=10;
    content.setLayout(layout);

    Composite container1 = new Composite(content,SWT.NONE);
    container1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    layout = new GridLayout(1,false);
    layout.marginWidth = 15;
    container1.setLayout(layout);
   
    Label jmule_version = new Label(container1,SWT.LEFT);
    FontData data = skin.getLabelFont().getFontData()[0];
   
    Font bold_font = new Font(display,data.getName(),data.getHeight(),SWT.BOLD);
    jmule_version.setText(JMConstants.JMULE_FULL_NAME);
    jmule_version.setFont(bold_font);
   
    Label copyright = new Label(container1,SWT.LEFT);
    copyright.setText("Copyright (C) 2007-2010 JMule Team");
    copyright.setFont(bold_font);
   
    new Label(container1,SWT.NONE);
   
    StyledText about_text = new StyledText(container1,SWT.LEFT | SWT.READ_ONLY);
    about_text.setText(_._("aboutwindow.tab.general.label.about"));
    about_text.setWordWrap(true);
    about_text.setBackground(shell.getBackground());
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    about_text.setLayoutData(layout_data);
   
    Composite links_container = new Composite(content,SWT.NONE);
    links_container.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    layout = new GridLayout(2,false);
    layout.marginWidth = 15;
    links_container.setLayout(layout);
   
    FontData link_font_data = skin.getLabelFont().getFontData()[0];
    Font link_font = new Font(SWTThread.getDisplay(),link_font_data.getName(), link_font_data.getHeight(), SWT.UNDERLINE_SINGLE);
   
    CLabel link;
   
    link = new CLabel(links_container,SWT.NONE);
    link.setText(_._("aboutwindow.tab.general.label.home_page") + " : ");
    link = new CLabel(links_container,SWT.NONE);
    link.setFont(link_font);
    link.setText(JMConstants.JMULE_WEB_SITE);
    link.setData(JMConstants.JMULE_WEB_SITE);
    link.setForeground(SWTThread.getDisplay().getSystemColor(SWT.COLOR_BLUE));
    link.setCursor(new Cursor(SWTThread.getDisplay(),SWT.CURSOR_HAND));
    link.addMouseListener(link_listener);

    link = new CLabel(links_container,SWT.NONE);
    link.setText(_._("aboutwindow.tab.general.label.forum") + " : ");
   
    link = new CLabel(links_container,SWT.NONE);
    link.setFont(link_font);
    link.setText(JMConstants.JMULE_FORUMS);
    link.setData(JMConstants.JMULE_FORUMS);
    link.setForeground(SWTThread.getDisplay().getSystemColor(SWT.COLOR_BLUE));
    link.setCursor(new Cursor(SWTThread.getDisplay(),SWT.CURSOR_HAND));
    link.addMouseListener(link_listener);
   
    if (JMConstants.IS_NIGHTLY_BUILD) {
      CTabItem nightly_build = new CTabItem(tab_list,SWT.NONE);
      content = new Composite(tab_list,SWT.NONE);
      nightly_build.setControl(content);
      nightly_build.setText(_._("aboutwindow.tab.nightly_build"));
      layout = new GridLayout(1,false);
      layout.marginHeight = 10;
      layout.marginWidth  = 10;
      content.setLayout(layout);
     
      final Label image = new Label(content,SWT.NONE);
      image.setImage(SWTImageRepository.getImage("bomb.png"));
      layout_data = new GridData();
      layout_data.grabExcessHorizontalSpace = true;
      layout_data.horizontalAlignment = GridData.CENTER;
      image.setLayoutData(layout_data);
     
      Label nightly_build_label = new Label(content,SWT.NONE);
      nightly_build_label.setForeground(SWTThread.getDisplay().getSystemColor(SWT.COLOR_RED));
      layout_data = new GridData(GridData.FILL_HORIZONTAL);
      layout_data.horizontalAlignment = GridData.CENTER;
      nightly_build_label.setLayoutData(layout_data);
      nightly_build_label.setText(_._("aboutwindow.tab.nightly_build.label.nightly_buld_str1"));
     
      Label nightly_build_label2 = new Label(content,SWT.NONE);
      nightly_build_label2.setForeground(SWTThread.getDisplay().getSystemColor(SWT.COLOR_RED));
      layout_data = new GridData(GridData.FILL_HORIZONTAL );
      layout_data.horizontalAlignment = GridData.CENTER;
      nightly_build_label2.setLayoutData(layout_data);
      nightly_build_label2.setText(_._("aboutwindow.tab.nightly_build.label.nightly_buld_str2")+" "+_._("aboutwindow.tab.general.label.forum"));
     
      CLabel forum_link = new CLabel(content,SWT.NONE);
      layout_data = new GridData(GridData.FILL_HORIZONTAL );
      layout_data.horizontalAlignment = GridData.CENTER;
      forum_link.setLayoutData(layout_data);
      forum_link.setFont(link_font);
      forum_link.setText(JMConstants.JMULE_FORUMS);
      forum_link.setData(JMConstants.JMULE_FORUMS);
      forum_link.setForeground(SWTThread.getDisplay().getSystemColor(SWT.COLOR_BLUE));
      forum_link.setCursor(new Cursor(SWTThread.getDisplay(),SWT.CURSOR_HAND));
      forum_link.addMouseListener(link_listener);
    }
   
    CTabItem environment_tab = new CTabItem(tab_list,SWT.NONE);
    content = new Composite(tab_list,SWT.NONE);
    environment_tab.setControl(content);
    environment_tab.setText(_._("aboutwindow.tab.environment"));
    content.setLayout(new FillLayout());
   
    JMTable<String> table = new JMTable<String>(content,SWT.NONE) {
      protected int compareObjects(String object1, String object2,
          int columnID, boolean order) {
        return 0;
      }

      protected Menu getPopUpMenu() {
        return null;
      }

      public void updateRow(String object) {
        setRowText(object, 1, object);
        if (object.equals("line.separator"))
          setRowText(object,2,"\\n");
        else {
          String data = System.getProperty(object);
          setRowText(object,2,data);
        }
      }
      protected void saveColumnSettings() {}
    };
    table.setLayout(new FillLayout());
    table.setLinesVisible(true);
    table.setAlternateBackgroundColor(false);
    table.setSorting(false);
    table.addColumn(SWT.LEFT, 1, _._("aboutwindow.tab.environment.table.column.key"), "", 200);
    table.addColumn(SWT.LEFT, 2, _._("aboutwindow.tab.environment.table.column.value"), "", 500);
   
    Set<Object> keys = System.getProperties().keySet();
   
    for(Object key : keys) {
      String value = (String) key;
      table.addRow(value);
    }
    CTabItem license_tab = new CTabItem(tab_list,SWT.NONE);
    content = new Composite(tab_list,SWT.NONE);
    license_tab.setControl(content);
    license_tab.setText(_._("aboutwindow.tab.license"));
   
    content.setLayout(new FillLayout());
   
    Text license_text = new Text(content,SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.READ_ONLY);
    Font font_license = new Font(SWTThread.getDisplay(),"Courier",10,SWT.NONE );
    license_text.setFont(font_license);
      license_text.setText(UIConstants.GNU_LICENSE);
      license_text.setBackground(SWTThread.getDisplay().getSystemColor(SWT.COLOR_WHITE));
     
    tab_list.setSelection(general_tab);
   
    Composite button_bar = new Composite(shell,SWT.NONE);
    button_bar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    layout = new GridLayout(1,false);
    layout.marginWidth = 10;
    layout.marginHeight = 10;
    button_bar.setLayout(layout);
   
    Button button_ok = new Button(button_bar,SWT.NONE);
    button_ok.setFont(skin.getButtonFont());
    button_ok.setText(_._("aboutwindow.button.ok"));
    GridData grid_data = new GridData();
    grid_data.horizontalAlignment = GridData.END;
    grid_data.widthHint = 60;
    grid_data.grabExcessHorizontalSpace = true;
View Full Code Here


 
  public void initUIComponents() {
    GridLayout layout;
    GridData layout_data;
    Label label;
    SWTSkin skin = null;
    try {
     
        skin = (SWTSkin)JMuleUIManager.getJMuleUI().getSkin();
   
    }catch(Throwable t) {}
   
    Display display = SWTThread.getDisplay();
   
    final Shell shell1=new Shell(display,SWT.ON_TOP);
    shell=new Shell(shell1,SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
   
    shell.setText(_._("advancedsearchwindow.title"));
   
    shell.setSize(500,300);

    layout = new GridLayout(1,false);
    layout.marginWidth = 10;
    layout.marginHeight = 10;
    shell.setLayout(layout);
   
    Composite file_size_options = new Composite(shell,SWT.NONE);
    layout = new GridLayout(7,false);
    layout.marginHeight=0;
    layout.marginWidth=0;
    file_size_options.setLayout(layout);
   
    layout_data = new GridData();
    layout_data.grabExcessHorizontalSpace = true;
    layout_data.horizontalAlignment = GridData.FILL;
    file_size_options.setLayoutData(layout_data);
   
    label = new Label(file_size_options,SWT.NONE);
    label.setText(_._("advancedsearchwindow.label.min_size") + " : ");
   
    min_file_size = new Text(file_size_options,SWT.BORDER);
    min_file_size.addVerifyListener(new VerifyListener() {     
      public void verifyText(VerifyEvent e) {
        try {
          String str = min_file_size.getText().substring(0, e.start)+e.text+min_file_size.getText().substring(e.end);
          double value = Double.parseDouble(str);
          double x = (100 * value) / 1024D;
          if (x>100) {
            e.doit = false;
            return ;
          }
          long min_unit = (Long)min_file_size_units.getData(min_file_size_units.getText());
          long max_unit = (Long)max_file_size_units.getData(max_file_size_units.getText());
          double min = formatSize(x, min_unit);
          double max = formatSize(file_size_slider.getUpValue(), max_unit);
          if (min>max) { e.doit = false; return ;}
          e.doit = true;
          file_size_slider.setDownValue(x);       
        }catch(Exception t) {
          e.doit = false;
        }
      }
    });
   
    min_file_size_units = new Combo(file_size_options,SWT.READ_ONLY);
   
    min_file_size_units.add("Bytes");
    min_file_size_units.add("KB");
    min_file_size_units.add("MB");
    min_file_size_units.add("GB");
   
    min_file_size_units.setData("Bytes", 1024L);
    min_file_size_units.setData("KB", 1024 * 1024L);
    min_file_size_units.setData("MB", 1024 * 1024 * 1024L);
    min_file_size_units.setData("GB", 1024 * 1024 * 1024 * 1024L);
    min_file_size_units.select(0);
   
    min_file_size_units.addSelectionListener(new SelectionAdapter() {

      public void widgetSelected(SelectionEvent arg0) {
        updated_file_size = true;
      }
     
    });
   
    layout_data = new GridData();
    layout_data.grabExcessHorizontalSpace = true;
    layout_data.horizontalAlignment = GridData.FILL;
    new Label(file_size_options,SWT.NONE).setLayoutData(layout_data);
   
    label = new Label(file_size_options,SWT.NONE);
    label.setText(_._("advancedsearchwindow.label.max_size") + " : ");
   
    max_file_size = new Text(file_size_options,SWT.BORDER);
   
    max_file_size.addVerifyListener(new VerifyListener() {     
      public void verifyText(VerifyEvent e) {
        try {
          String str = max_file_size.getText().substring(0, e.start)+e.text+max_file_size.getText().substring(e.end);
          double value = Double.parseDouble(str);
          double x = (100 * value) / 1024D;
         
          if (x>100) {
            e.doit = false;
            return ;
          }
         
          long min_unit = (Long)min_file_size_units.getData(min_file_size_units.getText());
          long max_unit = (Long)max_file_size_units.getData(max_file_size_units.getText());
          double min = formatSize(file_size_slider.getDownValue(), min_unit);
          double max = formatSize(x, max_unit);
          if (min>max) { e.doit = false; return ;}
          e.doit = true;
          file_size_slider.setUpValue(x);       
        }catch(Exception t) {
          e.doit = false;
        }
      }
    });
   
    max_file_size_units = new Combo(file_size_options,SWT.READ_ONLY);
    max_file_size_units.add("Bytes");
    max_file_size_units.add("KB");
    max_file_size_units.add("MB");
    max_file_size_units.add("GB");
   
    max_file_size_units.setData("Bytes", 1024L);
    max_file_size_units.setData("KB", 1024 * 1024L);
    max_file_size_units.setData("MB", 1024 * 1024 * 1024L);
    max_file_size_units.setData("GB", 1024 * 1024 * 1024 * 1024L);
    max_file_size_units.select(0);
   
    max_file_size_units.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent arg0) {
        updated_file_size = true;
      }
    });
   
    Composite slider_composite = new Composite(shell,SWT.NONE);
    layout_data = new GridData();
    layout_data.grabExcessHorizontalSpace = true;
    layout_data.horizontalAlignment = GridData.FILL;
    slider_composite.setLayoutData(layout_data);
    slider_composite.setLayout(new GridLayout(1,true));
    file_size_slider = new ExSlider(slider_composite){
      public boolean validate(double upValue, double downValue) {
        long min_unit = (Long)min_file_size_units.getData(min_file_size_units.getText());
        long max_unit = (Long)max_file_size_units.getData(max_file_size_units.getText());
        double min = formatSize(downValue, min_unit);
        double max = formatSize(upValue, max_unit);
       
        return max>min;
      }
    };
   
    file_size_slider.setBarBackgroundColor(SWTThread.getDisplay().getSystemColor(SWT.COLOR_BLUE));
    file_size_slider.setBarUsedSegmentColor(SWTThread.getDisplay().getSystemColor(SWT.COLOR_RED));
    file_size_slider.setPointerColor(SWTThread.getDisplay().getSystemColor(SWT.COLOR_BLACK));
   
    file_size_slider.setUpValue(0);
    file_size_slider.setUpValue(100);
   
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    layout_data.heightHint = 30;
    file_size_slider.setLayoutData(layout_data);
   
    file_size_slider.addModifyListener(new ExSliderModifyListener() {

      public void downValueChanged(double downValue) {
        updated_file_size = true;
        DecimalFormat formatter = new DecimalFormat("0.00");
       
        downValue = Math.round(downValue);
        double u = 1024 / 100D;
       
        min_file_size.setText(formatter.format(u * downValue));
       
      }

      public void upValueChanged(double upValue) {
        updated_file_size = true;
        DecimalFormat formatter = new DecimalFormat("0.00");
       
        upValue = Math.round(upValue);
        double u = 1024 / 100D;
       
        max_file_size.setText(formatter.format(u * upValue));
      }
    });
       
    Composite options_composite = new Composite(shell,SWT.NONE);
    layout_data = new GridData();
    layout_data.grabExcessHorizontalSpace = true;
    layout_data.horizontalAlignment = GridData.FILL;
    options_composite.setLayoutData(layout_data);
    options_composite.setLayout(new GridLayout(4,false));
   
    label = new Label(options_composite,SWT.NONE);
    label.setText("File type : ");
    layout_data = new GridData();
    layout_data.horizontalAlignment = SWT.RIGHT;
    label.setLayoutData(layout_data);
   
    file_type = new Combo(options_composite,SWT.READ_ONLY);
    // must be same order as filetypes
    file_type.add(_._("advancedsearchwindow.file_type.any"));
    file_type.add(_._("advancedsearchwindow.file_type.archive"));
    file_type.add(_._("advancedsearchwindow.file_type.audio"));
    file_type.add(_._("advancedsearchwindow.file_type.cd_image"));
    file_type.add(_._("advancedsearchwindow.file_type.document"));
    file_type.add(_._("advancedsearchwindow.file_type.pictures"));
    file_type.add(_._("advancedsearchwindow.file_type.program"));
    file_type.add(_._("advancedsearchwindow.file_type.video"));
   
    file_type.select(0);
    file_type.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    layout_data = new GridData();
    file_type.setLayoutData(layout_data);
       
    label = new Label(options_composite,SWT.NONE);
    label.setText(_._("advancedsearchwindow.label.extension") + " : ");
    layout_data = new GridData();
    layout_data.horizontalAlignment = SWT.RIGHT;
    label.setLayoutData(layout_data);
   
    file_extension = new Text(options_composite,SWT.BORDER);
   
    label = new Label(options_composite,SWT.NONE);
    label.setText(_._("advancedsearchwindow.label.availability") + " : ");
    layout_data = new GridData();
    layout_data.horizontalAlignment = SWT.RIGHT;
    label.setLayoutData(layout_data);
   
    av_spinner = new Spinner(options_composite,SWT.BORDER);
    av_spinner.setMaximum(1000);
   
    label = new Label(options_composite,SWT.NONE);
    label.setText(_._("advancedsearchwindow.label.complete_sources") + " : ");
    layout_data = new GridData();
    layout_data.horizontalAlignment = SWT.RIGHT;
    label.setLayoutData(layout_data);
    cmp_src_spinner = new Spinner(options_composite,SWT.BORDER);
    cmp_src_spinner.setMaximum(1000);
   
   
    Composite button_composite = new Composite(shell,SWT.BORDER);
    layout_data = new GridData();
    layout_data.verticalAlignment = GridData.END;
    layout_data.horizontalAlignment = GridData.FILL;
    layout_data.grabExcessHorizontalSpace = true;
    layout_data.grabExcessVerticalSpace=true;
    button_composite.setLayoutData(layout_data);
   
    layout = new GridLayout(3,false);
    button_composite.setLayout(layout);
   
    Button button_clear = new Button(button_composite,SWT.NONE);
    button_clear.setText(_._("advancedsearchwindow.button.clear"));
    button_clear.setImage(SWTImageRepository.getImage("remove_all.png"));
    button_clear.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent arg0) {
        min_file_size.setText("0.0");
        min_file_size_units.select(0);
       
        max_file_size.setText("1024.00");
        max_file_size_units.select(0);
       
        file_extension.setText("");
        file_type.select(0);
       
        av_spinner.setSelection(0);
        cmp_src_spinner.setSelection(0);
       
        updated_file_size = false;
      }
    });
   
    Button button_ok = new Button(button_composite,SWT.NONE);
    button_ok.setText(_._("advancedsearchwindow.button.ok"));
    button_ok.setImage(skin.getButtonImage(Skin.OK_BUTTON_IMAGE));
   
    layout_data = new GridData();
    layout_data.grabExcessHorizontalSpace=true;
    layout_data.horizontalAlignment = SWT.RIGHT;
    button_ok.setLayoutData(layout_data);
   
    button_ok.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent arg0) {
        long min_unit = (Long)min_file_size_units.getData(min_file_size_units.getText());
        long max_unit = (Long)max_file_size_units.getData(max_file_size_units.getText());
        double min = formatSize(file_size_slider.getDownValue(), min_unit);
        double max = formatSize(file_size_slider.getUpValue(), max_unit);
        if (updated_file_size)
          save((long)min, (long)max, file_types[file_type.getSelectionIndex()],file_extension.getText(), av_spinner.getSelection(), cmp_src_spinner.getSelection());
        else
          save((long)0, (long)0, file_types[file_type.getSelectionIndex()],file_extension.getText(), av_spinner.getSelection(), cmp_src_spinner.getSelection());
        shell.close();
      }
    });
   
    Button button_cancel = new Button(button_composite,SWT.NONE);
    button_cancel.setText(_._("advancedsearchwindow.button.cancel"));
    button_cancel.setImage(skin.getButtonImage(Skin.CANCEL_BUTTON_IMAGE));
    button_cancel.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent arg0) {
        shell.close();
      }
    });
View Full Code Here

  public UploadGeneralTab(CTabFolder tabFolder, UploadSession session) {
    super(tabFolder, SWT.NONE);
    upload_session = session;
    setText(Localizer._("uploadinfowindow.tab.general.title"));
   
    SWTSkin skin = null;
    try {
        skin = (SWTSkin)JMuleUIManager.getJMuleUI().getSkin();
    }catch(Throwable t) {
    }
    Composite content = new Composite(tabFolder,SWT.NONE);
    setControl(content);
    content.setLayout(new GridLayout(1,false));
    Label label;
   
    Group general = new Group(content,SWT.NONE);
    GridLayout layout = new GridLayout(2,false);
    layout.marginWidth = 10;
    general.setLayout(layout);
    general.setText(Localizer._("uploadinfowindow.tab.general.title"));
    general.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    label = new Label(general,SWT.NONE);
    label.setText(Localizer._("uploadinfowindow.tab.general.label.filename")+" : ");
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    label = new Label(general,SWT.NONE);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setText(upload_session.getSharingName());
    label.setToolTipText(upload_session.getSharingName());
   
    label = new Label(general,SWT.NONE);
    label.setText(Localizer._("uploadinfowindow.tab.general.label.filehash")+" : ");
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    label = new Label(general,SWT.NONE);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setText(upload_session.getFileHash().getAsString());
    label.setToolTipText(upload_session.getFileHash().getAsString());
    label.setForeground(SWTThread.getDisplay().getSystemColor(SWT.COLOR_BLUE));
   
    label = new Label(general,SWT.NONE);
    label.setText(Localizer._("uploadinfowindow.tab.general.label.filesize")+" : ");
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    label = new Label(general,SWT.NONE);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setText(FileFormatter.formatFileSize(upload_session.getFileSize()));
    label.setToolTipText(FileFormatter.formatFileSize(upload_session.getFileSize()));
   
    label = new Label(general,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(Localizer._("uploadinfowindow.tab.general.label.ed2k_link") + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

    label = new Label(general,SWT.NONE);
    label.setFont(skin.getDefaultFont());
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setText(upload_session.getED2KLink().getAsString());
    label.setToolTipText(_._("uploadinfowindow.tab.general.label.ed2k_link.tooltip"));
    label.setForeground(SWTThread.getDisplay().getSystemColor(SWT.COLOR_BLUE));
    label.setCursor(new Cursor(SWTThread.getDisplay(),SWT.CURSOR_HAND));
    label.addListener(SWT.MouseUp, new Listener() {
      public void handleEvent(Event arg0) {
        Utils.setClipBoardText(upload_session.getED2KLink().getAsString());
      }
    });
   
    Group transfer = new Group(content,SWT.NONE);
    GridLayout transfer_layout = new GridLayout(2,false);
    transfer_layout.marginWidth = 10;
    transfer.setLayout(transfer_layout);
    transfer.setText(Localizer._("uploadinfowindow.tab.general.group.transfer"));
    transfer.setLayoutData(new GridData(GridData.FILL_BOTH));
   
    label = new Label(transfer,SWT.NONE);
    label.setText(Localizer._("uploadinfowindow.tab.transfer.label.uploadspeed")+" : ");
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    upload_speed = new Label(transfer,SWT.NONE);
    upload_speed.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    upload_speed.setText(SpeedFormatter.formatSpeed(upload_session.getSpeed()));

    label = new Label(transfer,SWT.NONE);
    label.setText(Localizer._("uploadinfowindow.tab.transfer.label.transferred")+" : ");
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    total_uploaded = new Label(transfer,SWT.NONE);
    total_uploaded.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    total_uploaded.setText(FileFormatter.formatFileSize(upload_session.getTransferredBytes()));
   
    label = new Label(transfer,SWT.NONE);
    label.setText(Localizer._("uploadinfowindow.tab.transfer.label.eta")+" : ");
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    eta = new Label(transfer,SWT.NONE);
    eta.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    eta.setText(TimeFormatter.format(upload_session.getETA()));

    label = new Label(transfer,SWT.NONE);
    label.setText(Localizer._("uploadinfowindow.tab.transfer.label.peers")+" : ");
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    peers = new Label(transfer,SWT.NONE);
    peers.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    peers.setText(upload_session.getPeerCount() + "");   
  }
View Full Code Here

  public SharedFilePropertiesWindow(SharedFile sharedFile) {
    shared_file = sharedFile; 
  }
 
  public void getCoreComponents() {
    SWTSkin skin = null;
    try {
        skin = (SWTSkin) JMuleUIManager.getJMuleUI().getSkin();
    }catch(Throwable t) {
    }
   
    final Shell shell1=new Shell(SWTThread.getDisplay(),SWT.ON_TOP);
    shell=new Shell(shell1,SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE);
   
    shell.setText(_._("sharedfilepropertieswindow.title"));
    shell.setImage(SWTImageRepository.getImage("info.png"));
   
    shell.setSize(500, 310);
   
    Utils.centreWindow(shell);
   
    shell.setLayout(new GridLayout(1,false));
    Composite shared_file_fields = new Composite(shell,SWT.BORDER);
    shared_file_fields.setLayout(new GridLayout(2,false));
    shared_file_fields.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_BOTH));

    Label label;
   
    label = new Label(shared_file_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(_._("sharedfilepropertieswindow.label.filename")+" : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    label = new Label(shared_file_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setText(shared_file.getSharingName());
   
    label = new Label(shared_file_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(_._("sharedfilepropertieswindow.label.filesize")+" : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    label = new Label(shared_file_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setText(FileFormatter.formatFileSize(shared_file.length()));
   
    label = new Label(shared_file_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(_._("sharedfilepropertieswindow.label.filepath")+" : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    label = new Label(shared_file_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setText(shared_file.getAbsolutePath());
    label.setToolTipText(shared_file.getAbsolutePath());
   
    label = new Label(shared_file_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(_._("sharedfilepropertieswindow.label.filestype")+" : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    label = new Label(shared_file_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setText(FileFormatter.formatMimeType(shared_file.getMimeType()));
   
    label = new Label(shared_file_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(_._("sharedfilepropertieswindow.label.file_hash")+" : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    label = new Label(shared_file_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setText(shared_file.getFileHash().getAsString());
    label.setForeground(SWTThread.getDisplay().getSystemColor(SWT.COLOR_BLUE));
   
    label = new Label(shared_file_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(_._("sharedfilepropertieswindow.label.completed")+" : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
       
    completed = new Label(shared_file_fields,SWT.NONE);
    completed.setFont(skin.getLabelFont());
    completed.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    if (shared_file instanceof PartialFile) {
      refresher = new Refreshable(){

        public void refresh() {
          PartialFile p_file = (PartialFile) shared_file;
          completed.setText(FileFormatter.formatProgress(p_file.getPercentCompleted()));
        }
       
      };
      GUIUpdater.getInstance().addRefreshable(refresher);
    }else
      completed.setText("100%");
   
    label = new Label(shared_file_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(Localizer._("sharedfilepropertieswindow.label.ed2k_link") + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

    label = new Label(shared_file_fields,SWT.NONE);
    label.setFont(skin.getDefaultFont());
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setText(shared_file.getED2KLink().getAsString());
    label.setToolTipText(_._("sharedfilepropertieswindow.label.ed2k_link.tooltip"));
    label.setForeground(SWTThread.getDisplay().getSystemColor(SWT.COLOR_BLUE));
    label.setCursor(new Cursor(SWTThread.getDisplay(),SWT.CURSOR_HAND));
    label.addListener(SWT.MouseUp, new Listener() {
      public void handleEvent(Event arg0) {
        Utils.setClipBoardText(shared_file.getED2KLink().getAsString());
      }
    });
   
    label = new Label(shared_file_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(_._("sharedfilepropertieswindow.label.file_quality") + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
   
    file_quality_combo = new Combo(shared_file_fields,SWT.READ_ONLY);
   
    if (!shared_file.isCompleted())
      file_quality_combo.setEnabled(false);
    file_quality_combo.setFont(skin.getDefaultFont());
    file_quality_combo.add(_._("sharedfilepropertieswindow.label.fq_not_rated"));
    file_quality_combo.setData(_._("sharedfilepropertieswindow.label.fq_not_rated"), FileQuality.NOTRATED);
   
    file_quality_combo.add(_._("sharedfilepropertieswindow.label.fq_fake"));
    file_quality_combo.setData(_._("sharedfilepropertieswindow.label.fq_fake"), FileQuality.FAKE);
   
    file_quality_combo.add(_._("sharedfilepropertieswindow.label.fq_poor"));
    file_quality_combo.setData(_._("sharedfilepropertieswindow.label.fq_poor"), FileQuality.POOR);
   
    file_quality_combo.add(_._("sharedfilepropertieswindow.label.fq_fair"));
    file_quality_combo.setData(_._("sharedfilepropertieswindow.label.fq_fair"), FileQuality.FAIR);
   
    file_quality_combo.add(_._("sharedfilepropertieswindow.label.fq_good"));
    file_quality_combo.setData(_._("sharedfilepropertieswindow.label.fq_good"), FileQuality.GOOD);
   
    file_quality_combo.add(_._("sharedfilepropertieswindow.label.fq_excellent"));
    file_quality_combo.setData(_._("sharedfilepropertieswindow.label.fq_excellent"), FileQuality.EXCELLENT);
   
    switch(shared_file.getFileQuality()) {
      case FAKE : file_quality_combo.select(1); break;
      case POOR : file_quality_combo.select(2); break;
      case FAIR : file_quality_combo.select(3); break;
      case GOOD : file_quality_combo.select(4); break;
      case EXCELLENT : file_quality_combo.select(5); break;
      default :   file_quality_combo.select(0); break;
    }
   
    Composite button_bar = new Composite(shell,SWT.NONE);
    button_bar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    GridLayout layout = new GridLayout(2,false);
    button_bar.setLayout(layout);

    Button button_ok = new Button(button_bar,SWT.NONE);
    button_ok.setFont(skin.getButtonFont());
    button_ok.setText(_._("sharedfilepropertieswindow.button.ok"));
    button_ok.setImage(skin.getButtonImage(SWTSkin.OK_BUTTON_IMAGE));
   
    Button button_cancel = new Button(button_bar,SWT.NONE);
    button_cancel.setFont(skin.getButtonFont());
    button_cancel.setText(_._("sharedfilepropertieswindow.button.cancel"));
    button_cancel.setImage(skin.getButtonImage(SWTSkin.CANCEL_BUTTON_IMAGE));
   
    GridData grid_data = new GridData();
    grid_data.horizontalAlignment = GridData.END;
    grid_data.widthHint = 60;
    grid_data.grabExcessHorizontalSpace = true;
View Full Code Here

  public void getCoreComponents() {
   
  }

  public void initUIComponents() {
    SWTSkin skin = null;
    try {
        skin = (SWTSkin) JMuleUIManager.getJMuleUI().getSkin();
    }catch(Throwable t) {}
   
   
    Display display = SWTThread.getDisplay();
    final Shell shell1=new Shell(display,SWT.ON_TOP);
    shell=new Shell(shell1,SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE);
   
    shell.setText(Localizer._("downloadinfowindow.title"));
    shell.setImage(SWTImageRepository.getImage("info.png"));
       
    shell.setLayout(new FillLayout());
   
    Composite content = new Composite(shell,SWT.BORDER);
    content.setLayout(new GridLayout(1,true));
    CTabFolder tab_folder = new CTabFolder(content,SWT.BORDER);
    tab_folder.setLayoutData(new GridData(GridData.FILL_BOTH));
    tab_folder.setSimple(false);

    DownloadGeneralTab general_tab = new DownloadGeneralTab(tab_folder,download_session);
    tab_folder.setSelection(general_tab);
    tabs.add(general_tab);
   
    DownloadPeerListTab peer_list_tab = new DownloadPeerListTab(tab_folder,download_session);
    tabs.add(peer_list_tab);
   
    for(Refreshable refreshable : tabs)
      GUIUpdater.getInstance().addRefreshable(refreshable);
   
    Composite buttons_composite = new Composite(content,SWT.NONE);
    buttons_composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    buttons_composite.setLayout(new GridLayout(1,false));
    Button button_close = new Button(buttons_composite,SWT.NONE);
    GridData grid_data = new GridData();
    grid_data.widthHint = 70;
    grid_data.horizontalAlignment = GridData.END;
    grid_data.grabExcessHorizontalSpace = true;
    button_close.setLayoutData(grid_data);
   
    button_close.setFont(skin.getButtonFont());
    button_close.setText(Localizer._("downloadinfowindow.button.close"));
   
    button_close.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected( SelectionEvent e ) {
        for(Refreshable refreshable : tabs) {
View Full Code Here

    super(shell);
   
    _core = core;
    sharing_manager = _core.getSharingManager();
    config_manager = _core.getConfigurationManager();
    SWTSkin skin = null;
    try {
        skin = (SWTSkin)JMuleUIManager.getJMuleUI().getSkin();
    }catch(Throwable t) {}
   
    setLayout(new FormLayout());
   
    Composite dir_list = new Composite(this,SWT.NONE);
    Composite shared_files = new Composite(this,SWT.NONE);
   
    SashControl.createHorizontalSash(50, 50, this, dir_list, shared_files);
   
    GridLayout layout;
   
    dir_list.setLayout(new FillLayout());
    dir_list_content = new Group(dir_list,SWT.NONE);
    java.util.List<File> dir = null;
    try {
      dir = _core.getConfigurationManager().getSharedFolders();
    } catch (ConfigurationManagerException e) {
      e.printStackTrace();
    }
    if (dir != null)
      dir_list_content.setText(_._("mainwindow.sharedtab.group.shared_dirs")+"("+dir.size()+")");
    else
      dir_list_content.setText(_._("mainwindow.sharedtab.group.shared_dirs")+"(0)");
   
    config_listener = new ConfigurationAdapter() {
      public void sharedDirectoriesChanged(java.util.List<File> sharedDirs) {
        dir_list_content.setText(_._("mainwindow.sharedtab.group.shared_dirs")+"("+sharedDirs.size()+")");
      }
    };
   
    layout = new GridLayout(1,false);
    layout.marginWidth  = 2;
    layout.marginHeight = 2;
    dir_list_content.setLayout(layout);
   
    Composite control_block = new Composite(dir_list_content,SWT.NONE);
    layout = new GridLayout(4,false);
    layout.marginHeight = 0;
    layout.marginWidth  = 0;
    control_block.setLayout(layout);
    GridData data = new GridData();
    data.widthHint = 400;
    control_block.setLayoutData(data);
   
    Button add_button = new Button(control_block,SWT.NONE);
    add_button.setFont(skin.getButtonFont());
    add_button.setImage(SWTImageRepository.getImage("add.png"));
    add_button.setText(_._("mainwindow.sharedtab.button.add"));
    add_button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    add_button.setAlignment(SWT.LEFT);
    add_button.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        DirectoryDialog dir_dialog = new DirectoryDialog (getShell(),SWT.MULTI | SWT.OPEN);
        String directory = dir_dialog.open();
        if (directory == null) return ;
        java.util.List<File> shared_dirs = null;
        try {
          shared_dirs = config_manager.getSharedFolders();
        } catch (ConfigurationManagerException e) {
          e.printStackTrace();
        }
        java.util.List<File> newDirs = new LinkedList<File>();
        if (shared_dirs == null)
          shared_dirs = new CopyOnWriteArrayList<File>();
        else
          shared_dirs = new CopyOnWriteArrayList<File>(shared_dirs);
       
        java.util.List<File> already_exist_list = org.jmule.core.utils.FileUtils.extractNewFolders(new File[]{new File(directory)},shared_dirs,newDirs);
                  
        if (already_exist_list.size()!=0) {
          AlreadyExistDirsWindow window = new AlreadyExistDirsWindow(already_exist_list);
          window.getCoreComponents();
          window.initUIComponents();
        }
        shared_dirs.addAll(newDirs);
        try {
          config_manager.setSharedFolders(shared_dirs);
        } catch (ConfigurationManagerException e) {
          e.printStackTrace();
        }
    } });
   
   
    remove_button = new Button(control_block,SWT.NONE);
    remove_button.setFont(skin.getButtonFont());
    remove_button.setText(_._("mainwindow.sharedtab.button.remove"));
    remove_button.setImage(SWTImageRepository.getImage("remove.png"));
    remove_button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    remove_button.setAlignment(SWT.LEFT);
    remove_button.setEnabled(false);
    remove_button.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        removeSelectedDir();
    } });
   
    clear_button = new Button(control_block,SWT.NONE);
    clear_button.setFont(skin.getButtonFont());
    clear_button.setText(_._("mainwindow.sharedtab.button.clear"));
    clear_button.setImage(SWTImageRepository.getImage("remove_all.png"));
    clear_button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    clear_button.setAlignment(SWT.LEFT);
    clear_button.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        clearDirList();
    } });
   
    Button reload_button = new Button(control_block,SWT.NONE);
    reload_button.setFont(skin.getButtonFont());
    reload_button.setText(_._("mainwindow.sharedtab.button.reload"));
    reload_button.setImage(SWTImageRepository.getImage("refresh.png"));
    reload_button.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        sharing_manager.loadCompletedFiles();
View Full Code Here

  public void getCoreComponents() {
   
  }

  public void initUIComponents() {
    SWTSkin skin = null;
    try {
     
        skin = (SWTSkin) JMuleUIManager.getJMuleUI().getSkin();
   
    }catch(Throwable t) {}
   
    final Shell shell1=new Shell(SWTThread.getDisplay(),SWT.ON_TOP);
    shell=new Shell(shell1,SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE);
   
    shell.setText(_._("alreadyexistdirswindow.title"));
   
    shell.setLayout(new GridLayout(1,false));
   
    Label info = new Label(shell,SWT.NONE);
    info.setFont(skin.getLabelFont());
    info.setText(_._("alreadyexistdirswindow.label.info"));
   
    List file_list = new List(shell,SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    file_list.setLayoutData(new GridData(GridData.FILL_BOTH));
    for(File file : list)
View Full Code Here

  private Shell shell;
  private SearchResultItem search_result;
 
  public SearchPropertiesWindow(SearchResultItem item) {
    SWTSkin skin = null;
    try {
     
        skin = (SWTSkin) JMuleUIManager.getJMuleUI().getSkin();
   
    }catch(Throwable t) {}
   
    GridLayout layout;
   
    search_result = item;
   
    final Shell shell1=new Shell(SWTThread.getDisplay(),SWT.ON_TOP);
    shell=new Shell(shell1,SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE);
    shell.setImage(SWTImageRepository.getImage("info.png"));
    shell.setText(_._("searchpropertieswindow.title"));
    shell.setSize(500, 310);
   
    Utils.centreWindow(shell);
    shell.setLayout(new GridLayout(1,false));
    Composite search_fields = new Composite(shell,SWT.BORDER);
    search_fields.setLayout(new GridLayout(2,false));
    search_fields.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_BOTH));

    Label label;
   
    label = new Label(search_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(_._("searchpropertieswindow.label.filename")+" : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
    label = new Label(search_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setText(search_result.getFileName());
   
    label = new Label(search_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(_._("searchpropertieswindow.label.filesize")+" : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
    label = new Label(search_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setText(FileFormatter.formatFileSize(search_result.getFileSize()));

    label = new Label(search_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(_._("searchpropertieswindow.label.availability")+" : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
    label = new Label(search_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setText((search_result.getFileAviability())+"");
   
    label = new Label(search_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(_._("searchpropertieswindow.label.completesrc")+" : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
    label = new Label(search_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setText((search_result.getFileCompleteSrc())+"");
   
    label = new Label(search_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(_._("searchpropertieswindow.label.type")+" : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
    label = new Label(search_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    byte[] fileType = search_result.getMimeType();
    label.setText(FileFormatter.formatMimeType(fileType));
   
    label = new Label(search_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(_._("searchpropertieswindow.label.filehash")+" : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
    label = new Label(search_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setText(search_result.getFileHash().getAsString());

    label = new Label(search_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(Localizer._("sharedfilepropertieswindow.label.ed2k_link") + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

    label = new Label(search_fields,SWT.NONE);
    label.setFont(skin.getDefaultFont());
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setText(search_result.getAsED2KLink().getAsString());
    label.setToolTipText(_._("searchpropertieswindow.label.ed2k_link.tooltip"));
    label.setForeground(SWTThread.getDisplay().getSystemColor(SWT.COLOR_BLUE));
    label.setCursor(new Cursor(SWTThread.getDisplay(),SWT.CURSOR_HAND));
    label.addListener(SWT.MouseUp, new Listener() {
      public void handleEvent(Event arg0) {
        Utils.setClipBoardText(search_result.getAsED2KLink().getAsString());
      }
    });
   
    label = new Label(search_fields,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(_._("searchpropertieswindow.label.filequality") + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
    Composite container1 = new Composite(search_fields,SWT.NONE);
    container1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    layout = new GridLayout(2,false);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    container1.setLayout(layout);
   
    label = new Label(container1,SWT.NONE);
    label.setFont(skin.getDefaultFont());
    label.setImage(SWTImageRepository.getImage(search_result.getFileQuality()));
   
    label = new Label(container1,SWT.NONE);
    label.setFont(skin.getDefaultFont());
   
    switch(search_result.getFileQuality()) {
      case FAKE : label.setText(_._("searchpropertieswindow.label.fq_fake")); break;
      case POOR : label.setText(_._("searchpropertieswindow.label.fq_poor")); break;
      case FAIR : label.setText(_._("searchpropertieswindow.label.fq_fair")); break;
      case GOOD : label.setText(_._("searchpropertieswindow.label.fq_good")); break;
      case EXCELLENT : label.setText(_._("searchpropertieswindow.label.fq_excellent")); break;
      default : label.setText(_._("searchpropertieswindow.label.fq_not_rated")); break;
    }
   
    Composite button_bar = new Composite(shell,SWT.NONE);
    button_bar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    layout = new GridLayout(2,false);
    button_bar.setLayout(layout);
 
    Button button = new Button(button_bar,SWT.NONE);
    button.setFont(skin.getButtonFont());
    button.setText(_._("searchpropertieswindow.button.close"));
   
    GridData grid_data = new GridData();
    grid_data.horizontalAlignment = GridData.END;
    grid_data.widthHint = 60;
View Full Code Here

    SashControl.createHorizontalSash(50, 50, this, download_panel, upload_panel);
   
    download_panel.setLayout(new FillLayout());
    upload_panel.setLayout(new FillLayout());
   
    SWTSkin skin = null;
    try {
     
        skin = (SWTSkin)JMuleUIManager.getJMuleUI().getSkin();
   
    }catch(Throwable t) {}
   
    downloads = new Group(download_panel,SWT.NONE);
    downloads.setFont(skin.getDefaultFont());
    downloads.setLayout(new FillLayout());
    download_list = new DownloadList(downloads,_core);
   
    uploads = new Group(upload_panel,SWT.NONE);
    uploads.setFont(skin.getDefaultFont());
    uploads.setLayout(new FillLayout());
    upload_list = new UploadList(uploads,_core);
   
    refreshable = new Refreshable() {
      public void refresh() {
View Full Code Here

      final DownloadSession download_Session) {
    super(tabFolder, SWT.NONE);

    download_session = download_Session;
    setText(Localizer._("downloadinfowindow.tab.general.title"));
    SWTSkin skin = null;
    try {
      skin = (SWTSkin) JMuleUIManager.getJMuleUI().getSkin();
    } catch (Throwable t) {
    }

    Composite content = new Composite(tabFolder, SWT.NONE);
    setControl(content);
    content.setLayout(new GridLayout(1, false));

    Label label;

    Group transfer_group = new Group(content, SWT.NONE);
    transfer_group.setLayout(new GridLayout(2, false));
    transfer_group.setText(Localizer
        ._("downloadinfowindow.tab.general.group.transfer"));
    transfer_group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    label = new Label(transfer_group, SWT.NONE);
    label.setText(Localizer
        ._("downloadinfowindow.tab.general.label.status")
        + " : ");
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    download_status = new Label(transfer_group, SWT.NONE);
    download_status.setFont(skin.getLabelFont());
    download_status.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    download_status
        .setText(download_session.getStatus() == DownloadStatus.STARTED ? Localizer
            ._("mainwindow.transferstab.downloads.column.status.started")
            : Localizer
                ._("mainwindow.transferstab.downloads.column.status.stopped"));

    label = new Label(transfer_group, SWT.NONE);
    label.setText(Localizer
        ._("downloadinfowindow.tab.general.label.totalprogress")
        + " : ");
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

    total_progress = new Canvas(transfer_group, SWT.NONE);
    GridData grid_data = new GridData(GridData.FILL_HORIZONTAL);
    grid_data.heightHint = 20;
    total_progress.setLayoutData(grid_data);
    gap_list_painter = new GapListPainter(download_session.getGapList(),
        download_session.getFileSize());
    gap_list_painter.setMarginWidth(0);
    total_progress.addPaintListener(new PaintListener() {
      public void paintControl(PaintEvent arg0) {
        gap_list_painter.draw(arg0.gc, 0, 0, arg0.width, arg0.height);
      }
    });

    label = new Label(transfer_group, SWT.NONE);
    label.setText(Localizer
        ._("downloadinfowindow.tab.general.label.sources")
        + " : ");
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

    sources_count = new Label(transfer_group, SWT.NONE);
    sources_count.setFont(skin.getLabelFont());
    sources_count.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    sources_count.setText(download_session.getPeerCount() + "("
        + download_session.getPartialSources() + ")");

    label = new Label(transfer_group, SWT.NONE);
    label.setText(Localizer
        ._("downloadinfowindow.tab.general.label.filesize")
        + " : ");
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    label = new Label(transfer_group, SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(FileFormatter.formatFileSize(download_session
        .getFileSize()));

    label = new Label(transfer_group, SWT.NONE);
    label.setText(Localizer
        ._("downloadinfowindow.tab.general.label.transferred")
        + " : ");
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    download_size = new Label(transfer_group, SWT.NONE);
    download_size.setFont(skin.getLabelFont());
    download_size.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    download_size.setText(FileFormatter.formatFileSize(download_session
        .getTransferredBytes()));

    label = new Label(transfer_group, SWT.NONE);
    label.setText(Localizer
        ._("downloadinfowindow.tab.general.label.remaining")
        + " : ");
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    remaining_label = new Label(transfer_group, SWT.NONE);
    remaining_label.setFont(skin.getLabelFont());
    remaining_label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    long remaining = (download_session.getFileSize() - download_session
        .getTransferredBytes());
    remaining_label.setText(FileFormatter.formatFileSize(remaining));

    label = new Label(transfer_group, SWT.NONE);
    label.setText(Localizer._("downloadinfowindow.tab.general.label.parts")
        + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    label.setFont(skin.getLabelFont());
    part_status = new Label(transfer_group, SWT.NONE);
    part_status.setFont(skin.getLabelFont());
    part_status.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    part_status
        .setText(download_session.getPartCount()
            + "; "
            + Localizer
                ._("downloadinfowindow.tab.general.label.parts_available")
            + " : " + download_session.getAvailablePartCount());

    label = new Label(transfer_group, SWT.NONE);
    label.setText(Localizer
        ._("downloadinfowindow.tab.general.label.download_speed")
        + " : ");
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    speed = new Label(transfer_group, SWT.NONE);
    speed.setFont(skin.getLabelFont());
    speed.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    String download_speed = SpeedFormatter.formatSpeed(download_session
        .getSpeed());
    speed.setText(download_speed);

    label = new Label(transfer_group, SWT.NONE);
    label.setText(Localizer._("downloadinfowindow.tab.general.label.eta")
        + " : ");
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

    eta = new Label(transfer_group, SWT.NONE);
    eta.setFont(skin.getLabelFont());
    eta.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    String download_eta = TimeFormatter.formatColon(download_session
        .getETA());
    eta.setText(download_eta);

    Group general_group = new Group(content, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginWidth = 10;
    general_group.setLayout(layout);
    general_group.setText(Localizer._("downloadinfowindow.group.general"));
    general_group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    label = new Label(general_group, SWT.NONE);
    label.setText(Localizer
        ._("downloadinfowindow.tab.general.label.filename")
        + " : ");
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    label = new Label(general_group, SWT.NONE);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setText(download_session.getSharingName());
    label.setToolTipText(download_session.getSharingName());

    label = new Label(general_group, SWT.NONE);
    label.setText(Localizer
        ._("downloadinfowindow.tab.general.label.partmet")
        + " : ");
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    label = new Label(general_group, SWT.NONE);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setText(download_session.getSharingName() + ".part.met");
    label.setToolTipText(download_session.getMetFilePath());

    label = new Label(general_group, SWT.NONE);
    label.setText(Localizer
        ._("downloadinfowindow.tab.general.label.filehash")
        + " : ");
    label.setFont(skin.getLabelFont());
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    label = new Label(general_group, SWT.NONE);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setText(download_session.getFileHash() + "");
    label.setForeground(SWTThread.getDisplay().getSystemColor(
        SWT.COLOR_BLUE));

    label = new Label(general_group, SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(Localizer
        ._("downloadinfowindow.tab.general.label.ed2k_link")
        + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

    label = new Label(general_group, SWT.NONE);
    label.setFont(skin.getDefaultFont());
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setText(download_session.getED2KLink().getAsString());
    label.setToolTipText(_
        ._("downloadinfowindow.tab.general.label.ed2k_link.tooltip"));
    label.setForeground(SWTThread.getDisplay().getSystemColor(
View Full Code Here

TOP

Related Classes of org.jmule.ui.swt.skin.SWTSkin

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.