Пример #1
0
 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();
   }
 }
Пример #2
0
 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);
 }
Пример #3
0
 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);
 }
Пример #5
0
 public boolean hasComponent(int typeId, boolean includeInactive) {
   SceneNodeComponent value = _components.get(ComponentType.findBaseType(typeId));
   return value != null
       && (includeInactive || value.isActive())
       && isSubtype(typeId, value.componentType);
 }
Пример #6
0
 public void removeComponent(int componentTypeId) {
   SceneNodeComponent component = _components.get(ComponentType.findBaseType(componentTypeId));
   if (component != null && isSubtype(componentTypeId, component.componentType)) {
     component.destroy();
   }
 }