public NodeInspectableContainer(InspectorView parent, SceneNode target) { super(parent, target); int editorId = editorContext.editorId; addDisposeListener(e -> EventService.unsubscribe(editorId, this)); EventService.subscribe(editorId, this); addDisposeListener(e -> Workbench.deactivate(this)); Workbench.activate(this); FormToolkit toolkit = GurellaStudioPlugin.getToolkit(); toolkit.adapt(this); Composite body = getBody(); GridLayoutFactory.fillDefaults().numColumns(4).extendedMargins(0, 10, 4, 0).applyTo(body); Label nameLabel = toolkit.createLabel(body, " Name: "); nameLabel.setLayoutData(new GridData(BEGINNING, CENTER, false, false)); nameText = UiUtils.createText(body); nameText.setText(target.getName()); nameText.setLayoutData(new GridData(FILL, BEGINNING, true, false)); nameChangedlLstener = e -> nodeNameChanged(); nameText.addListener(SWT.Modify, nameChangedlLstener); enabledCheck = toolkit.createButton(body, "Enabled", CHECK); enabledCheck.setLayoutData(new GridData(END, CENTER, false, false)); enabledCheck.setSelection(target.isEnabled()); nodeEnabledListener = e -> nodeEnabledChanged(); enabledCheck.addListener(SWT.Selection, nodeEnabledListener); menuButton = toolkit.createLabel(body, " ", NONE); menuButton.setImage(GurellaStudioPlugin.createImage("icons/menu.png")); menuButton.setLayoutData(new GridData(END, CENTER, false, false)); menuButton.addListener(SWT.MouseUp, e -> showMenu()); componentsComposite = toolkit.createComposite(body); GridLayout componentsLayout = new GridLayout(1, false); componentsLayout.marginHeight = 0; componentsLayout.marginWidth = 0; componentsComposite.setLayout(componentsLayout); componentsComposite.setLayoutData(new GridData(FILL, FILL, true, true, 4, 1)); UiUtils.paintBordersFor(body); initComponentContainers(); layout(true, true); }
@Override public void shutdown() { Application app = Gdx.app; if (instances.get(app) == this) { instances.remove(app); listenerTexture.dispose(); speakerTexture.dispose(); EventService.unsubscribe(this); } }
private AudioDebugRenderer() { listenerTexture = new Texture(Gdx.files.classpath(listenerTextureLocation)); listenerTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); listenerSprite = new Sprite(listenerTexture); listenerSprite.setSize(0.2f, 0.2f); listenerSprite.setOriginCenter(); speakerTexture = new Texture(Gdx.files.classpath(speakerTextureLocation)); speakerTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); speakerSprite = new Sprite(speakerTexture); speakerSprite.setSize(0.2f, 0.2f); speakerSprite.setOriginCenter(); EventService.subscribe(this); }
void post(int keycode) { this.keycode = keycode; EventService.post(scene.getInstanceId(), this); }
@Override protected void detach() { EventService.unsubscribe(owner.getScene().getInstanceId(), this); }
private void notifySceneChanged() { EventService.post(editorContext.editorId, SceneChangedEvent.instance); }