Examples of Clipboard


Examples of java.awt.datatransfer.Clipboard

    assertEquals("Wrong piece count in home", 0, home.getFurniture().size());
    assertEquals("Wrong wall count in home", 0, home.getWalls().size());
    assertEquals("Wrong dimension count in home", 0, home.getDimensionLines().size());
    // Check only Paste action is enabled
    assertActionsEnabled(controller, false, false, true, false);
    Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
    // Check clipboard contains two different data flavors (HomeTransferableList and Image)
    assertTrue("Missing home data flavor", clipboard.isDataFlavorAvailable(HomeTransferableList.HOME_FLAVOR));
    assertTrue("Missing String flavor", clipboard.isDataFlavorAvailable(DataFlavor.imageFlavor));

    // 8. Paste selected items in plan component
    runAction(tester, controller, HomePane.ActionType.PASTE);
    tester.waitForIdle();
    // Check home contains one piece, one wall and one dimension
    assertEquals("Wrong piece count in home", 1, home.getFurniture().size());
    assertEquals("Wrong wall count in home", 1, home.getWalls().size());
    assertEquals("Wrong dimension count in home", 1, home.getDimensionLines().size());

    // 9. Transfer focus to furniture table
    tester.actionKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK);
    // Check furniture table has focus
    assertTrue("Table doesn't have the focus", furnitureTable.isFocusOwner());
    // Delete selection
    runAction(tester, controller, HomePane.ActionType.DELETE);
    // Check home contains no piece, one wall and one dimension
    assertEquals("Wrong piece count in home", 0, home.getFurniture().size());
    assertEquals("Wrong wall count in home", 1, home.getWalls().size());
    assertEquals("Wrong dimension count in home", 1, home.getDimensionLines().size());
    // Check only Paste action is enabled
    assertActionsEnabled(controller, false, false, true, false);

    // 10. Paste selected items in furniture table
    runAction(tester, controller, HomePane.ActionType.PASTE);
    // Check home contains one piece, one wall and one dimension
    assertEquals("Wrong piece count in home", 1, home.getFurniture().size());
    assertEquals("Wrong wall count in home", 1, home.getWalls().size());
    assertEquals("Wrong dimension count in home", 1, home.getDimensionLines().size());
    // Check Cut, Copy and Paste actions are enabled
    assertActionsEnabled(controller, true, true, true, true);
   
    // 11. Copy selected furniture in clipboard while furniture table has focus
    runAction(tester, controller, HomePane.ActionType.COPY);   
    // Check clipboard contains two different data flavors (HomeTransferableList and String)
    assertTrue("Missing home data flavor", clipboard.isDataFlavorAvailable(HomeTransferableList.HOME_FLAVOR));
    assertTrue("Missing String flavor", clipboard.isDataFlavorAvailable(DataFlavor.stringFlavor));
  }
View Full Code Here

Examples of java.awt.datatransfer.Clipboard

  /**
   * Returns <code>true</code> if clipboard contains data that
   * components are able to handle.
   */
  public boolean isClipboardEmpty() {
    Clipboard clipboard = getToolkit().getSystemClipboard();
    return !(clipboard.isDataFlavorAvailable(HomeTransferableList.HOME_FLAVOR)
        || getToolkit().getSystemClipboard().isDataFlavorAvailable(DataFlavor.javaFileListFlavor));   
  }
View Full Code Here

Examples of javafx.scene.input.Clipboard

    final MenuItem copy = new MenuItem("copy");
    copy.setAccelerator(new KeyCodeCombination(KeyCode.C, KeyCombination.SHORTCUT_DOWN));
    copy.setOnAction(new EventHandler<ActionEvent>() {
      @Override
      public void handle(ActionEvent event) {
        final Clipboard clipboard = Clipboard.getSystemClipboard();
          final ClipboardContent content = new ClipboardContent();
          content.putString(treeView.getSelectionModel().getSelectedItem().getValue().displayname);
          clipboard.setContent(content);
      }
    });
    copy.disableProperty().bind(treeView.getSelectionModel().selectedItemProperty().isNull());
    contextMenu.getItems().add(copy);
    treeView.setContextMenu(contextMenu);
View Full Code Here

