Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Text


      container.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

      Label l2 = new Label(container, SWT.NONE);
      l2.setText("Link: ");

      fLinkInput = new Text(container, SWT.SINGLE | SWT.BORDER);

      if (StringUtils.isSet(fInitialLinkValue) && !fInitialLinkValue.equals(HTTP)) {
        fLinkInput.setText(fInitialLinkValue);
        fLinkInput.selectAll();
      } else {
        fLinkInput.setText(HTTP);
        fLinkInput.setSelection(HTTP.length());
      }

      fLinkInput.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
      fLinkInput.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
          validateInput();
        }
      });

      Label l1 = new Label(container, SWT.NONE);
      l1.setText("Name: ");

      Composite nameContainer = new Composite(container, SWT.BORDER);
      nameContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
      nameContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 0));
      nameContainer.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_WHITE));

      fNameInput = new Text(nameContainer, SWT.SINGLE);
      fNameInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
      fNameInput.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
          validateInput();
        }
View Full Code Here


    Label usernameLabel = new Label(composite, SWT.NONE);
    usernameLabel.setText("Username: ");
    usernameLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));

    /* Username input field */
    fUsername = new Text(composite, SWT.SINGLE | SWT.BORDER);
    fUsername.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    fUsername.setFocus();

    /* Password Label */
    Label passwordLabel = new Label(composite, SWT.NONE);
    passwordLabel.setText("Password: ");
    passwordLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));

    /* Password input field */
    fPassword = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
    fPassword.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    /* Separator */
    Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
    separator.setLayoutData(new GridData(SWT.FILL, SWT.END, true, true));
View Full Code Here

      container.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

      Label l2 = new Label(container, SWT.NONE);
      l2.setText("Link: ");

      fLinkInput = new Text(container, SWT.SINGLE | SWT.BORDER);

      if (StringUtils.isSet(fInitialLinkValue) && !fInitialLinkValue.equals(HTTP)) {
        fLinkInput.setText(fInitialLinkValue);
        fLinkInput.selectAll();
      } else {
        fLinkInput.setText(HTTP);
        fLinkInput.setSelection(HTTP.length());
      }

      fLinkInput.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
      fLinkInput.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
          validateInput();
        }
      });

      Label l1 = new Label(container, SWT.NONE);
      l1.setText("Name: ");

      Composite nameContainer = new Composite(container, SWT.BORDER);
      nameContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
      nameContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 0));
      nameContainer.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_WHITE));

      fNameInput = new Text(nameContainer, SWT.SINGLE);
      fNameInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
      fNameInput.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
          validateInput();
        }
View Full Code Here

    fNavigationToolBarManager.createControl(parent);
  }

  private void createLocationInput(Composite parent) {
    fLocationInput = new Text(parent, SWT.BORDER | SWT.SINGLE);
    fLocationInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
    fLocationInput.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetDefaultSelected(SelectionEvent e) {
        if (StringUtils.isSet(fLocationInput.getText())) {
View Full Code Here

    container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    Label nameLabel = new Label(container, SWT.NONE);
    nameLabel.setText("Name: ");

    fNameInput = new Text(container, SWT.SINGLE | SWT.BORDER);
    fNameInput.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    fNameInput.addModifyListener(new ModifyListener() {
      public void modifyText(ModifyEvent e) {
        validateInput();
      }
View Full Code Here

    Label usernameLabel = new Label(composite, SWT.NONE);
    usernameLabel.setText("Username: ");
    usernameLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));

    /* Username input field */
    fUsername = new Text(composite, SWT.SINGLE | SWT.BORDER);
    fUsername.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    fUsername.setFocus();

    /* Password Label */
    Label passwordLabel = new Label(composite, SWT.NONE);
    passwordLabel.setText("Password: ");
    passwordLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));

    /* Password input field */
    fPassword = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
    fPassword.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    /* Separator */
    Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
    separator.setLayoutData(new GridData(SWT.FILL, SWT.END, true, true));
View Full Code Here

      container.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

      Label l1 = new Label(container, SWT.NONE);
      l1.setText("Name: ");

      fNameInput = new Text(container, SWT.SINGLE | SWT.BORDER);
      fNameInput.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
      fNameInput.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
          validateInput();
        }
