java.lang.Boolean Java Examples

The following examples show how to use java.lang.Boolean. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultCellEditor.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs a <code>DefaultCellEditor</code> object that uses a check box.
 *
 * @param checkBox  a <code>JCheckBox</code> object
 */
public DefaultCellEditor(final JCheckBox checkBox) {
    editorComponent = checkBox;
    delegate = new EditorDelegate() {
        public void setValue(Object value) {
            boolean selected = false;
            if (value instanceof Boolean) {
                selected = ((Boolean)value).booleanValue();
            }
            else if (value instanceof String) {
                selected = value.equals("true");
            }
            checkBox.setSelected(selected);
        }

        public Object getCellEditorValue() {
            return Boolean.valueOf(checkBox.isSelected());
        }
    };
    checkBox.addActionListener(delegate);
    checkBox.setRequestFocusEnabled(false);
}
 
Example #2
Source File: DefaultCellEditor.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a <code>DefaultCellEditor</code> object that uses a check box.
 *
 * @param checkBox  a <code>JCheckBox</code> object
 */
public DefaultCellEditor(final JCheckBox checkBox) {
    editorComponent = checkBox;
    delegate = new EditorDelegate() {
        public void setValue(Object value) {
            boolean selected = false;
            if (value instanceof Boolean) {
                selected = ((Boolean)value).booleanValue();
            }
            else if (value instanceof String) {
                selected = value.equals("true");
            }
            checkBox.setSelected(selected);
        }

        public Object getCellEditorValue() {
            return Boolean.valueOf(checkBox.isSelected());
        }
    };
    checkBox.addActionListener(delegate);
    checkBox.setRequestFocusEnabled(false);
}
 
Example #3
Source File: DefaultCellEditor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs a <code>DefaultCellEditor</code> object that uses a check box.
 *
 * @param checkBox  a <code>JCheckBox</code> object
 */
public DefaultCellEditor(final JCheckBox checkBox) {
    editorComponent = checkBox;
    delegate = new EditorDelegate() {
        public void setValue(Object value) {
            boolean selected = false;
            if (value instanceof Boolean) {
                selected = ((Boolean)value).booleanValue();
            }
            else if (value instanceof String) {
                selected = value.equals("true");
            }
            checkBox.setSelected(selected);
        }

        public Object getCellEditorValue() {
            return Boolean.valueOf(checkBox.isSelected());
        }
    };
    checkBox.addActionListener(delegate);
    checkBox.setRequestFocusEnabled(false);
}
 
Example #4
Source File: DefaultCellEditor.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs a <code>DefaultCellEditor</code> object that uses a check box.
 *
 * @param checkBox  a <code>JCheckBox</code> object
 */
public DefaultCellEditor(final JCheckBox checkBox) {
    editorComponent = checkBox;
    delegate = new EditorDelegate() {
        public void setValue(Object value) {
            boolean selected = false;
            if (value instanceof Boolean) {
                selected = ((Boolean)value).booleanValue();
            }
            else if (value instanceof String) {
                selected = value.equals("true");
            }
            checkBox.setSelected(selected);
        }

        public Object getCellEditorValue() {
            return Boolean.valueOf(checkBox.isSelected());
        }
    };
    checkBox.addActionListener(delegate);
    checkBox.setRequestFocusEnabled(false);
}
 
Example #5
Source File: DefaultCellEditor.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs a <code>DefaultCellEditor</code> object that uses a check box.
 *
 * @param checkBox  a <code>JCheckBox</code> object
 */
public DefaultCellEditor(final JCheckBox checkBox) {
    editorComponent = checkBox;
    delegate = new EditorDelegate() {
        public void setValue(Object value) {
            boolean selected = false;
            if (value instanceof Boolean) {
                selected = ((Boolean)value).booleanValue();
            }
            else if (value instanceof String) {
                selected = value.equals("true");
            }
            checkBox.setSelected(selected);
        }

        public Object getCellEditorValue() {
            return Boolean.valueOf(checkBox.isSelected());
        }
    };
    checkBox.addActionListener(delegate);
    checkBox.setRequestFocusEnabled(false);
}
 
