Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Listener


    // Start All
    MenuItem start_all = new MenuItem(menu, SWT.PUSH);
    Messages.setLanguageText(start_all, "MainWindow.menu.transfers.startalltransfers");
    Utils.setMenuItemImage(start_all, "start");
    start_all.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event e) {
        ManagerUtils.asyncStartAll();
      }
    });
    start_all.setEnabled(true);

    // Stop All
    MenuItem stop_all = new MenuItem(menu, SWT.PUSH);
    Messages.setLanguageText(stop_all, "MainWindow.menu.transfers.stopalltransfers");
    Utils.setMenuItemImage(stop_all, "stop");
    stop_all.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event e) {
        ManagerUtils.asyncStopAll();
      }
    });
    stop_all.setEnabled(true);
   
    // Pause All
    MenuItem pause_all = new MenuItem(menu, SWT.PUSH);
    Messages.setLanguageText(pause_all, "MainWindow.menu.transfers.pausetransfers");
    Utils.setMenuItemImage(pause_all, "pause");
    pause_all.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event e) {
        ManagerUtils.asyncPause();
      }
    });
    pause_all.setEnabled(g_manager.canPauseDownloads());
   
    // Resume All
    MenuItem resume_all = new MenuItem(menu, SWT.PUSH);
    Messages.setLanguageText(resume_all, "MainWindow.menu.transfers.resumetransfers");
    Utils.setMenuItemImage(resume_all, "resume");
    resume_all.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event e) {
        ManagerUtils.asyncResume();
      }
    });
    resume_all.setEnabled(g_manager.canResumeDownloads());
