Difference: DpHipePreferences (35 vs. 36)

Revision 362014-03-05 - JaimeSaiz

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"
<-- ANALYTICS CODE - DO NOT EDIT -->
<-- Google Analytics script BEGIN -->
<-- Google Analytics script END -->
Line: 163 to 163
  Each preference is handled by a PreferenceHandler, which provides the means of updating the GUI with the existing preference value and to get any change that the user introduces, and more.
Changed:
<
<
You may consider to extend AbstractPreferenceHandler instead of implementing the interface directly.
>
>
You may consider to extend AbstractPreferenceHandler or use one of its basic extensions, instead of implementing the interface directly.
 

  • makeContent:
Line: 181 to 181
  private static final long serialVersionUID = 1L;
Changed:
<
<
private JTextField _fieldA; // text field associated to preference keyA private JIntegerField _fieldB; // text field associated to preference keyB
>
>
private JTextField fieldA; // text field associated to preference keyA private IntegerField fieldB; // text field associated to preference keyB
  @Override protected void registerHandlers() {

// Preference keyA with type String and default value "text"

Changed:
<
<
registerHandler("keyA", new AbstractPreferenceHandler<String>("text") { public String getValue() { return _fieldA.getText(); } public void setValue(String value) { _fieldA.setText(value); } });
>
>
registerHandler("keyA", new StringPreferenceHandler("text", fieldA));
  // Preference keyB with type Integer and default value 3
Changed:
<
<
registerHandler("keyB", new AbstractPreferenceHandler<Integer>(3) { public Integer getValue() { return _fieldB.getValue(); } public void setValue(Integer value) { _fieldB.setValue(value); } });
>
>
registerHandler("keyB", new IntegerPreferenceHandler(3, fieldB));
  }

@Override protected void makeContent() { setLayout(new GridLayout(2, 2, 5, 5)); // just for the example; you may consider to use a better layout

Changed:
<
<
_fieldA = new JTextField();
>
>
fieldA = new JTextField();
  add(new JLabel("Key A:"));
Changed:
<
<
add(_fieldA); _fieldB = new JIntegerField();
>
>
add(fieldA); fieldB = new IntegerField();
  add(new JLabel("Key B:"));
Changed:
<
<
add(_fieldB);
>
>
add(fieldB);
  } }
Line: 366 to 360
 
String def = Configuration.getProperty("hcss.some.property", "text"); // default value

Changed:
<
<
registerHandler("keyA", new AbstractPreferenceHandler<String>(def) { public String getValue() { return _fieldA.getText(); } public void setValue(String value) { _fieldA.setText(value); } });
>
>
registerHandler("keyA", new StringPreferenceHandler(def, fieldA));
 
Line: 387 to 378
 

Changed:
<
<
registerHandler("keyA", new AbstractPreferenceHandler<String>("text", "hcss.some.property") { public String getValue() { return _fieldA.getText(); } public void setValue(String value) { _fieldA.setText(value); } });
>
>
registerHandler("keyA", new StringPreferenceHandler("text", fieldA, "hcss.some.property"));
 
 
This site is powered by the TWiki collaboration platform Powered by Perl