Example #6
Source File: DefaultCellEditor.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a <code>DefaultCellEditor</code> object that uses a check box.
 *
 * @param checkBox  a <code>JCheckBox</code> object
 */
public DefaultCellEditor(final JCheckBox checkBox) {
    editorComponent = checkBox;
    delegate = new EditorDelegate() {
        public void setValue(Object value) {
            boolean selected = false;
            if (value instanceof Boolean) {
                selected = ((Boolean)value).booleanValue();
            }
            else if (value instanceof String) {
                selected = value.equals("true");
            }
            checkBox.setSelected(selected);
        }

        public Object getCellEditorValue() {
            return Boolean.valueOf(checkBox.isSelected());
        }
    };
    checkBox.addActionListener(delegate);
    checkBox.setRequestFocusEnabled(false);
}
 
Example #7
Source File: DefaultCellEditor.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs a <code>DefaultCellEditor</code> object that uses a check box.
 *
 * @param checkBox  a <code>JCheckBox</code> object
 */
public DefaultCellEditor(final JCheckBox checkBox) {
    editorComponent = checkBox;
    delegate = new EditorDelegate() {
        public void setValue(Object value) {
            boolean selected = false;
            if (value instanceof Boolean) {
                selected = ((Boolean)value).booleanValue();
            }
            else if (value instanceof String) {
                selected = value.equals("true");
            }
            checkBox.setSelected(selected);
        }

        public Object getCellEditorValue() {
            return Boolean.valueOf(checkBox.isSelected());
        }
    };
    checkBox.addActionListener(delegate);
    checkBox.setRequestFocusEnabled(false);
}
 
Example #8
Source File: BgReadingMessage.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
public BgReadingMessage(Long timestamp, Double time_since_sensor_started, Double raw_data, Double filtered_data, Double age_adjusted_raw_value, Boolean calibration_flag, Double calculated_value, Double filtered_calculated_value, Double calculated_value_slope, Double a, Double b, Double c, Double ra, Double rb, Double rc, String uuid, String calibration_uuid, String sensor_uuid, Boolean ignoreforstats, Double raw_calculated, Boolean hide_slope, String noise, ByteString unknownFields) {
  super(ADAPTER, unknownFields);
  this.timestamp = timestamp;
  this.time_since_sensor_started = time_since_sensor_started;
  this.raw_data = raw_data;
  this.filtered_data = filtered_data;
  this.age_adjusted_raw_value = age_adjusted_raw_value;
  this.calibration_flag = calibration_flag;
  this.calculated_value = calculated_value;
  this.filtered_calculated_value = filtered_calculated_value;
  this.calculated_value_slope = calculated_value_slope;
  this.a = a;
  this.b = b;
  this.c = c;
  this.ra = ra;
  this.rb = rb;
  this.rc = rc;
  this.uuid = uuid;
  this.calibration_uuid = calibration_uuid;
  this.sensor_uuid = sensor_uuid;
  this.ignoreforstats = ignoreforstats;
  this.raw_calculated = raw_calculated;
  this.hide_slope = hide_slope;
  this.noise = noise;
}
 
Example #9
Source File: DefaultCellEditor.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a <code>DefaultCellEditor</code> object that uses a check box.
 *
 * @param checkBox  a <code>JCheckBox</code> object
 */
public DefaultCellEditor(final JCheckBox checkBox) {
    editorComponent = checkBox;
    delegate = new EditorDelegate() {
        public void setValue(Object value) {
            boolean selected = false;
            if (value instanceof Boolean) {
                selected = ((Boolean)value).booleanValue();
            }
            else if (value instanceof String) {
                selected = value.equals("true");
            }
            checkBox.setSelected(selected);
        }

        public Object getCellEditorValue() {
            return Boolean.valueOf(checkBox.isSelected());
        }
    };
    checkBox.addActionListener(delegate);
    checkBox.setRequestFocusEnabled(false);
}
 