View Full Code Here


    this.needs_update = true;
    this_mon.exit();
  }

  public void created(final MainStatusBar.CLabelPadding label) {
    final Listener click_listener = new Listener() {
      public void handleEvent(Event e) {
        onClick();
      }
    };
View Full Code Here

    data.right = new FormAttachment(100,-5);
    data.width = 100;
    data.bottom = new FormAttachment(100,-5);
    action.setLayoutData(data);
   
    cancel.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event arg0) {
        if(lookup != null) {
          lookup.cancel();
        }
        if(!shell.isDisposed()) {
          shell.dispose();
        }
      }
    });
   
    mainLayout = new StackLayout();
    mainComposite.setLayout(mainLayout);
   
    loadingPanel = new Composite(mainComposite,SWT.NONE);
    loadingPanel.setLayout(new FormLayout());
   
    listPanel = new Composite(mainComposite,SWT.NONE);
    listPanel.setLayout(new FillLayout());
   
    subscriptionsList = new Table(listPanel,SWT.V_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION | SWT.VIRTUAL);
    subscriptionsList.setHeaderVisible(true);
   
    TableColumn name = new TableColumn(subscriptionsList,SWT.NONE);
    name.setText(MessageText.getString("subscriptions.listwindow.name"));
    name.setWidth(310);
    name.setResizable(false);
   
    TableColumn popularity = new TableColumn(subscriptionsList,SWT.NONE);
    popularity.setText(MessageText.getString("subscriptions.listwindow.popularity"));
    popularity.setWidth(70);
    popularity.setResizable(false);
   
    subscriptionsList.addListener(SWT.SetData, new Listener() {
      public void handleEvent(Event e) {
        TableItem item = (TableItem) e.item;
        int index = subscriptionsList.indexOf(item);
        if(index >= 0 && index < subscriptionItems.length) {
          SubscriptionItemModel subscriptionItem = subscriptionItems[index];
          item.setText(0,subscriptionItem.name);
          item.setText(1,subscriptionItem.popularityDisplay);
        }
      }
    });
   
    subscriptionsList.setSortColumn(popularity);
    subscriptionsList.setSortDirection(SWT.DOWN);
   
    subscriptionsList.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event arg0) {
        action.setEnabled(subscriptionsList.getSelectionIndex() != -1);
      }
    });
   
    Listener sortListener = new Listener() {
      public void handleEvent(Event e) {
        // determine new sort column and direction
        TableColumn sortColumn = subscriptionsList.getSortColumn();
        TableColumn currentColumn = (TableColumn) e.widget;
        int dir = subscriptionsList.getSortDirection();
        if (sortColumn == currentColumn) {
          dir = dir == SWT.UP ? SWT.DOWN : SWT.UP;
        } else {
          subscriptionsList.setSortColumn(currentColumn);
          dir = SWT.DOWN;
        }
        subscriptionsList.setSortDirection(dir);
        sortAndRefresh();
      }
    };
    name.addListener(SWT.Selection, sortListener);
    popularity.addListener(SWT.Selection, sortListener);
   
    animatedImage = new AnimatedImage(loadingPanel);
    loadingText = new Label(loadingPanel,SWT.WRAP | SWT.CENTER);
    loadingProgress = new ProgressBar(loadingPanel,SWT.HORIZONTAL);
   
    animatedImage.setImageFromName("spinner_big");
    String contentName = "Dummy";
    if(download != null) {
      contentName = download.getDisplayName();
    }
    loadingText.setText(MessageText.getString("subscriptions.listwindow.loadingtext", new String[] {contentName}));
   
    loadingProgress.setMinimum(0);
    loadingProgress.setMaximum(300);
    loadingProgress.setSelection(0);
   
    data = new FormData();
    data.left = new FormAttachment(1,2,-16);
    data.top = new FormAttachment(1,2,-32);
    data.width = 32;
    data.height = 32;
    animatedImage.setLayoutData(data);
   
    data = new FormData();
    data.left = new FormAttachment(0,5);
    data.right = new FormAttachment(100,-5);
    data.top = new FormAttachment(animatedImage.getControl(),10);
    data.height = 50;
    loadingText.setLayoutData(data);
   
    data = new FormData();
    data.left = new FormAttachment(0,5);
    data.right = new FormAttachment(100,-5);
    data.top = new FormAttachment(loadingText,5);
    loadingProgress.setLayoutData(data);
   
    boolean autoCheck = COConfigurationManager.getBooleanParameter("subscriptions.autocheck");
   
    if(autoCheck) {
      startChecking();
    } else {
      action.setText(MessageText.getString("Button.yes"));
      Composite acceptPanel = new Composite(mainComposite,SWT.NONE);
      acceptPanel.setLayout(new FormLayout());
     
      Label acceptLabel = new Label(acceptPanel,SWT.WRAP | SWT.CENTER);
     
      acceptLabel.setText(MessageText.getString("subscriptions.listwindow.autochecktext"));
     
      data = new FormData();
      data.left = new FormAttachment(0,5);
      data.right = new FormAttachment(100,-5);
      data.top = new FormAttachment(1,3,0);
      acceptLabel.setLayoutData(data);
     
      action.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
          action.removeListener(SWT.Selection,this);
          COConfigurationManager.setParameter("subscriptions.autocheck",true);
          startChecking();
          mainComposite.layout()
View Full Code Here

            mainComposite.layout();
           
            sortAndRefresh();
            subscriptionsList.setSelection(0);
           
            action.addListener(SWT.Selection, new Listener() {
              public void handleEvent(Event arg0) {
                if(subscriptionsList != null && !subscriptionsList.isDisposed()) {
                  int selectedIndex = subscriptionsList.getSelectionIndex();
                  if(selectedIndex >= 0 && selectedIndex < subscriptionItems.length) {
                    Subscription subscription = (Subscription) subscriptionItems[selectedIndex].subscription;
View Full Code Here

   
    // Queue
    final MenuItem itemQueue = new MenuItem(menu, SWT.PUSH);
    Messages.setLanguageText(itemQueue, "MyTorrentsView.menu.queue");
    Utils.setMenuItemImage(itemQueue, "start");
    itemQueue.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event e) {
        ManagerUtils.queue(download, splash);
      }
    });
    itemQueue.setEnabled(ManagerUtils.isStartable(download));


    // Stop
    final MenuItem itemStop = new MenuItem(menu, SWT.PUSH);
    Messages.setLanguageText(itemStop, "MyTorrentsView.menu.stop");
    Utils.setMenuItemImage(itemStop, "stop");
    itemStop.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event e) {
        ManagerUtils.stop(download, splash);
      }
    });
    itemStop.setEnabled(ManagerUtils.isStopable(download));
