use of edu.cmu.cs.hcii.cogtool.model.FrameElement in project cogtool by cogtool.
the class FrameEditorUI method updateView.
/**
* Update the visual contents based on the selected widgets.
*/
public void updateView() {
int selectionCount = selection.getElementSelectionCount();
// text boxes and pull downs with values.
if (selectionCount == 1) {
// preserve selected state if a whole text field is selected
Text text = WindowUtil.getFocusedText();
boolean restoreSel = false;
if ((text != null) && (text.getSelectionCount() == text.getCharCount())) {
restoreSel = true;
}
// get the selected item
Iterator<FrameElement> iter = selection.getSelectedElementsIterator();
// For each selected object, which there is only one.
FrameElement elt = iter.next();
if (elt instanceof IWidget) {
IWidget widget = (IWidget) elt;
view.useParameters(FrameEditorView.USE_SINGLE_SELECT);
view.updateWidgetProperties(widget);
} else if (elt instanceof FrameElementGroup) {
FrameElementGroup eltGroup = (FrameElementGroup) elt;
view.useParameters(FrameEditorView.USE_GROUP_SELECT);
view.updateEltGroupProperties(eltGroup);
}
// Restore the selection state
if (restoreSel) {
text.selectAll();
}
} else if (selectionCount > 1) {
// TODO: on multi selection, some values are left enabled
// We need to set these to something or disable them.
view.useParameters(FrameEditorView.USE_MULTI_SELECT);
} else {
view.useParameters(FrameEditorView.USE_NONE);
view.updateFrameProperties(frame, false);
}
}
Aggregations