Example #10
Source File: BgReadingMessage.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
public BgReadingMessage(Long timestamp, Double time_since_sensor_started, Double raw_data, Double filtered_data, Double age_adjusted_raw_value, Boolean calibration_flag, Double calculated_value, Double filtered_calculated_value, Double calculated_value_slope, Double a, Double b, Double c, Double ra, Double rb, Double rc, String uuid, String calibration_uuid, String sensor_uuid, Boolean ignoreforstats, Double raw_calculated, Boolean hide_slope, String noise, ByteString unknownFields) {
  super(ADAPTER, unknownFields);
  this.timestamp = timestamp;
  this.time_since_sensor_started = time_since_sensor_started;
  this.raw_data = raw_data;
  this.filtered_data = filtered_data;
  this.age_adjusted_raw_value = age_adjusted_raw_value;
  this.calibration_flag = calibration_flag;
  this.calculated_value = calculated_value;
  this.filtered_calculated_value = filtered_calculated_value;
  this.calculated_value_slope = calculated_value_slope;
  this.a = a;
  this.b = b;
  this.c = c;
  this.ra = ra;
  this.rb = rb;
  this.rc = rc;
  this.uuid = uuid;
  this.calibration_uuid = calibration_uuid;
  this.sensor_uuid = sensor_uuid;
  this.ignoreforstats = ignoreforstats;
  this.raw_calculated = raw_calculated;
  this.hide_slope = hide_slope;
  this.noise = noise;
}
 
Example #11
Source File: BgReadingMessage.java    From xDrip-plus with GNU General Public License v3.0 6 votes vote down vote up
public BgReadingMessage(Long timestamp, Double time_since_sensor_started, Double raw_data, Double filtered_data, Double age_adjusted_raw_value, Boolean calibration_flag, Double calculated_value, Double filtered_calculated_value, Double calculated_value_slope, Double a, Double b, Double c, Double ra, Double rb, Double rc, String uuid, String calibration_uuid, String sensor_uuid, Boolean ignoreforstats, Double raw_calculated, Boolean hide_slope, String noise, ByteString unknownFields) {
  super(ADAPTER, unknownFields);
  this.timestamp = timestamp;
  this.time_since_sensor_started = time_since_sensor_started;
  this.raw_data = raw_data;
  this.filtered_data = filtered_data;
  this.age_adjusted_raw_value = age_adjusted_raw_value;
  this.calibration_flag = calibration_flag;
  this.calculated_value = calculated_value;
  this.filtered_calculated_value = filtered_calculated_value;
  this.calculated_value_slope = calculated_value_slope;
  this.a = a;
  this.b = b;
  this.c = c;
  this.ra = ra;
  this.rb = rb;
  this.rc = rc;
  this.uuid = uuid;
  this.calibration_uuid = calibration_uuid;
  this.sensor_uuid = sensor_uuid;
  this.ignoreforstats = ignoreforstats;
  this.raw_calculated = raw_calculated;
  this.hide_slope = hide_slope;
  this.noise = noise;
}
 
Example #12
Source File: BgReadingMessage.java    From xDrip-plus with GNU General Public License v3.0 6 votes vote down vote up
public BgReadingMessage(Long timestamp, Double time_since_sensor_started, Double raw_data, Double filtered_data, Double age_adjusted_raw_value, Boolean calibration_flag, Double calculated_value, Double filtered_calculated_value, Double calculated_value_slope, Double a, Double b, Double c, Double ra, Double rb, Double rc, String uuid, String calibration_uuid, String sensor_uuid, Boolean ignoreforstats, Double raw_calculated, Boolean hide_slope, String noise, ByteString unknownFields) {
  super(ADAPTER, unknownFields);
  this.timestamp = timestamp;
  this.time_since_sensor_started = time_since_sensor_started;
  this.raw_data = raw_data;
  this.filtered_data = filtered_data;
  this.age_adjusted_raw_value = age_adjusted_raw_value;
  this.calibration_flag = calibration_flag;
  this.calculated_value = calculated_value;
  this.filtered_calculated_value = filtered_calculated_value;
  this.calculated_value_slope = calculated_value_slope;
  this.a = a;
  this.b = b;
  this.c = c;
  this.ra = ra;
  this.rb = rb;
  this.rc = rc;
  this.uuid = uuid;
  this.calibration_uuid = calibration_uuid;
  this.sensor_uuid = sensor_uuid;
  this.ignoreforstats = ignoreforstats;
  this.raw_calculated = raw_calculated;
  this.hide_slope = hide_slope;
  this.noise = noise;
}
 
