private Section createSection(SceneNodeComponent component) { FormToolkit toolkit = GurellaStudioPlugin.getToolkit(); Section section = toolkit.createSection(componentsComposite, TWISTIE | SHORT_TITLE_BAR | NO_TITLE_FOCUS_BOX); section.setText(MetaTypes.getMetaType(component).getName()); section.setLayoutData(new GridData(FILL, FILL, true, false, 1, 1)); section.addExpansionListener(new ExpansionListener(component)); BeanEditor<SceneNodeComponent> editor = createEditor(section, editorContext, component); Signal1<PropertyValueChangedEvent> signal = editor.getContext().propertiesSignal; signal.addListener(e -> notifySceneChanged()); section.setClient(editor); section.setExpanded(getPreferences().getBoolean(component.ensureUuid(), true)); editors.put(component, section); return section; }
@Override public void componentIndexChanged(SceneNodeComponent component, int newIndex) { Section section = editors.get(component); if (section == null) { return; } ImmutableArray<SceneNodeComponent> components = component.getNode().components; int size = components.size(); if (size < 2) { return; } if (newIndex == 0) { Section nextSection = editors.get(components.get(1)); section.moveBelow(nextSection); } else { Section nextSection = editors.get(components.get(newIndex - 1)); section.moveAbove(nextSection); } }
@Override public void expansionStateChanged(ExpansionEvent e) { getPreferences().putBoolean(component.ensureUuid(), e.getState()); }