@Override public void update(final ModelEvent event) { if (event.part == ModelPart.SELECTED_ATTRIBUTE) { for (final CTabItem item : folder.getItems()) { if (item.getText().equals(event.data)) { folder.setSelection(item); break; } } } else if (event.part == ModelPart.MODEL) { model = (Model) event.data; } else if (event.part == ModelPart.INPUT) { reset(); folder.setRedraw(false); for (int i = 0; i < model.getInputConfig().getInput().getHandle().getNumColumns(); i++) { final String col = model.getInputConfig().getInput().getHandle().getAttributeName(i); final IView l = new ViewAttributeDefinition(folder, col, controller); l.update(new ModelEvent(this, ModelPart.MODEL, model)); l.update(new ModelEvent(this, ModelPart.INPUT, event.data)); names.put(i, col); views.add(l); } folder.setRedraw(true); folder.redraw(); } }
@Override public void dispose() { controller.removeListener(this); for (IView view : views) { view.dispose(); } }
@Override public void reset() { folder.setRedraw(false); for (final CTabItem tab : folder.getItems()) { tab.dispose(); } // TODO: Is this enough cleanup? for (final IView v : views) { v.dispose(); } names.clear(); views.clear(); folder.setRedraw(true); folder.redraw(); }