public <T extends SceneNodeComponent> void removeComponent(Class<T> componentType) { int typeId = ComponentType.findType(componentType); SceneNodeComponent component = _components.get(ComponentType.findBaseType(typeId)); if (component != null && isSubtype(typeId, component.componentType)) { component.destroy(); } }
public <T extends SceneNodeComponent> boolean hasComponent( Class<T> type, boolean includeInactive) { int typeId = ComponentType.findType(type); SceneNodeComponent value = _components.get(ComponentType.findBaseType(typeId)); return value != null && (includeInactive || value.isActive()) && isSubtype(typeId, value.componentType); }
public <T extends SceneNodeComponent> T getComponent(int typeId, boolean includeInactive) { SceneNodeComponent value = _components.get(ComponentType.findBaseType(typeId)); return value != null && (includeInactive || value.isActive()) && isSubtype(typeId, value.componentType) ? Values.<T>cast(value) : null; }
private void addMenuItem(Menu menu, final Class<? extends SceneNodeComponent> componentType) { MenuItem item = new MenuItem(menu, PUSH); item.setText(MetaTypes.getMetaType(componentType).getName()); item.addListener(SWT.Selection, (e) -> addComponent(Reflection.newInstance(componentType))); item.setEnabled(target.getComponent(ComponentType.getBaseType(componentType), true) == null); }
public boolean hasComponent(int typeId, boolean includeInactive) { SceneNodeComponent value = _components.get(ComponentType.findBaseType(typeId)); return value != null && (includeInactive || value.isActive()) && isSubtype(typeId, value.componentType); }
public void removeComponent(int componentTypeId) { SceneNodeComponent component = _components.get(ComponentType.findBaseType(componentTypeId)); if (component != null && isSubtype(componentTypeId, component.componentType)) { component.destroy(); } }