Example #13
Source File: DefaultCellEditor.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs a <code>DefaultCellEditor</code> object that uses a check box.
 *
 * @param checkBox  a <code>JCheckBox</code> object
 */
public DefaultCellEditor(final JCheckBox checkBox) {
    editorComponent = checkBox;
    delegate = new EditorDelegate() {
        public void setValue(Object value) {
            boolean selected = false;
            if (value instanceof Boolean) {
                selected = ((Boolean)value).booleanValue();
            }
            else if (value instanceof String) {
                selected = value.equals("true");
            }
            checkBox.setSelected(selected);
        }

        public Object getCellEditorValue() {
            return Boolean.valueOf(checkBox.isSelected());
        }
    };
    checkBox.addActionListener(delegate);
    checkBox.setRequestFocusEnabled(false);
}
 
Example #14
Source File: DefaultCellEditor.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs a <code>DefaultCellEditor</code> object that uses a check box.
 *
 * @param checkBox  a <code>JCheckBox</code> object
 */
public DefaultCellEditor(final JCheckBox checkBox) {
    editorComponent = checkBox;
    delegate = new EditorDelegate() {
        public void setValue(Object value) {
            boolean selected = false;
            if (value instanceof Boolean) {
                selected = ((Boolean)value).booleanValue();
            }
            else if (value instanceof String) {
                selected = value.equals("true");
            }
            checkBox.setSelected(selected);
        }

        public Object getCellEditorValue() {
            return Boolean.valueOf(checkBox.isSelected());
        }
    };
    checkBox.addActionListener(delegate);
    checkBox.setRequestFocusEnabled(false);
}
 
Example #15
Source File: DefaultCellEditor.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs a <code>DefaultCellEditor</code> object that uses a check box.
 *
 * @param checkBox  a <code>JCheckBox</code> object
 */
public DefaultCellEditor(final JCheckBox checkBox) {
    editorComponent = checkBox;
    delegate = new EditorDelegate() {
        public void setValue(Object value) {
            boolean selected = false;
            if (value instanceof Boolean) {
                selected = ((Boolean)value).booleanValue();
            }
            else if (value instanceof String) {
                selected = value.equals("true");
            }
            checkBox.setSelected(selected);
        }

        public Object getCellEditorValue() {
            return Boolean.valueOf(checkBox.isSelected());
        }
    };
    checkBox.addActionListener(delegate);
    checkBox.setRequestFocusEnabled(false);
}
 
Example #16
Source File: DefaultCellEditor.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs a <code>DefaultCellEditor</code> object that uses a check box.
 *
 * @param checkBox  a <code>JCheckBox</code> object
 */
public DefaultCellEditor(final JCheckBox checkBox) {
    editorComponent = checkBox;
    delegate = new EditorDelegate() {
        public void setValue(Object value) {
            boolean selected = false;
            if (value instanceof Boolean) {
                selected = ((Boolean)value).booleanValue();
            }
            else if (value instanceof String) {
                selected = value.equals("true");
            }
            checkBox.setSelected(selected);
        }

        public Object getCellEditorValue() {
            return Boolean.valueOf(checkBox.isSelected());
        }
    };
    checkBox.addActionListener(delegate);
    checkBox.setRequestFocusEnabled(false);
}
 
Example #17
Source File: DefaultCellEditor.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a <code>DefaultCellEditor</code> object that uses a
 * combo box.
 *
 * @param comboBox  a <code>JComboBox</code> object
 */
