/** * Gathers all components in a document that are containing presenter of presenterClass. * @param document the document * @param presenterClass the presenterClass * @return the list of components */ public static <T extends Presenter> List<DesignComponent> gatherAllComponentsContainingPresenterClass(DesignDocument document, Class<T> presenterClass) { ArrayList<DesignComponent> list = new ArrayList<DesignComponent> (); DesignComponent rootComponent = document.getRootComponent(); if (rootComponent != null) gatherAllComponentsContainingPresenterClass(list, rootComponent, presenterClass); return list; }
/** * Gathers all components the main tree of components in a specific document. * @param document the document * @return the list of components */ public static Iterable<DesignComponent> gatherAllComponents(DesignDocument document) { ArrayList<DesignComponent> list = new ArrayList<DesignComponent> (); gatherAllComponents(list, document.getRootComponent()); return list; }
/** * Gathers all components in main tree of components in a specific document. * It returns a list of components that are or inherits a specific type-id using DescriptorRegistry.isInHierarchy method. * @param document the document * @param typeID the required typeid of components * @return the filtered list of components */ public static List<DesignComponent> gatherAllComponentsOfTypeID(DesignDocument document, TypeID typeID) { ArrayList<DesignComponent> list = new ArrayList<DesignComponent> (); gatherAllComponentsOfTypeID(list, typeID, document.getRootComponent()); return list; }
public void run() { DesignComponent root = PropertiesNodesManager.this.document.getRootComponent(); for (DesignComponent c : root.getComponents()) { cleanUpAll(c); } } });
public void run () { DefaultListModel model = (DefaultListModel) list.getModel (); model.removeAllElements (); DesignComponent rootComponent = document.getRootComponent (); if (rootComponent != null) analyze (model, rootComponent); } });
private static Collection<DesignComponent> gatherAllComponentsToDelete (DesignDocument document, Collection<DesignComponent> baseComponents) { HashSet<DesignComponent> componentsToDelete = new HashSet<DesignComponent> (baseComponents); Collection<DesignComponent> componentsToDeleteUm = Collections.unmodifiableCollection (componentsToDelete); while (findNewlyRequired (document.getRootComponent (), componentsToDelete, componentsToDeleteUm)) ; return componentsToDelete; }
private static void checkDocumentValidity (DesignDocument savingDocument) { HashSet<DesignComponent> componentsInTree = new HashSet<DesignComponent> (); HashSet<DesignComponent> referencedComponents = new HashSet<DesignComponent> (); collectComponentsInTree (componentsInTree, savingDocument.getRootComponent ()); for (DesignComponent component : componentsInTree) collectUsedReferences (referencedComponents, component); for (DesignComponent component : referencedComponents) if (! componentsInTree.contains (component)) Debug.warning ("Saving", "Referenced component is not in the tree", component); // NOI18N }
public boolean isAvailable (DesignDocument document) { if (document == null) return false; DesignComponent root = document.getRootComponent (); if (root == null) return false; PropertyValue version = root.readProperty (RootCD.PROP_VERSION); String string = MidpTypes.getString (version); return string != null && string.startsWith (RootCD.VALUE_MIDP_PREFIX); }
public boolean isAvailable (DesignDocument document) { if (document == null) return false; DesignComponent root = document.getRootComponent (); if (root == null) return false; PropertyValue version = root.readProperty (RootCD.PROP_VERSION); String string = MidpTypes.getString (version); return RootCD.VALUE_MIDP_2_0.equals (string); }
public static DesignComponent addTiledLayer(DesignDocument document) { //HINT -- here show a dialog to select an image DesignComponent rootComponent = document.getRootComponent(); DesignComponent tiledLayer = document.createComponent(TiledLayerCD.TYPEID); rootComponent.addComponent(tiledLayer); // TODO - initialize tiled layer return tiledLayer; }
public static DesignComponent getCategoryComponent(DesignDocument document, TypeID categoryType) { List<DesignComponent> list = DocumentSupport.gatherSubComponentsOfType(document.getRootComponent(), categoryType); if (list.size () == 0 && document.getTransactionManager ().isWriteAccess ()) { DesignComponent categoryComponent = document.createComponent (categoryType); document.getRootComponent ().addComponent (categoryComponent); return categoryComponent; } assert list.size() == 1; return list.get(0); }
public void run() { DesignComponent rootComponent = document.getRootComponent(); ScreenDeviceInfoPresenter presenter = rootComponent.getPresenter(ScreenDeviceInfoPresenter.class); assert (presenter != null) : "No ScreenDevice attached to the root component"; //NOI18N screenDevice[0] = presenter.getScreenDeviceInfo(); } });
public void run() { DesignDocument doc = document; DesignComponent imgResDC = createImageResourceDCFromImageResource(imageResource); designIdMap.put(imageResource, imgResDC); changeMap.put(doc.getRootComponent().getComponentID(), imageResource.getName()); imageResource.addImageResourceListener(GameController.this); doc.getRootComponent().addComponent(imgResDC); } });
/** * Checks whether a specified component is referenced from the main tree of components under document root. * @param referenceComponent the reference component * @return true, if the reference component is referenced */ public static boolean isComponentReferencedInRootTree (DesignComponent referenceComponent) { assert referenceComponent != null; return isComponentReferencedInRootTree (referenceComponent.getDocument ().getRootComponent (), referenceComponent); }
public void run() { changeMap.put(doc.getRootComponent().getComponentID(), sprite.getName()); document.deleteComponent(dcLayer); } });
public void run() { DesignComponent sceneDC = createSceneDCFromScene(doc, designIdMap, scene); designIdMap.put(scene, sceneDC); changeMap.put(doc.getRootComponent().getComponentID(), scene.getName()); scene.addSceneListener(GameController.this); scene.addPropertyChangeListener(GameController.this); doc.getRootComponent().addComponent(sceneDC); } });
public void run() { changeMap.put(doc.getRootComponent().getComponentID(), tiledLayer.getName()); document.deleteComponent(dcLayer); } });
public void run() { DesignDocument doc = document; DesignComponent tiledLayerDC = createTiledLayerDCFromTiledLayer(doc, designIdMap, tiledLayer); changeMap.put(doc.getRootComponent().getComponentID(), tiledLayer.getName()); tiledLayer.addTiledLayerListener(GameController.this); tiledLayer.addPropertyChangeListener(GameController.this); doc.getRootComponent().addComponent(tiledLayerDC); } });
private String getComponentDisplayName(DesignComponent component) { if (component == null) { return noneComponentAsText; } // issue 104721 fix if (component.getParentComponent() == null && component.getDocument().getRootComponent() != component) { return noneComponentAsText; } return MidpValueSupport.getHumanReadableString(component); }
protected boolean matches (GuardedSection section) { boolean lazyInit = MidpTypes.getBoolean (getComponent ().readProperty (PROP_LAZY_INIT)); return MultiGuardedSection.matches(section, lazyInit ? getComponent().getComponentID() + "-getter" : getComponent ().getDocument ().getRootComponent ().getComponentID () + "-initialize", 1); // NOI18N } },