下面列出了怎么用java.lang.Boolean的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
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;
}
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;
}
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;
}
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;
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* {@inheritDoc}
*/
@Override
@NonNull
public BoxedTypesMethodsConstructor 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"));
}
BoxedTypesMethodsConstructor object = new BoxedTypesMethodsConstructor(field1, field2, field3, field4, field5, field6);
return object;
}
/**
* 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);
}
public WildcardRefBuilder(WildcardRef instance,Boolean validationEnabled){
this.fluent = this;
this.withBoundKind(instance.getBoundKind());
this.withBounds(instance.getBounds());
this.withAttributes(instance.getAttributes());
this.validationEnabled = validationEnabled;
}
/**
* {@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;
}
/**
* 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);
}
/**
* {@inheritDoc}
*/
@Override
@NonNull
public BoxedTypesMethodsFactoryMethodIgnoreNull 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"));
}
BoxedTypesMethodsFactoryMethodIgnoreNull object = BoxedTypesMethodsFactoryMethodIgnoreNull.create(field1, field2, field3, field4, field5, field6);
return object;
}
/** General setter */
private void setProperty(String property, Object value) {
if (property.equals(AnnotationTypes.PROP_BACKGROUND_DRAWING))
AnnotationTypes.getTypes().setBackgroundDrawing((Boolean)value);
if (property.equals(AnnotationTypes.PROP_BACKGROUND_GLYPH_ALPHA))
AnnotationTypes.getTypes().setBackgroundGlyphAlpha(((Integer)value).intValue());
if (property.equals(AnnotationTypes.PROP_COMBINE_GLYPHS))
AnnotationTypes.getTypes().setCombineGlyphs((Boolean)value);
if (property.equals(AnnotationTypes.PROP_GLYPHS_OVER_LINE_NUMBERS))
AnnotationTypes.getTypes().setGlyphsOverLineNumbers((Boolean)value);
if (property.equals(AnnotationTypes.PROP_SHOW_GLYPH_GUTTER))
AnnotationTypes.getTypes().setShowGlyphGutter((Boolean)value);
}
/**
* {@inheritDoc}
*/
@Override
@NonNull
public BoxedTypesMethodsFactoryMethod 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"));
}
BoxedTypesMethodsFactoryMethod object = BoxedTypesMethodsFactoryMethod.create(field1, field2, field3, field4, field5, field6);
return object;
}
@SuppressWarnings("unchecked")
void parseConfig(Map<?, ?> conf) {
if (conf.containsKey(Config.TOPOLOGY_NAME)) {
topologyName = (String) conf.get(Config.TOPOLOGY_NAME);
}
if (conf.containsKey(STATSD_HOST)) {
statsdHost = (String) conf.get(STATSD_HOST);
}
if (conf.containsKey(STATSD_PORT)) {
statsdPort = ((Number) conf.get(STATSD_PORT)).intValue();
}
if (conf.containsKey(STATSD_DIMENSIONS)) {
statsdDimensions = mapToJsonStr((Map<String, String>) conf
.get(STATSD_DIMENSIONS));
if (!isValidJSON(statsdDimensions)) {
logger.error("Ignoring dimensions element invalid JSON ({})",
new Object[] { statsdDimensions });
// You get default dimensions
statsdDimensions = monascaStatsdDimPrefix + defaultDimensions;
}
else {
statsdDimensions = monascaStatsdDimPrefix + statsdDimensions;
}
}
if (conf.containsKey(STATSD_WHITELIST)) {
whiteList = (List<String>) conf.get(STATSD_WHITELIST);
}
if (conf.containsKey(STATSD_METRICMAP)) {
metricMap = (Map<String, String>) conf.get(STATSD_METRICMAP);
}
if (conf.containsKey(STATSD_DEBUGMETRICS)) {
debugMetrics = (Boolean) conf.get(STATSD_DEBUGMETRICS);
}
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}