public DefaultCellEditor(final JComboBox comboBox) {
    editorComponent = comboBox;
    comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    delegate = new EditorDelegate() {
        public void setValue(Object value) {
            comboBox.setSelectedItem(value);
        }

        public Object getCellEditorValue() {
            return comboBox.getSelectedItem();
        }

        public boolean shouldSelectCell(EventObject anEvent) {
            if (anEvent instanceof MouseEvent) {
                MouseEvent e = (MouseEvent)anEvent;
                return e.getID() != MouseEvent.MOUSE_DRAGGED;
            }
            return true;
        }
        public boolean stopCellEditing() {
            if (comboBox.isEditable()) {
                // Commit edited value.
                comboBox.actionPerformed(new ActionEvent(
                                 DefaultCellEditor.this, 0, ""));
            }
            return super.stopCellEditing();
        }
    };
    comboBox.addActionListener(delegate);
}
 
Example #18
Source File: PropertyListWriter.java    From JarBundler with Apache License 2.0 5 votes vote down vote up
private void writeKeyBooleanPair(String key, Boolean b, Node appendTo)
{

    if (b == null)
    {
        return;
    }

    writeKey(key, appendTo);
    writeBoolean(b, appendTo);
}
 
Example #19
Source File: DefaultCellEditor.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a <code>DefaultCellEditor</code> object that uses a
 * combo box.
 *
 * @param comboBox  a <code>JComboBox</code> object
 */
public DefaultCellEditor(final JComboBox comboBox) {
    editorComponent = comboBox;
    comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    delegate = new EditorDelegate() {
        public void setValue(Object value) {
            comboBox.setSelectedItem(value);
        }

        public Object getCellEditorValue() {
            return comboBox.getSelectedItem();
        }

        public boolean shouldSelectCell(EventObject anEvent) {
            if (anEvent instanceof MouseEvent) {
                MouseEvent e = (MouseEvent)anEvent;
                return e.getID() != MouseEvent.MOUSE_DRAGGED;
            }
            return true;
        }
        public boolean stopCellEditing() {
            if (comboBox.isEditable()) {
                // Commit edited value.
                comboBox.actionPerformed(new ActionEvent(
                                 DefaultCellEditor.this, 0, ""));
            }
            return super.stopCellEditing();
        }
    };
    comboBox.addActionListener(delegate);
}
 
Example #20
Source File: WildcardRefBuilder.java    From sundrio with Apache License 2.0 5 votes vote down vote up
public WildcardRefBuilder(WildcardRef instance,Boolean validationEnabled){
        this.fluent = this; 
        this.withBoundKind(instance.getBoundKind()); 
        this.withBounds(instance.getBounds()); 
        this.withAttributes(instance.getAttributes()); 
        this.validationEnabled = validationEnabled; 
}
 
Example #21
Source File: BoxedTypesMethodsFactoryMethodStorIOSQLiteGetResolver.java    From storio with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
@NonNull
public BoxedTypesMethodsFactoryMethod mapFromCursor(@NonNull StorIOSQLite storIOSQLite, @NonNull Cursor cursor) {

    Boolean field1 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field1"))) {
        field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1;
    }
    Short field2 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field2"))) {
        field2 = cursor.getShort(cursor.getColumnIndex("field2"));
    }
    Integer field3 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field3"))) {
        field3 = cursor.getInt(cursor.getColumnIndex("field3"));
    }
    Long field4 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field4"))) {
        field4 = cursor.getLong(cursor.getColumnIndex("field4"));
    }
    Float field5 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field5"))) {
        field5 = cursor.getFloat(cursor.getColumnIndex("field5"));
    }
    Double field6 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field6"))) {
        field6 = cursor.getDouble(cursor.getColumnIndex("field6"));
    }

    BoxedTypesMethodsFactoryMethod object = BoxedTypesMethodsFactoryMethod.create(field1, field2, field3, field4, field5, field6);

    return object;
}
 
