use of edu.cmu.cs.hcii.cogtool.CogToolPref in project cogtool by cogtool.
the class ProjectUIModel method installTreeColumn.
protected void installTreeColumn(final TreeColumn designColumn, Design design) {
designColumn.addListener(SWT.Dispose, onDisposeColumn);
designColumn.setText(design.getName());
designColumn.setResizable(true);
designColumn.setWidth(CogToolPref.KLM_RESULT_RANGE.getBoolean() ? COL_WIDTH_WITH_RANGE : COL_WIDTH_NO_RANGE);
designColumn.setMoveable(true);
designColumn.addListener(SWT.Move, onColumnReorder);
CogToolPref.ALERTER.addHandler(this, CogToolPref.PreferencesChange.class, new AlertHandler() {
public void handleAlert(EventObject evt) {
if (evt == null) {
return;
}
Set<CogToolPref> changed = ((CogToolPref.PreferencesChange) evt).getPrefs();
if (changed.contains(CogToolPref.KLM_RESULT_RANGE)) {
if (CogToolPref.KLM_RESULT_RANGE.getBoolean()) {
if (designColumn.getWidth() < COL_WIDTH_WITH_RANGE) {
designColumn.setWidth(COL_WIDTH_WITH_RANGE);
}
} else {
if (designColumn.getWidth() > COL_WIDTH_NO_RANGE) {
designColumn.setWidth(COL_WIDTH_NO_RANGE);
}
}
redisplayAllResults();
} else if (changed.contains(CogToolPref.DISPLAY_DIGITS)) {
redisplayAllResults();
}
}
});
AlertHandler handler = new AlertHandler() {
public void handleAlert(EventObject alert) {
Design design = (Design) designColumn.getData();
designColumn.setText(design.getName());
designColumn.setToolTipText(design.getName() + "\n" + selectDesignHelp + "\n" + editDesignHelp);
}
};
designColumn.setData(design);
designColumn.setToolTipText(design.getName() + "\n" + selectDesignHelp + "\n" + editDesignHelp);
design.addHandler(this, NameChangeAlert.class, handler);
design.addHandler(this, Demonstration.StatusChange.class, updateStateHandler);
// Update data cells when a change happens
design.addHandler(this, TaskApplication.TaskApplicationResultChange.class, taskApplicationResultHandler);
if (columnHook != null) {
columnHook.onColumnCreation(designColumn);
}
}
Aggregations