Search in sources :

Example 1 with DataField

use of com.servoy.j2db.smart.dataui.DataField in project servoy-client by Servoy.

the class J2DBClient method updateInsertModeIcon.

/**
 * updates the insert mode icon for the given display
 *
 * @param display
 */
public void updateInsertModeIcon(IDisplay display) {
    Icon icon = empty;
    if (display instanceof DataField) {
        DataField field = (DataField) display;
        AbstractFormatterFactory formatterFactory = field.getFormatterFactory();
        if (formatterFactory instanceof DefaultFormatterFactory) {
            DefaultFormatterFactory factory = ((DefaultFormatterFactory) formatterFactory);
            AbstractFormatter editFormatter = factory.getEditFormatter();
            if (editFormatter == null)
                editFormatter = factory.getDefaultFormatter();
            if (editFormatter instanceof DefaultFormatter && !(editFormatter instanceof MaskFormatter)) {
                if (((DefaultFormatter) editFormatter).getOverwriteMode()) {
                    icon = overwrite;
                } else {
                    icon = insert;
                }
            }
        }
    } else if (display instanceof DataTextArea) {
        if (((DataTextArea) display).getOverwriteMode()) {
            icon = overwrite;
        } else {
            icon = insert;
        }
    }
    insertModeLabel.setIcon(icon);
}
Also used : DataField(com.servoy.j2db.smart.dataui.DataField) DataTextArea(com.servoy.j2db.smart.dataui.DataTextArea) DefaultFormatter(javax.swing.text.DefaultFormatter) MaskFormatter(javax.swing.text.MaskFormatter) ImageIcon(javax.swing.ImageIcon) Icon(javax.swing.Icon) DefaultFormatterFactory(javax.swing.text.DefaultFormatterFactory) AbstractFormatterFactory(javax.swing.JFormattedTextField.AbstractFormatterFactory) AbstractFormatter(javax.swing.JFormattedTextField.AbstractFormatter)

Aggregations

DataField (com.servoy.j2db.smart.dataui.DataField)1 DataTextArea (com.servoy.j2db.smart.dataui.DataTextArea)1 Icon (javax.swing.Icon)1 ImageIcon (javax.swing.ImageIcon)1 AbstractFormatter (javax.swing.JFormattedTextField.AbstractFormatter)1 AbstractFormatterFactory (javax.swing.JFormattedTextField.AbstractFormatterFactory)1 DefaultFormatter (javax.swing.text.DefaultFormatter)1 DefaultFormatterFactory (javax.swing.text.DefaultFormatterFactory)1 MaskFormatter (javax.swing.text.MaskFormatter)1