Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Das XdevTextField ist ein einzeiliges Eingabefeld und eines der am häufigsten verwendeten Formular-Komponenten, das via XdevFieldGroup persistiert werden kann.  

Image Removed

...

The XdevTextField is a single-row input field and one of the most frequently used form components, which can be persisted via the XdevFieldGroup.

Image Added

Important properties:
  • Include Page
    Property TextChangeEventMode
    Property TextChangeEventMode
  • Include Page
    Property TextChangeTimeout
    Property TextChangeTimeout

...

Important events:
  • Include Page
    Event textChange
    Event textChange
  • Misc 

    • Include Page
      Event valueChange
      Event valueChange

Examples:
  • Inhalt zuweisen - Weist dem XdevTextField einen Text als String zu. Dies kann ggf. ein textChange oder valueChange Event auslösen.
    Einfachste Art der Zuweisung meinst nur mit Strings 100% funktional. Diverse Converter liefern mit dieser Methode ein unbefriedigendes ErgebnisAllocate content - Allocates a text as string to the XdevTextField. This may trigger a textChange or valueChange event. 
    This is the simplest type of allocation. However, it is 100% functional only with strings. When this method is used, diverse converters deliver an unsatisfactory output.

    Code Block
    languagejava
    themeConfluence
    textField.setValue("Hello 123 !!!");
  • Inhalt zuweisen - Weist dem XdevTextField einen speziellen Wert zu. Als Beispiel ein BigDecimal Datentyp für Währungen oder Double für spezielle Formatierungen mit Nachkommastellen etc.
    Bei dieser Art der Zuweisung funktionieren die gelieferten Converter optimalAllocate content - Allocates a specific value to the XdevTextField. As an example, a BigDecimal data type for currencies or Double for specific formatting with decimal places, etc.
    When this type of allocation is employed, the delivered converter functions optimally.

    Code Block
    languagejava
    themeConfluence
    Property<BigDecimal> betrag = new ObjectProperty<BigDecimal>(new BigDecimal(100), BigDecimal.class);
    textField.setPropertyDataSource(betrag);

    oderor

    Code Block
    languagejava
    themeConfluence
    Property<Double> betrag = new ObjectProperty<Double>(new Double(100), Double.class);
    textField.setPropertyDataSource(betrag);
  • Inhalt ändern - Wurde dem Textfield bereits eine Property zugewiesen (siehe Beispiel 2.) so kann mit dieser Kurzschreibweise der Wert in der Property direkt geändert werden ohne eine neue Datasource zu setzenChange content - If a property is already allocated to the XdevTextField (refer to example 2), the value can be changed directly in the property in this abbreviated form without setting a new data source.

    Code Block
    languagejava
    themeConfluence
    textField.setConvertedValue(200);
  • Inhalt auslesen Read content

    Code Block
    languagejava
    themeConfluence
    String content = textField.getValue();
  • Inhalt löschen - Löscht den gesamten Text im XdevTextField. Dies kann ggf. ein textChange oder valueChange Event auslösen.Delete content - Deletes the entire content in XdevTextField. This may trigger a textChange or valueChange event

    Code Block
    languagejava
    themeConfluence
    textField.clear();
  • Cursor setzen - Setzt den Cursor an eine bestimmte Position. Die Position wird als int Wert angegebenSet cursor - Set the cursor to a specific position. The position is specified as an int value

    Code Block
    languagejava
    themeConfluence
    textField.setCursorPosition(10);
  • Fokus setzen - Weist dem XdevTextField den Focus zu. Dies kann ggf. ein focus Event auslösenSet focus: Allocates the focus to the XdevTextField. This can trigger a focus event, if necessary.

    Code Block
    languagejava
    themeConfluence
    textField.focus();
  • Inhalt selektierenSelect content

    Code Block
    languagejava
    themeConfluence
    textField.selectAll();
  • Prüfen, ob das Feld leer und oder null istCheck if the field is empty and or null.

    Code Block
    languagejava
    themeConfluence
    boolean empty = textField.isEmpty();
    		
    if (empty) {
    	doSomething();
    }else {
    	doSomething();
    }
  • Prüfen ob sich etwas geändert hatCheck if anything has changed

    Code Block
    languagejava
    themeConfluence
    boolean modified = textField.isModified();
Zur XdevTextField Javadoc
Tipps:

...

Tips:
  • Convert string to integer: If the content of the XdevTextField is an integer, with which you want to calculate further, you must convert the string with the Integer.parseInt(String s) in einen Integer konvertieren. Die Methode nimmt einen String entgegen, der nur Ziffern enthält. Lediglich die Zeichen + und - am Anfang des Wertes sind erlaubt.   method into an integer. The method accepts only a string with characters. Only the characters + and - at the start of the value are permitted.  

    Code Block
    languagejava
    themeConfluence
    String content = textField.getValue();
    Integer value = Integer.parseInt(content);
  • Integer in String umwandeln - Wenn Sie einem XdevTextField eine Ganzzahl zuweisen möchten, müssen Sie diese zuvor in einen String konvertieren, z.B. mit der Methode Integer.toString(Integer i)Convert integer to string: When you want to assign an integer to an XdevTextField, you must first convert it into a string.

    Code Block
    languagejava
    themeConfluence
    Integer value = 100;
    String content = Integer.toString(value);
     
    textField.setValue(content);

...