Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Button


      Debug.out("AbstractWizardPage:: a button with this ID is not found ID:"
          + buttonID);
      return;
    }

    Button button = (Button) buttons.get(buttonID);
    button.setVisible(value);

    if (true == value) {
      GridData gData = ((GridData) button.getLayoutData());
      gData.exclude = false;
      gData.widthHint = button.computeSize(SWT.DEFAULT, SWT.DEFAULT).y
          + buttonExtraMargin;
    } else {
      GridData gData = ((GridData) button.getLayoutData());
      gData.exclude = true;
      gData.widthHint = 0;
    }

    toolbarPanel.layout(true);
View Full Code Here


    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

    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;
    button_ok.setLayoutData(grid_data);
    button_ok.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(final SelectionEvent e) {
        String selection = file_quality_combo.getItem(file_quality_combo.getSelectionIndex());
        FileQuality quality = (FileQuality) file_quality_combo.getData(selection);
        shared_file.setFileQuality(quality);
        remove_refreshable();
        shell.close();
      }
    });
   
    button_cancel.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(final SelectionEvent e) {
        remove_refreshable();
        shell.close();
      }
    });
View Full Code Here

    search_query = new Text(basic_search_controls,SWT.SINGLE | SWT.BORDER);
    layout_data = new GridData();
    layout_data.widthHint = 300;
    search_query.setLayoutData(layout_data);
   
    Button search_button = new Button(basic_search_controls,SWT.PUSH);
   
    search_button.setText(Localizer._("mainwindow.searchtab.button.search"));
    search_button.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent arg0) {
        search();
      }
    });
   
View Full Code Here

      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) {
          GUIUpdater.getInstance().removeRefreshable(refreshable);
        }
        shell.close();
View Full Code Here

    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

    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)
      file_list.add(file.getAbsolutePath());
   
    Button button_ok = new Button(shell,SWT.NONE);
    button_ok.setText(_._("alreadyexistdirswindow.button.ok"));
    button_ok.setImage(SWTImageRepository.getImage("ok.png"));
    GridData data = new GridData();
    data.horizontalAlignment = GridData.CENTER;
    data.widthHint = 60;
    button_ok.setLayoutData(data);
    button_ok.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        shell.close();
    }});
   
    shell.setSize(300,400);
View Full Code Here

    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;
    grid_data.grabExcessHorizontalSpace = true;
    button.setLayoutData(grid_data);
   
    button.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(final SelectionEvent e) {
        shell.close();
      }
    });
  }
View Full Code Here

    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;
    button_ok.setFocus();
    button_ok.setLayoutData(grid_data);
   
    button_ok.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        shell.close();
      }
    });
   