View Full Code Here

    textPath.setLayoutData(gridData);
    textPath.setText(((ImportTorrentWizard)wizard).getTorrentFile());
 
    Button browse = new Button(panel,SWT.PUSH);
    Messages.setLanguageText(browse, "importTorrentWizard.torrentfile.browse");
    browse.addListener(SWT.Selection,new Listener() {
     
      public void handleEvent(Event arg0){
       
      FileDialog fd = new FileDialog(wizard.getWizardWindow(), SWT.SAVE);
     
      fd.setFileName(textPath.getText());
     
      fd.setFilterExtensions(new String[]{"*.torrent", "*.tor", Constants.FILE_WILDCARD});
     
      String path = fd.open();
     
      if(path != null) {
       
        textPath.setText(path);
      }    
      }
    });
 
    textPath.addListener(SWT.Modify, new Listener(){
     
      public void handleEvent(Event event) {
      String path = textPath.getText();
     
      pathSet( path );
View Full Code Here

       bOk.setText(MessageText.getString("Button.ok"));
       gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END | GridData.HORIZONTAL_ALIGN_FILL);
       gridData.grabExcessHorizontalSpace = true;
       gridData.widthHint = 70;
       bOk.setLayoutData(gridData);
       bOk.addListener(SWT.Selection,new Listener() {
          public void handleEvent(Event e) {
           close(true);
           }
       });
     
       Button bCancel = new Button(shell,SWT.PUSH);
       bCancel.setText(MessageText.getString("Button.cancel"));
       gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
       gridData.grabExcessHorizontalSpace = false;
       gridData.widthHint = 70;
       bCancel.setLayoutData(gridData);   
       bCancel.addListener(SWT.Selection,new Listener() {
         public void handleEvent(Event e) {
           close(false);
           }
       });
     
      shell.setDefaultButton( bOk );
     
      shell.addListener(SWT.Traverse, new Listener() { 
        public void handleEvent(Event e) {
          if ( e.character == SWT.ESC){
            close( false );
          }
        }
View Full Code Here

    if (true == isDocked) {

      performDocking();

      if (null == dockingEnabler) {
        dockingEnabler = new Listener() {

          public void handleEvent(Event event) {
            if (event.type == SWT.Resize) {

              if (true == isResizeWithShell()) {
                System.out.println("resizing");//KN: sysout
              } else {
                performDocking();
              }
            } else if (event.type == SWT.Move) {
              performDocking();
            }

          }
        };
      }

      if (null != mainShell && false == mainShell.isDisposed()) {
        if (true == isMoveWithShell()) {
          mainShell.addListener(SWT.Move, dockingEnabler);
        }
        if (true == isResizeWithShell()) {
          mainShell.addListener(SWT.Resize, dockingEnabler);
        }
        anchorControl.addListener(SWT.Move, dockingEnabler);
        anchorControl.addListener(SWT.Resize, dockingEnabler);
      }

      anchorControl.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
          setDocked(false);
        }
      });

      dockedShell.addListener(SWT.Close, new Listener() {
        public void handleEvent(Event e) {
          setDocked(false);

        }
      });
View Full Code Here

    textPath.setLayoutData(gridData);
    textPath.setText("");
 
    Button browse = new Button(panel,SWT.PUSH);
    Messages.setLanguageText(browse, "importTorrentWizard.importfile.browse");
    browse.addListener(SWT.Selection,new Listener() {
      public void handleEvent(Event arg0) {
       
      FileDialog fd = new FileDialog(wizard.getWizardWindow());
     
      fd.setFileName(textPath.getText());
     
      fd.setFilterExtensions(new String[]{"*.xml", Constants.FILE_WILDCARD});
     
      String path = fd.open();
     
      if(path != null) {
       
        textPath.setText(path);     
      }    
      }
    });
 
    textPath.addListener(SWT.Modify, new Listener(){
     
      public void handleEvent(Event event) {
       
      String path = textPath.getText();
     
View Full Code Here

   
    if (skinObject instanceof SWTSkinObjectButton) {
      return;
    }
   
    Listener l = new Listener() {
      boolean bDownPressed;
      private TimerEvent timerEvent;

      public void handleEvent(Event event) {
        if (event.type == SWT.MouseDown) {
          if (timerEvent == null) {
            timerEvent = SimpleTimer.addEvent("MouseHold",
                SystemTime.getOffsetTime(1000), new TimerEventPerformer() {
                  public void perform(TimerEvent event) {
                    timerEvent = null;

                    if (!bDownPressed) {
                      return;
                    }
                    bDownPressed = false;

                    boolean stillPressed = true;
                    for (Iterator iter = listeners.iterator(); iter.hasNext();) {
                      ButtonListenerAdapter l = (ButtonListenerAdapter) iter.next();
                      stillPressed &= !l.held(SWTSkinButtonUtility.this);
                    }
                    bDownPressed = stillPressed;
                  }
                });
          }
          bDownPressed = true;
          return;
        } else {
          if (timerEvent != null) {
            timerEvent.cancel();
            timerEvent = null;
          }
          if (!bDownPressed) {
            return;
          }
        }

        bDownPressed = false;

        if (isDisabled()) {
          return;
        }

        for (Iterator iter = listeners.iterator(); iter.hasNext();) {
          ButtonListenerAdapter l = (ButtonListenerAdapter) iter.next();
          l.pressed(SWTSkinButtonUtility.this);
          l.pressed(SWTSkinButtonUtility.this,
              SWTSkinButtonUtility.this.skinObject, event.stateMask);
        }
      }
    };
    if (skinObject instanceof SWTSkinObjectContainer) {
View Full Code Here

TOP

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

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.