Example #22
Source File: GeneratedDatabaseHolder.java    From WeatherStream with Apache License 2.0 5 votes vote down vote up
public GeneratedDatabaseHolder() {
  typeConverters.put(Boolean.class, new BooleanConverter());
  typeConverters.put(Character.class, new CharConverter());
  typeConverters.put(BigDecimal.class, new BigDecimalConverter());
  typeConverters.put(BigInteger.class, new BigIntegerConverter());
  typeConverters.put(Date.class, new SqlDateConverter());
  typeConverters.put(Time.class, new SqlDateConverter());
  typeConverters.put(Timestamp.class, new SqlDateConverter());
  typeConverters.put(Calendar.class, new CalendarConverter());
  typeConverters.put(GregorianCalendar.class, new CalendarConverter());
  typeConverters.put(java.util.Date.class, new DateConverter());
  typeConverters.put(UUID.class, new UUIDConverter());
  new WeatherStreamDBWeatherStreamDB_Database(this);
}
 
Example #23
Source File: DefaultCellEditor.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a <code>DefaultCellEditor</code> object that uses a
 * combo box.
 *
 * @param comboBox  a <code>JComboBox</code> object
 */
public DefaultCellEditor(final JComboBox comboBox) {
    editorComponent = comboBox;
    comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    delegate = new EditorDelegate() {
        public void setValue(Object value) {
            comboBox.setSelectedItem(value);
        }

        public Object getCellEditorValue() {
            return comboBox.getSelectedItem();
        }

        public boolean shouldSelectCell(EventObject anEvent) {
            if (anEvent instanceof MouseEvent) {
                MouseEvent e = (MouseEvent)anEvent;
                return e.getID() != MouseEvent.MOUSE_DRAGGED;
            }
            return true;
        }
        public boolean stopCellEditing() {
            if (comboBox.isEditable()) {
                // Commit edited value.
                comboBox.actionPerformed(new ActionEvent(
                                 DefaultCellEditor.this, 0, ""));
            }
            return super.stopCellEditing();
        }
    };
    comboBox.addActionListener(delegate);
}
 
Example #24
Source File: DefaultCellEditor.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a <code>DefaultCellEditor</code> object that uses a
 * combo box.
 *
 * @param comboBox  a <code>JComboBox</code> object
 */
public DefaultCellEditor(final JComboBox comboBox) {
    editorComponent = comboBox;
    comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    delegate = new EditorDelegate() {
        public void setValue(Object value) {
            comboBox.setSelectedItem(value);
        }

        public Object getCellEditorValue() {
            return comboBox.getSelectedItem();
        }

        public boolean shouldSelectCell(EventObject anEvent) {
            if (anEvent instanceof MouseEvent) {
                MouseEvent e = (MouseEvent)anEvent;
                return e.getID() != MouseEvent.MOUSE_DRAGGED;
            }
            return true;
        }
        public boolean stopCellEditing() {
            if (comboBox.isEditable()) {
                // Commit edited value.
                comboBox.actionPerformed(new ActionEvent(
                                 DefaultCellEditor.this, 0, ""));
            }
            return super.stopCellEditing();
        }
    };
    comboBox.addActionListener(delegate);
}
 
Example #25
Source File: DefaultCellEditor.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a <code>DefaultCellEditor</code> object that uses a
 * combo box.
 *
 * @param comboBox  a <code>JComboBox</code> object
 */
public DefaultCellEditor(final JComboBox<?> comboBox) {
    editorComponent = comboBox;
    comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    delegate = new EditorDelegate() {
        public void setValue(Object value) {
            comboBox.setSelectedItem(value);
        }

        public Object getCellEditorValue() {
            return comboBox.getSelectedItem();
        }

        public boolean shouldSelectCell(EventObject anEvent) {
            if (anEvent instanceof MouseEvent) {
                MouseEvent e = (MouseEvent)anEvent;
                return e.getID() != MouseEvent.MOUSE_DRAGGED;
            }
            return true;
        }
        public boolean stopCellEditing() {
            if (comboBox.isEditable()) {
                // Commit edited value.
                comboBox.actionPerformed(new ActionEvent(
                                 DefaultCellEditor.this, 0, ""));
            }
            return super.stopCellEditing();
        }
    };
    comboBox.addActionListener(delegate);
}
 