View Full Code Here

    Composite buttons_composite = new Composite(routing_table_container, SWT.NONE);
    GridData g = new GridData(GridData.FILL_HORIZONTAL);
    buttons_composite.setLayoutData(g);
    buttons_composite.setLayout(new GridLayout(1,false));
   
    final Button setKadStatus = new Button(buttons_composite, SWT.NONE);
    try {
      setKadStatus.setEnabled(_core.getConfigurationManager().isJKadAutoconnectEnabled());
    } catch (ConfigurationManagerException e) {
      e.printStackTrace();
      setKadStatus.setEnabled(false);
    }
    g = new GridData();
    g.widthHint = 150;
    setKadStatus.setLayoutData(g);
    setKadStatus.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        if (_core.getJKadManager().isConnected())
          _core.getJKadManager().disconnect();
        else
          if (_core.getJKadManager().isConnecting())
            _core.getJKadManager().disconnect();
          else
            if (_core.getJKadManager().isDisconnected()) {
              setKadStatus.setEnabled(false);
              Display.getDefault().asyncExec(new Runnable() {
                public void run() {
                  _core.getJKadManager().connect();
                }
              });
            }
             
      }
    });
   
    if (_core.getJKadManager().isConnected())
      setKadStatus.setText(_._("mainwindow.kadtab.disconnect"));
    if (_core.getJKadManager().isConnecting())
      setKadStatus.setText(_._("mainwindow.kadtab.stop_connecting"));
    if (_core.getJKadManager().isDisconnected())
      setKadStatus.setText(_._("mainwindow.kadtab.connect"));
   
    _core.getJKadManager().addJKadListener(new JKadListener() {
      public void JKadIsConnected() {
        Display.getDefault().asyncExec(new Runnable() {
          public void run() {
            if (isDisposed()) return;
            setKadStatus.setEnabled(true);
            setKadStatus.setText(_._("mainwindow.kadtab.disconnect"));
          }
        });
      }

      public void JKadIsConnecting() {
        Display.getDefault().asyncExec(new Runnable() {
          public void run() {
            if (isDisposed()) return;
            setKadStatus.setEnabled(true);
            setKadStatus.setText(_._("mainwindow.kadtab.stop_connecting"));
          }
        });
      }

      public void JKadIsDisconnected() {
        Display.getDefault().asyncExec(new Runnable() {
          public void run() {
            if (isDisposed()) return;
            setKadStatus.setEnabled(true);
            routing_table_container.setText(_._("mainwindow.kadtab.kad_nodes"));
            setKadStatus.setText(_._("mainwindow.kadtab.connect"));
           
          }
        });
      }
     
    });
   
    contact_list = new JMTable<KadContact>(routing_table_container,SWT.NONE){
      protected int compareObjects(KadContact object1,
          KadContact object2, int columnID, boolean order) {
        int result = 0;
        if (columnID == KAD_CLIENT_ID_COLUMN_ID)
          result = object1.getContactID().toHexString().compareTo(object2.getContactID().toHexString());
       
        if (columnID == KAD_CLIENT_DISTANCE_COLUMN_ID)
          result = object1.getContactDistance().toBinaryString().compareTo(object2.getContactDistance().toBinaryString());
       
        if (!order)
          result = Misc.reverse(result);
        return result;
      }

      protected Menu getPopUpMenu() {
       
        return null;
      }


      public void updateRow(KadContact object) {
        String imageName = "";
        if (object.getContactType() == ContactType.Active2MoreHours) imageName="contact0.png";
        if (object.getContactType() == ContactType.Active1Hour) imageName="contact1.png";
        if (object.getContactType() == ContactType.Active) imageName="contact2.png";
        if (object.getContactType() == ContactType.JustAdded) imageName="contact3.png";
        if (object.getContactType() == ContactType.ScheduledForRemoval) imageName="contact4.png";
        setRowImage(object, KAD_CLIENT_ID_COLUMN_ID, SWTImageRepository.getImage(imageName));
        setRowText(object, KAD_CLIENT_ID_COLUMN_ID, object.getContactID().toHexString());
        setRowText(object, KAD_CLIENT_DISTANCE_COLUMN_ID, object.getContactDistance().toBinaryString());
      }
     
    };
    contact_list.setLayoutData(new GridData(GridData.FILL_BOTH));
    contact_list.addColumn(SWT.LEFT, KAD_CLIENT_ID_COLUMN_ID, _._("mainwindow.kadtab.contact_list.column.contact_id"), _._("mainwindow.kadtab.contact_list.column.contact_id.desc"), swtPreferences.getColumnWidth(KAD_CLIENT_ID_COLUMN_ID));
    contact_list.addColumn(SWT.LEFT, KAD_CLIENT_DISTANCE_COLUMN_ID, _._("mainwindow.kadtab.contact_list.column.contact_distance"), _._("mainwindow.kadtab.contact_list.column.contact_distance.desc"), swtPreferences.getColumnWidth(KAD_CLIENT_DISTANCE_COLUMN_ID));
   
    _core.getJKadManager().getRoutingTable().addListener(new RoutingTableListener() {
      public void contactAdded(final KadContact contact) {
        Display.getDefault().asyncExec(new Runnable() {
          public void run() {
            if (isDisposed()) return;
            contact_list.addRow(contact);
            routing_table_container.setText(_._("mainwindow.kadtab.kad_nodes_number",contact_list.getItemCount()+""));
          }
         
        });
       
      }

      public void contactRemoved(final KadContact contact) {
        Display.getDefault().asyncExec(new Runnable() {
          public void run() {
            if (isDisposed()) return;
            contact_list.removeRow(contact);
            routing_table_container.setText(_._("mainwindow.kadtab.kad_nodes_number",contact_list.getItemCount()+""));
          }
         
        });
      }

      public void contactUpdated(final KadContact contact) {
        Display.getDefault().asyncExec(new Runnable() {
          public void run() {
            if (isDisposed()) return;
            contact_list.updateRow(contact);
            routing_table_container.setText(_._("mainwindow.kadtab.kad_nodes_number",contact_list.getItemCount()+""));
          }
         
        });
      }

      public void allContactsRemoved() {
        Display.getDefault().asyncExec(new Runnable() {
          public void run() {
            if (isDisposed()) return;
            contact_list.clear();
          }
         
        });
      }
     
    });
   
    for(KadContact contact : _core.getJKadManager().getRoutingTable().getContacts())
      contact_list.addRow(contact);
   
    routing_table_container.setText(_._("mainwindow.kadtab.kad_nodes_number",contact_list.getItemCount()+""));
   
    kad_tasks_container.setLayout(new FillLayout());
    kad_task_list = new JMTable<KadTask>(kad_tasks_container,SWT.NONE) {

      protected int compareObjects(KadTask object1, KadTask object2,
          int columnID, boolean order) {
        int result = 0;
        if (columnID == KAD_TASK_TYPE_COLUMN_ID)
          result = object1.task_type.compareTo(object2.task_type);
        if (columnID == KAD_TASK_LOOKUP_HASH_COLUMN_ID)
          result = object1.task_id.compareTo(object2.task_id);
        if (columnID == KAD_TASK_LOOKUP_INFO_COLUMN_ID)
          result = object1.task_info.compareTo(object2.task_info);
        if (!order)
          result = Misc.reverse(result);
        return result;
      }

      protected Menu getPopUpMenu() {
        return null;
      }

      public void updateRow(KadTask object) {
        setRowText(object, KAD_TASK_TYPE_COLUMN_ID, object.task_type);
        setRowText(object, KAD_TASK_LOOKUP_HASH_COLUMN_ID, object.task_id);
        setRowText(object, KAD_TASK_LOOKUP_INFO_COLUMN_ID, object.task_info);
      }
    };
   
    kad_task_list.addColumn(SWT.LEFT, KAD_TASK_TYPE_COLUMN_ID, _._("mainwindow.kadtab.task_list.column.task_type"), _._("mainwindow.kadtab.task_list.column.task_type.desc"), swtPreferences.getColumnWidth(KAD_TASK_TYPE_COLUMN_ID));
    kad_task_list.addColumn(SWT.LEFT, KAD_TASK_LOOKUP_HASH_COLUMN_ID, _._("mainwindow.kadtab.task_list.column.task_hash"), _._("mainwindow.kadtab.task_list.column.task_hash.desc"), swtPreferences.getColumnWidth(KAD_TASK_LOOKUP_HASH_COLUMN_ID));
    kad_task_list.addColumn(SWT.LEFT, KAD_TASK_LOOKUP_INFO_COLUMN_ID, _._("mainwindow.kadtab.task_list.column.task_info"), _._("mainwindow.kadtab.task_list.column.task_info.desc"), swtPreferences.getColumnWidth(KAD_TASK_LOOKUP_INFO_COLUMN_ID));
    kad_task_list.setLinesVisible(true);
    _core.getJKadManager().getLookup().addListener(new LookupListener() {
      public void taskAdded(final LookupTask task) {
        Display.getDefault().asyncExec(new Runnable() {
          public void run() {
            if (isDisposed()) return;
            KadTask kad_task = lookupTaskToKadTask(task);
            if (kad_task != null)
              if (!kad_task_list.hasObject(kad_task)) {
                task_map.put(task.getTargetID(), kad_task);
                kad_task_list.addRow(kad_task);
              }
          }
         
        });
      }

      public void taskRemoved(final LookupTask task) {
        Display.getDefault().asyncExec(new Runnable() {
          public void run() {
            if (isDisposed()) return;
            KadTask kad_task = task_map.get(task.getTargetID());
            if (kad_task == null)
              return;
            kad_task_list.removeRow(kad_task);
          }
         
        });
      }

      public void taskStarted(final LookupTask task) {
        Display.getDefault().asyncExec(new Runnable() {
          public void run() {
            if (isDisposed()) return;
            KadTask kad_task = lookupTaskToKadTask(task);
            if (kad_task != null)
              if (!kad_task_list.hasObject(kad_task)) {
                task_map.remove(task.getTargetID());
                task_map.put(task.getTargetID(), kad_task);
                kad_task_list.updateRow(kad_task);
              }
          }
         
        });
      }
     
    });
   
    Map<Int128,LookupTask> list = _core.getJKadManager().getLookup().getLookupTasks();
    for(LookupTask task : list.values()) {
      KadTask kad_task = lookupTaskToKadTask(task);
      if (kad_task!=null)
        if (!kad_task_list.hasObject(kad_task)) {
          task_map.put(task.getTargetID(), kad_task);
          kad_task_list.addRow(kad_task);
        }
    }
   
    _core.getConfigurationManager().addConfigurationListener(new ConfigurationAdapter() {

      public void jkadStatusChanged(boolean newStatus) {
        if (newStatus == false) {
          setKadStatus.setEnabled(false);
        } else
          setKadStatus.setEnabled(true);
      }
     
    });
  }
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.Button

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.