Examples of ketUI.Clipboard

  private String processNextReplaceChordIterationString(String string, Chord chord) {
    if (string.matches("\\s*")) {
      modes.error(" !!! Replace responder: cannot replace with a blank string !!! ");
      return null;
    }
    Clipboard clipboard = modes.getClipboard();
    KnownArguments knownArguments = mathCollection.getKnownArguments();
    switch(modes.getDocumentState()) {
      case WRITE_FUNCTION: // &sin
        {
        Argument next = ArgumentParser.parseArgument(string, knownArguments, clipboard, mathCollection);
View Full Code Here

Examples of me.daddychurchill.CityWorld.Clipboard.Clipboard

      File[] schematicFiles = contextFolder.listFiles(matchSchematics());
      for (File schematicFile: schematicFiles) {
        try {
         
          // load a clipboard
          Clipboard clip = new Clipboard_WorldEdit(generator, schematicFile);
         
          // too big?
          if (clip.chunkX > maxX || clip.chunkZ > maxZ) {
            generator.reportMessage("[WorldEdit] Schematic " + schematicFile.getName() +
                " too large, max size = " +
View Full Code Here

Examples of net.rim.device.api.system.Clipboard

      contextMenu.addItem(hotpItem);
    }

    MenuItem copyItem = new MenuItem(sResources, COPY_TO_CLIPBOARD, 0, 0) {
      public void run() {
        Clipboard clipboard = Clipboard.getClipboard();
        clipboard.put(item.mPin);

        String message = sResources.getString(COPIED);
        Dialog.inform(message);
      }
    };
View Full Code Here

Examples of org.eclipse.swt.dnd.Clipboard

      public void handleEvent(Event e) {
        resizeTables(3);
      }
    });

    Clipboard clipboard = new Clipboard(shell.getDisplay());

    String sClipText = (String) clipboard.getContents(TextTransfer.getInstance());
    if (sClipText != null)
      bTorrentInClipboard = addTorrentsFromTextList(sClipText, true) > 0;

    //    label = new Label(shell, SWT.BORDER | SWT.WRAP);
    //    Messages.setLanguageText(label, "OpenTorrentWindow.message");
    //    gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    //    label.setLayoutData(gridData);

    // Torrents
    // ========

    Composite cButtons = new Composite(shell, SWT.NONE);
    RowLayout rLayout = new RowLayout(SWT.HORIZONTAL);
    rLayout.marginBottom = 0;
    rLayout.marginLeft = 0;
    rLayout.marginRight = 0;
    rLayout.marginTop = 0;
    cButtons.setLayout(rLayout);

    // Buttons for tableTorrents

    Button browseTorrent = new Button(cButtons, SWT.PUSH);
    Messages.setLanguageText(browseTorrent, "OpenTorrentWindow.addFiles");
    browseTorrent.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        FileDialog fDialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
        fDialog.setFilterExtensions(new String[] {
          "*.torrent",
          "*.tor",
          Constants.FILE_WILDCARD
        });
        fDialog.setFilterNames(new String[] {
          "*.torrent",
          "*.tor",
          Constants.FILE_WILDCARD
        });
        fDialog.setFilterPath(TorrentOpener.getFilterPathTorrent());
        fDialog.setText(MessageText.getString("MainWindow.dialog.choose.file"));
        String fileName = TorrentOpener.setFilterPathTorrent(fDialog.open());
        if (fileName != null) {
          addTorrents(fDialog.getFilterPath(), fDialog.getFileNames());
        }
      }
    });

    Utils.setGridData(cButtons, GridData.FILL_HORIZONTAL, browseTorrent,
        MIN_BUTTON_HEIGHT);

    Button browseURL = new Button(cButtons, SWT.PUSH);
    Messages.setLanguageText(browseURL, "OpenTorrentWindow.addFiles.URL");
    browseURL.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        browseURL();
      }
    });

    Button browseFolder = new Button(cButtons, SWT.PUSH);
    Messages.setLanguageText(browseFolder, "OpenTorrentWindow.addFiles.Folder");
    browseFolder.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        DirectoryDialog fDialog = new DirectoryDialog(shell, SWT.NULL);
        fDialog.setFilterPath(TorrentOpener.getFilterPathTorrent());
        fDialog.setMessage(MessageText.getString("MainWindow.dialog.choose.folder"));
        String path = TorrentOpener.setFilterPathTorrent(fDialog.open());
        if (path != null) {
          addTorrents(path, null);
        }
      }
    });

    if (bTorrentInClipboard) {
      Button pasteOpen = new Button(cButtons, SWT.PUSH);
      Messages.setLanguageText(pasteOpen,
          "OpenTorrentWindow.addFiles.Clipboard");
      pasteOpen.setToolTipText(sClipText);
      pasteOpen.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
          Clipboard clipboard = new Clipboard(shell.getDisplay());

          String sClipText = (String) clipboard.getContents(TextTransfer.getInstance());
          if (sClipText != null) {
            addTorrentsFromTextList(sClipText.trim(), false);
          }
        }
      });
    }

    Group gTorrentsArea = new Group(shell, SWT.NONE);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gTorrentsArea.setLayoutData(gridData);
    layout = FixupLayout(new GridLayout(), true);
    gTorrentsArea.setLayout(layout);
    Messages.setLanguageText(gTorrentsArea, "OpenTorrentWindow.torrentLocation");

    Composite cTorrentList = new Composite(gTorrentsArea, SWT.NONE);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    cTorrentList.setLayoutData(gridData);

    createTorrentListArea(cTorrentList);

    Composite cTorrentOptions = new Composite(gTorrentsArea, SWT.NONE);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    cTorrentOptions.setLayoutData(gridData);
    layout = FixupLayout(new GridLayout(), true);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    cTorrentOptions.setLayout(layout);

    label = new Label(cTorrentOptions, SWT.NONE);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    label.setLayoutData(gridData);
    Messages.setLanguageText(label, "OpenTorrentWindow.torrent.options");

    int userMode = COConfigurationManager.getIntParameter("User Mode");
    if (userMode > 0) {
      Composite cTorrentModes = new Composite(cTorrentOptions, SWT.NONE);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      cTorrentModes.setLayoutData(gridData);
      layout = new GridLayout();
      layout.numColumns = 4;
      layout.marginWidth = 0;
      layout.marginHeight = 0;
      cTorrentModes.setLayout(layout);

      label = new Label(cTorrentModes, SWT.NONE);
      gridData = new GridData(GridData.VERTICAL_ALIGN_CENTER);
      label.setLayoutData(gridData);
      Messages.setLanguageText(label, "OpenTorrentWindow.startMode");

      cmbStartMode = new Combo(cTorrentModes, SWT.BORDER | SWT.READ_ONLY);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      cmbStartMode.setLayoutData(gridData);
      updateStartModeCombo();
      cmbStartMode.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
          setSelectedStartMode(cmbStartMode.getSelectionIndex());
        }
      });

      label = new Label(cTorrentModes, SWT.NONE);
      gridData = new GridData(GridData.VERTICAL_ALIGN_CENTER);
      label.setLayoutData(gridData);
      Messages.setLanguageText(label, "OpenTorrentWindow.addPosition");

      cmbQueueLocation = new Combo(cTorrentModes, SWT.BORDER | SWT.READ_ONLY);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      cmbQueueLocation.setLayoutData(gridData);
      updateQueueLocationCombo();
      cmbQueueLocation.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
          setSelectedQueueLocation(cmbQueueLocation.getSelectionIndex());
        }
      });
    }

    // Save To..
    // =========

    cSaveTo = new Composite(cTorrentOptions, SWT.NONE);
    layout = FixupLayout(new GridLayout(), false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = 0;
    layout.numColumns = 2;
    cSaveTo.setLayout(layout);

    Label lblDataDir = new Label(cSaveTo, SWT.NONE);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gridData.horizontalSpan = 2;
    lblDataDir.setLayoutData(gridData);
    Messages.setLanguageText(lblDataDir, "OpenTorrentWindow.dataLocation");

    cmbDataDir = new Combo(cSaveTo, SWT.BORDER);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    cmbDataDir.setLayoutData(gridData);

    cmbDataDir.addModifyListener(new ModifyListener() {
      public void modifyText(ModifyEvent e) {
        cmbDataDirChanged();
      }
    });
    cmbDataDir.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        cmbDataDirChanged();
      }
    });

    updateDataDirCombo();
    dirList = COConfigurationManager.getStringListParameter("saveTo_list");
    StringIterator iter = dirList.iterator();
    while (iter.hasNext()) {
      String s = iter.next();
      if (!s.equals(sDestDir)) {
        cmbDataDir.add(s);
      }
    }

    Button browseData = new Button(cSaveTo, SWT.PUSH);
    Messages.setLanguageText(browseData, "ConfigView.button.browse");

    browseData.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        String sSavePath;
        String sDefPath = cmbDataDir.getText();

        File f = new File(sDefPath);
        if (sDefPath.length() > 0) {
          while (!f.exists()) {
            f = f.getParentFile();
            if (f == null) {
              f = new File(sDefPath);
              break;
            }
          }
        }

        DirectoryDialog dDialog = new DirectoryDialog(shell, SWT.SYSTEM_MODAL);
        dDialog.setFilterPath(f.getAbsolutePath());
        dDialog.setMessage(MessageText.getString("MainWindow.dialog.choose.savepath_forallfiles"));
        sSavePath = dDialog.open();

        if (sSavePath != null) {
          cmbDataDir.setText(sSavePath);
        }
      }
    });

    gridData = new GridData(GridData.FILL_HORIZONTAL);
    cSaveTo.setLayoutData(gridData);

    // File List
    // =========

    Group gFilesArea = new Group(shell, SWT.NONE);
    gridData = new GridData(GridData.FILL_BOTH);
    gFilesArea.setLayoutData(gridData);
    layout = FixupLayout(new GridLayout(), true);
    gFilesArea.setLayout(layout);
    Messages.setLanguageText(gFilesArea, "OpenTorrentWindow.fileList");

    createTableDataFiles(gFilesArea);

    // Ok, cancel

    cArea = new Composite(shell, SWT.NULL);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.numColumns = 2;
    cArea.setLayout(layout);

    ok = new Button(cArea, SWT.PUSH);
    Messages.setLanguageText(ok, "Button.ok");
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
    gridData.widthHint = 70;
    ok.setLayoutData(gridData);
    shell.setDefaultButton(ok);
    ok.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        okPressed();
      }
    });

    checkSeedingMode();

    Button cancel = new Button(cArea, SWT.PUSH);
    Messages.setLanguageText(cancel, "Button.cancel");
    gridData = new GridData();
    gridData.widthHint = 70;
    cancel.setLayoutData(gridData);
    cancel.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        close(true, true);
      }
    });

    Utils.setGridData(cArea, GridData.HORIZONTAL_ALIGN_END, ok,
        MIN_BUTTON_HEIGHT);

    shell.addDisposeListener(new DisposeListener() {
      public void widgetDisposed(DisposeEvent e) {
        if (!bClosed)
          close(false, true);
      }
    });

    shell.addListener(SWT.Traverse, new Listener() {
      public void handleEvent(Event e) {
        if (e.detail == SWT.TRAVERSE_ESCAPE) {
          close(true, true);
        }
      }
    });

    KeyListener pasteKeyListener = new org.eclipse.swt.events.KeyAdapter() {
      public void keyPressed(KeyEvent e) {
        int key = e.character;
        if ((e.stateMask & SWT.MOD1) != 0 && e.character <= 26
            && e.character > 0)
          key += 'a' - 1;

        if ((key == 'v' && (e.stateMask & SWT.MOD1) > 0)
            || (e.keyCode == SWT.INSERT && (e.stateMask & SWT.SHIFT) > 0)) {
          e.doit = false;

          // Paste
          Clipboard clipboard = new Clipboard(shell.getDisplay());

          String sClipText = (String) clipboard.getContents(TextTransfer.getInstance());
          if (sClipText != null) {
            addTorrentsFromTextList(sClipText, false);
          }
        }
      }
View Full Code Here

Examples of org.eclipse.swt.dnd.Clipboard

            copyToClipboard();
          }
          protected void
          copyToClipboard()
          {
            new Clipboard(parent.getDisplay()).setContents(new Object[] {public_key_value.getText()}, new Transfer[] {TextTransfer.getInstance()});
          }
        });
     
      crypt_man.addKeyListener(
          new CryptoManagerKeyListener()
View Full Code Here

Examples of org.eclipse.swt.dnd.Clipboard

    hash.setForeground(Colors.blue);
    label.addMouseListener(new MouseAdapter() {
      public void mouseDoubleClick(MouseEvent arg0) {
        String hash_str = hash.getText();
        if(hash_str != null && hash_str.length() != 0)
          new Clipboard(display).setContents(new Object[] {hash_str.replaceAll(" ","")}, new Transfer[] {TextTransfer.getInstance()});
      }
      public void mouseDown(MouseEvent arg0) {
        String hash_str = hash.getText();
        if(hash_str != null && hash_str.length() != 0)
          new Clipboard(display).setContents(new Object[] {hash_str.replaceAll(" ","")}, new Transfer[] {TextTransfer.getInstance()});
      }
    });
    hash.addMouseListener(new MouseAdapter() {
      public void mouseDoubleClick(MouseEvent arg0) {
        String hash_str = hash.getText();
        if(hash_str != null && hash_str.length() != 0)
          new Clipboard(display).setContents(new Object[] {hash_str.replaceAll(" ","")}, new Transfer[] {TextTransfer.getInstance()});
      }
      public void mouseDown(MouseEvent arg0) {
        String hash_str = hash.getText();
        if(hash_str != null && hash_str.length() != 0)
          new Clipboard(display).setContents(new Object[] {hash_str.replaceAll(" ","")}, new Transfer[] {TextTransfer.getInstance()});
      }
    });
   
   
    label = new Label(gInfo, SWT.LEFT);
View Full Code Here

Examples of org.eclipse.swt.dnd.Clipboard

    label.setForeground(Colors.blue);
    label.addMouseListener(new MouseAdapter() {
      public void mouseDoubleClick(MouseEvent arg0) {
        String announce = trackerUrlValue.getText();
        if (announce != null && announce.length() != 0) {
          new Clipboard(display).setContents(new Object[] {
            announce
          }, new Transfer[] {
            TextTransfer.getInstance()
          });
        }
      }

      public void mouseDown(MouseEvent arg0) {
        String announce = trackerUrlValue.getText();
        if (announce != null && announce.length() != 0) {
          new Clipboard(display).setContents(new Object[] {
            announce
          }, new Transfer[] {
            TextTransfer.getInstance()
          });
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.