Example #26
Source File: BoxedTypesMethodsConstructorIgnoreNullStorIOSQLiteGetResolver.java    From storio with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
@NonNull
public BoxedTypesMethodsConstructorIgnoreNull mapFromCursor(@NonNull StorIOSQLite storIOSQLite, @NonNull Cursor cursor) {

    Boolean field1 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field1"))) {
        field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1;
    }
    Short field2 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field2"))) {
        field2 = cursor.getShort(cursor.getColumnIndex("field2"));
    }
    Integer field3 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field3"))) {
        field3 = cursor.getInt(cursor.getColumnIndex("field3"));
    }
    Long field4 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field4"))) {
        field4 = cursor.getLong(cursor.getColumnIndex("field4"));
    }
    Float field5 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field5"))) {
        field5 = cursor.getFloat(cursor.getColumnIndex("field5"));
    }
    Double field6 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field6"))) {
        field6 = cursor.getDouble(cursor.getColumnIndex("field6"));
    }

    BoxedTypesMethodsConstructorIgnoreNull object = new BoxedTypesMethodsConstructorIgnoreNull(field1, field2, field3, field4, field5, field6);

    return object;
}
 
Example #27
Source File: BoxedTypesPrivateFieldsIgnoreNullStorIOContentResolverGetResolver.java    From storio with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
@NonNull
public BoxedTypesPrivateFieldsIgnoreNull mapFromCursor(@NonNull StorIOContentResolver storIOContentResolver, @NonNull Cursor cursor) {

    Boolean field1 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field1"))) {
        field1 = cursor.getInt(cursor.getColumnIndex("field1")) == 1;
    }
    Short field2 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field2"))) {
        field2 = cursor.getShort(cursor.getColumnIndex("field2"));
    }
    Integer field3 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field3"))) {
        field3 = cursor.getInt(cursor.getColumnIndex("field3"));
    }
    Long field4 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field4"))) {
        field4 = cursor.getLong(cursor.getColumnIndex("field4"));
    }
    Float field5 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field5"))) {
        field5 = cursor.getFloat(cursor.getColumnIndex("field5"));
    }
    Double field6 = null;
    if (!cursor.isNull(cursor.getColumnIndex("field6"))) {
        field6 = cursor.getDouble(cursor.getColumnIndex("field6"));
    }

    BoxedTypesPrivateFieldsIgnoreNull object = new BoxedTypesPrivateFieldsIgnoreNull(field1, field2, field3, field4, field5, field6);

    return object;
}
 
Example #28
Source File: ReviewInput.java    From apollo-android with MIT License 5 votes vote down vote up
ReviewInput(int stars, Input<Integer> nullableIntFieldWithDefaultValue, Input<String> commentary,
    @NotNull ColorInput favoriteColor, Input<Episode> enumWithDefaultValue,
    @NotNull Episode nonNullableEnumWithDefaultValue, Input<Episode> nullableEnum,
    Input<List<Date>> listOfCustomScalar, Input<Date> customScalar,
    Input<List<Episode>> listOfEnums, Input<List<Integer>> listOfInt,
    Input<List<String>> listOfString, @NotNull List<String> listOfStringNonOptional,
    Input<List<ColorInput>> listOfInputTypes, Input<Boolean> booleanWithDefaultValue,
    Input<List<List<String>>> listOfListOfString, Input<List<List<Episode>>> listOfListOfEnum,
    Input<List<List<Date>>> listOfListOfCustom, Input<List<List<ColorInput>>> listOfListOfObject,
    Input<String> capitalizedField) {
  this.stars = stars;
  this.nullableIntFieldWithDefaultValue = nullableIntFieldWithDefaultValue;
  this.commentary = commentary;
  this.favoriteColor = favoriteColor;
  this.enumWithDefaultValue = enumWithDefaultValue;
  this.nonNullableEnumWithDefaultValue = nonNullableEnumWithDefaultValue;
  this.nullableEnum = nullableEnum;
  this.listOfCustomScalar = listOfCustomScalar;
  this.customScalar = customScalar;
  this.listOfEnums = listOfEnums;
  this.listOfInt = listOfInt;
  this.listOfString = listOfString;
  this.listOfStringNonOptional = listOfStringNonOptional;
  this.listOfInputTypes = listOfInputTypes;
  this.booleanWithDefaultValue = booleanWithDefaultValue;
  this.listOfListOfString = listOfListOfString;
  this.listOfListOfEnum = listOfListOfEnum;
  this.listOfListOfCustom = listOfListOfCustom;
  this.listOfListOfObject = listOfListOfObject;
  this.capitalizedField = capitalizedField;
}
 
