private boolean setSelectedComponentsAssert (Collection<DesignComponent> components) { for (DesignComponent component : components) { assert component != null; assert component.getDocument () == this; } return true; }
@Override protected void checkCustomValidity () { InstanceNameResolver.checkValidity (getComponent ().getDocument ()); } };
@Override public boolean isEnabled() { component.get().getDocument().getTransactionManager().readAccess(new Runnable() { public void run() { if (component.get().getDocument().getSelectedComponents().size() > 1) isEnabled = false; else isEnabled = true; } }); return isEnabled; }
public void run() { if (component.get().getParentComponent() == null && component.get().getDocument().getRootComponent() != component.get()) { return; } if (component.get().getPresenter(InfoPresenter.class) != null) { displayName = InfoPresenter.getDisplayName(component.get()); } } });
/** * 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); }
protected String getFileClasspath(FileObject fileObject) { DesignDocument document = getComponent().getDocument(); Map<FileObject,String> fileMap = MidpProjectSupport.getAllFilesForProjectByExt(document, Arrays.asList(fileObject.getExt())); return fileMap.get(fileObject); }
public static Font getFont(DesignComponent fontComponent) { if (fontComponent == null) { return null; } return getFont(getDeviceInfo(fontComponent.getDocument()), fontComponent); }
private static void selectComponent(final DesignComponent selectedCommandSource) { final DesignDocument document = selectedCommandSource.getDocument(); document.getTransactionManager().writeAccess(new Runnable() { public void run() { document.setSelectedComponents(null, Collections.singleton(selectedCommandSource)); } }); }
@Override public boolean isAcceptable (ComponentProducer producer, AcceptSuggestion suggestion) { DescriptorRegistry registry = getComponent().getDocument().getDescriptorRegistry(); for (TypeID type : typesMap.keySet()) { if (registry.isInHierarchy(type, producer.getMainComponentTypeID ())) { currentType = type; return true; } } return false; }
public boolean isAcceptable (ComponentProducer producer, AcceptSuggestion suggestion) { DesignComponent categoryComponent = MidpDocumentSupport.getCategoryComponent (getComponent ().getDocument (), DisplayablesCategoryCD.TYPEID); if (AcceptSupport.isAcceptable (categoryComponent, producer, null)) return true; categoryComponent = MidpDocumentSupport.getCategoryComponent (getComponent ().getDocument (), PointsCategoryCD.TYPEID); return AcceptSupport.isAcceptable (categoryComponent, producer, null); }
public void keyTyped(KeyEvent e) { if (e.getKeyChar() != KeyEvent.VK_ENTER) return; property.getRelatedComponent().getDocument().getTransactionManager().writeAccess(new Runnable() { public void run() { PropertyValue value = MidpTypes.createStringValue(getText()); resolveRelatedComponent (property).writeProperty(propertyName, value); MidpDatabindingSupport.removeUnusedConnector(property.getRelatedComponent(), propertyName); } }); PopupUtil.hidePopup(); }
public void actionPerformed (ActionEvent e) { final DesignComponent comp = ScreenBooleanInjectorPresenter.this.getComponent (); comp.getDocument ().getTransactionManager ().writeAccess (new Runnable () { public void run () { comp.writeProperty (propertyName, MidpTypes.createBooleanValue (InjectorCheckBox.this.isSelected ())); } }); PopupUtil.hidePopup (); } }
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); }
public DesignComponent createReuseEventHandler (DesignComponent eventSource, DesignComponent currentEventHandler, DesignComponent targetComponent) { if (currentEventHandler == null || ! getComponent ().getDocument ().getDescriptorRegistry ().isInHierarchy (CallPointEventHandlerCD.TYPEID, currentEventHandler.getType ())) currentEventHandler = getComponent ().getDocument ().createComponent (CallPointEventHandlerCD.TYPEID); currentEventHandler.writeProperty (CallPointEventHandlerCD.PROP_CALL_POINT, PropertyValue.createComponentReference (targetComponent)); return currentEventHandler; } };
public static DesignComponent createIndex(DesignComponent indexableDataSet, String instanceName) { DesignComponent index = indexableDataSet.getDocument().createComponent(IndexableDataSetIndexCD.TYPEID); index.writeProperty(ClassCD.PROP_INSTANCE_NAME, InstanceNameResolver.createFromSuggested(index, instanceName)); //NOI18N indexableDataSet.addComponent(index); return index; }
private static String createDataSetName(String name, DesignComponent c) { DescriptorRegistry registry = c.getDocument().getDescriptorRegistry(); if (registry.isInHierarchy(IndexableDataAbstractSetCD.TYPEID, c.getType())) { name = name + " " + INDEXABLE; //NOI18N } else if (registry.isInHierarchy(DataSetAbstractCD.TYPEID, c.getType())) { name = name + " " + DATASET; //NOI18N } return name; }
public final boolean isAcceptable (ComponentProducer producer, AcceptSuggestion suggestion) { DescriptorRegistry registry = getComponent().getDocument().getDescriptorRegistry(); TypeID producerTypeID = producer.getMainComponentTypeID (); return registry.isInHierarchy(typeID, producerTypeID) && notifyAccepting (producerTypeID); }
public static DesignComponent attachCommandToDisplayable(DesignComponent displayable, DesignComponent command) { DesignComponent source = displayable.getDocument().createComponent(CommandEventSourceCD.TYPEID); MidpDocumentSupport.addEventSource(displayable, DisplayableCD.PROP_COMMANDS, source); source.writeProperty(CommandEventSourceCD.PROP_DISPLAYABLE, PropertyValue.createComponentReference(displayable)); source.writeProperty(CommandEventSourceCD.PROP_COMMAND, PropertyValue.createComponentReference(command)); return source; }
@Override public boolean isRequiredToBeSet (DesignComponent component, int index) { DescriptorRegistry descriptorRegistry = component.getDocument ().getDescriptorRegistry (); List<PropertyValue> array = component.readProperty (DisplayableCD.PROP_COMMANDS).getArray (); DesignComponent commandEventSource = array.get (index).getComponent (); DesignComponent command = commandEventSource.readProperty (CommandEventSourceCD.PROP_COMMAND).getComponent (); if (command != null && descriptorRegistry.isInHierarchy (ListSelectCommandCD.TYPEID, command.getType ())) return false; return super.isRequiredToBeSet (command, index); }
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 } },