View Full Code Here

      Label label = new Label(control, SWT.None);
      label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
      label.setText("File: ");

      fInput = new Text(control, SWT.BORDER);
      fInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
      fInput.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
          setErrorMessage(null);
        }
View Full Code Here

          break;
        }

          /* Type: Enumeration */
        case ISearchValueType.ENUM: {
          final Text text = new Text(inputField, SWT.BORDER);
          text.addListener(SWT.Modify, new Listener() {
            public void handleEvent(Event event) {
              fInputValue = text.getText();

              if (!fInputValue.equals(input))
                fModified = true;
            }
          });

          /* Provide Auto-Complete Field */
          hookAutoComplete(text, field.getSearchValueType().getEnumValues());

          /* Pre-Select input if given */
          String inputValue = (input != null ? input.toString() : null);
          if (inputValue != null)
            text.setText(inputValue);

          /* Update Input Value */
          fInputValue = text.getText();

          break;
        }

          /* Type: Number */
        case ISearchValueType.NUMBER:
        case ISearchValueType.INTEGER: {
          final Spinner spinner = new Spinner(inputField, SWT.BORDER);
          spinner.setMinimum(0);
          spinner.setMaximum(1000);
          spinner.addListener(SWT.Modify, new Listener() {
            public void handleEvent(Event event) {
              fInputValue = spinner.getSelection();

              if (!fInputValue.equals(input))
                fModified = true;
            }
          });

          /* Pre-Select input if given */
          Object presetInput = (input == null) ? fInputValue : input;
          if (presetInput != null && presetInput instanceof Integer)
            spinner.setSelection((Integer) presetInput);

          /* Update Input Value */
          fInputValue = spinner.getSelection();

          break;
        }

          /* Type: String */
        case ISearchValueType.STRING:
        case ISearchValueType.LINK: {
          final Text text = new Text(inputField, SWT.BORDER);
          text.addListener(SWT.Modify, new Listener() {
            public void handleEvent(Event event) {
              fInputValue = text.getText();

              if (!fInputValue.equals(input))
                fModified = true;
            }
          });

          /* Provide auto-complete for Categories, Authors and Feeds */
          if (field.getId() == INews.CATEGORIES || field.getId() == INews.AUTHOR || field.getId() == INews.FEED) {
            final Pair<SimpleContentProposalProvider, ContentProposalAdapter> pair = hookAutoComplete(text, null);

            /* Load proposals in the Background */
            JobRunner.runDelayedInBackgroundThread(new Runnable() {
              public void run() {
                if (!text.isDisposed()) {
                  Set<String> values = null;
                  if (field.getId() == INews.CATEGORIES)
                    values = fDaoService.getCategoryDAO().loadAllNames();
                  else if (field.getId() == INews.AUTHOR)
                    values = fDaoService.getPersonDAO().loadAllNames();
                  else if (field.getId() == INews.FEED)
                    values = Controller.getDefault().getCacheService().getFeedLinks();

                  /* Apply Proposals */
                  if (!text.isDisposed())
                    applyProposals(values, pair.getFirst(), pair.getSecond());
                }
              }
            });
          }

          /* Pre-Select input if given */
          Object presetInput = (input == null && fInputValue instanceof String) ? fInputValue : input;
          if (presetInput != null)
            text.setText(presetInput.toString());

          /* Update Input Value */
          fInputValue = text.getText();

          break;
        }
      }
    }
View Full Code Here

      control.setLayout(new GridLayout(2, false));

      Label label = new Label(control, SWT.NONE);
      label.setText("Name: ");

      fNameInput = new Text(control, SWT.BORDER);
      fNameInput.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
      fNameInput.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
          setErrorMessage(null);
        }
View Full Code Here

TOP

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

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.