Example #29
Source File: DefaultCellEditor.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a <code>DefaultCellEditor</code> object that uses a
 * combo box.
 *
 * @param comboBox  a <code>JComboBox</code> object
 */
public DefaultCellEditor(final JComboBox comboBox) {
    editorComponent = comboBox;
    comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    delegate = new EditorDelegate() {
        public void setValue(Object value) {
            comboBox.setSelectedItem(value);
        }

        public Object getCellEditorValue() {
            return comboBox.getSelectedItem();
        }

        public boolean shouldSelectCell(EventObject anEvent) {
            if (anEvent instanceof MouseEvent) {
                MouseEvent e = (MouseEvent)anEvent;
                return e.getID() != MouseEvent.MOUSE_DRAGGED;
            }
            return true;
        }
        public boolean stopCellEditing() {
            if (comboBox.isEditable()) {
                // Commit edited value.
                comboBox.actionPerformed(new ActionEvent(
                                 DefaultCellEditor.this, 0, ""));
            }
            return super.stopCellEditing();
        }
    };
    comboBox.addActionListener(delegate);
}
 
Example #30
Source File: ReviewInput.java    From apollo-android with MIT License 5 votes vote down vote up
ReviewInput(int stars, Input<Integer> nullableIntFieldWithDefaultValue, Input<String> commentary,
    @NotNull ColorInput favoriteColor, Input<Episode> enumWithDefaultValue,
    @NotNull Episode nonNullableEnumWithDefaultValue, Input<Episode> nullableEnum,
    Input<List<Date>> listOfCustomScalar, Input<Date> customScalar,
    Input<List<Episode>> listOfEnums, Input<List<Integer>> listOfInt,
    Input<List<String>> listOfString, @NotNull List<String> listOfStringNonOptional,
    Input<List<ColorInput>> listOfInputTypes, Input<Boolean> booleanWithDefaultValue,
    Input<List<List<String>>> listOfListOfString, Input<List<List<Episode>>> listOfListOfEnum,
    Input<List<List<Date>>> listOfListOfCustom, Input<List<List<ColorInput>>> listOfListOfObject,
    Input<String> capitalizedField) {
  this.stars = stars;
  this.nullableIntFieldWithDefaultValue = nullableIntFieldWithDefaultValue;
  this.commentary = commentary;
  this.favoriteColor = favoriteColor;
  this.enumWithDefaultValue = enumWithDefaultValue;
  this.nonNullableEnumWithDefaultValue = nonNullableEnumWithDefaultValue;
  this.nullableEnum = nullableEnum;
  this.listOfCustomScalar = listOfCustomScalar;
  this.customScalar = customScalar;
  this.listOfEnums = listOfEnums;
  this.listOfInt = listOfInt;
  this.listOfString = listOfString;
  this.listOfStringNonOptional = listOfStringNonOptional;
  this.listOfInputTypes = listOfInputTypes;
  this.booleanWithDefaultValue = booleanWithDefaultValue;
  this.listOfListOfString = listOfListOfString;
  this.listOfListOfEnum = listOfListOfEnum;
  this.listOfListOfCustom = listOfListOfCustom;
  this.listOfListOfObject = listOfListOfObject;
  this.capitalizedField = capitalizedField;
}