@Override public void redo () throws CannotRedoException { super.redo (); component.writeProperty (propertyName, newValue); }
@Override public Result postInitialize (DesignDocument document, DesignComponent mainComponent) { mainComponent.writeProperty(ClassCD.PROP_INSTANCE_NAME, InstanceNameResolver.createFromSuggested(mainComponent, lower + "Command")); // NOI18N mainComponent.writeProperty(CommandCD.PROP_LABEL, MidpTypes.createStringValue (upper)); mainComponent.writeProperty(CommandCD.PROP_TYPE, MidpTypes.createIntegerValue(type)); return new ComponentProducer.Result(mainComponent); }
public void run() { Sequence newDefSeq = (Sequence) e.getNewValue(); DesignComponent dcDefSeq = designIdMap.get(newDefSeq); dcAnimatedTile.writeProperty(SequenceContainerCDProperties.PROP_DEFAULT_SEQUENCE, PropertyValue.createComponentReference(dcDefSeq)); changeMap.put(dcAnimatedTile.getComponentID(), SequenceContainerCDProperties.PROP_DEFAULT_SEQUENCE); } });
public void run() { Sequence newDefSeq = (Sequence) e.getNewValue(); DesignComponent dcDefSeq = designIdMap.get(newDefSeq); dcSprite.writeProperty(SequenceContainerCDProperties.PROP_DEFAULT_SEQUENCE, PropertyValue.createComponentReference(dcDefSeq)); changeMap.put(dcSprite.getComponentID(), SequenceContainerCDProperties.PROP_DEFAULT_SEQUENCE); } });
public void run() { String newName = (String) e.getNewValue(); dcAnimatedTile.writeProperty(AnimatedTileCD.PROPERTY_NAME, MidpTypes.createStringValue(newName)); changeMap.put(dcAnimatedTile.getComponentID(), AnimatedTileCD.PROPERTY_NAME); } });
private boolean removeGauge(DesignComponent ac) { DesignComponent gauge = ac.readProperty(AlertCD.PROP_INDICATOR).getComponent(); if (gauge == null) { ac.writeProperty(AlertCD.PROP_INDICATOR, NULL_VALUE); PropertyEditorAlertIndicator.super.setValue(NULL_VALUE); return false; } ac.writeProperty(AlertCD.PROP_INDICATOR, PropertyValue.createNull()); ac.getDocument().deleteComponent(gauge); PropertyEditorAlertIndicator.super.setValue(NULL_VALUE); return false; }
public void setEditableName (DesignComponent component, String enteredName) { DesignComponent refComponent = component.readProperty(PROP_COMMAND).getComponent(); PropertyValue newName = InstanceNameResolver.createFromSuggested(refComponent, enteredName); refComponent.writeProperty(ClassCD.PROP_INSTANCE_NAME, newName); }
public static DesignComponent attachCommandToItem(DesignComponent item, DesignComponent command) { DesignComponent itemCommandEventSource = command.getDocument().createComponent(ItemCommandEventSourceCD.TYPEID); itemCommandEventSource.writeProperty(ItemCommandEventSourceCD.PROP_COMMAND, PropertyValue.createComponentReference(command)); itemCommandEventSource.writeProperty(ItemCommandEventSourceCD.PROP_ITEM, PropertyValue.createComponentReference(item)); MidpArraySupport.append(item, ItemCD.PROP_COMMANDS, itemCommandEventSource); item.addComponent(itemCommandEventSource); return itemCommandEventSource; }
@Override protected void setRenameName(String name) { DesignComponent command = ItemCommandEventSourceCD.getCommandComponent(getComponent()); command.writeProperty(CommandCD.PROP_LABEL, MidpTypes.createStringValue(name)); }
protected void componentsDeleting (Collection<DesignComponent> componentsToDelete) { for (String propertyName : propertyNames) { DesignComponent component = getComponent ().readProperty (propertyName).getComponent (); if (component != null && componentsToDelete.contains (component)) getComponent ().writeProperty (propertyName, PropertyValue.createNull ()); } }
@Override public Result postInitialize (DesignDocument document, DesignComponent entryPoint) { DesignComponent eventSource = document.createComponent (EntryStartEventSourceCD.TYPEID); entryPoint.addComponent (eventSource); entryPoint.writeProperty (EntryPointCD.PROP_START, PropertyValue.createComponentReference (eventSource)); return new Result (entryPoint, eventSource); }
private void saveCommands(DesignDocument document, DesignComponent connector, String commandName, String propertyName) { assert document != null || connector != null || propertyName != null; Collection<DesignComponent> commands = MidpDocumentSupport.getCategoryComponent(document, CommandsCategoryCD.TYPEID).getComponents(); for (DesignComponent command : commands) { PropertyValue value = command.readProperty(ClassCD.PROP_INSTANCE_NAME); if (value != PropertyValue.createNull() && value.getPrimitiveValue().equals(commandName)) { connector.writeProperty(propertyName, PropertyValue.createComponentReference(command)); break; } } }
public static DesignComponent createSceneDCFromScene(DesignDocument doc, Map<Identifiable, DesignComponent> designIdMap, Scene scene) { DesignComponent dcScene = designIdMap.get(scene); if (dcScene != null) { return dcScene; } dcScene = doc.createComponent(SceneCD.TYPEID); scene.setId(dcScene.getComponentID()); dcScene.writeProperty(SceneCD.PROPERTY_NAME, MidpTypes.createStringValue(scene.getName())); writeSceneItemsToSceneDC(doc, designIdMap, dcScene, scene); return dcScene; }
@Override protected void notifyCreated (DesignComponent component) { super.notifyCreated (component); ArraySupport.append (getComponent (), ListCD.PROP_ELEMENTS, component); if (component.isDefaultValue(ListElementEventSourceCD.PROP_STRING)) { PropertyValue value = getComponent ().readProperty(ListCD.PROP_ELEMENTS); List<PropertyValue> list = value.getArray (); component.writeProperty (ListElementEventSourceCD.PROP_STRING, MidpTypes.createStringValue (NbBundle.getMessage(ListCD.class, "NAME_New_List_Element", list.size()))); // NOI18N } } },
@Override protected void notifyCreated (DesignComponent choiceElement) { super.notifyCreated (choiceElement); DesignComponent choiceGroup = getComponent (); ArraySupport.append (choiceGroup, PROP_ELEMENTS, choiceElement); if (choiceElement.isDefaultValue(ChoiceElementCD.PROP_STRING)) { PropertyValue value = getComponent ().readProperty(PROP_ELEMENTS); List<PropertyValue> list = value.getArray (); choiceElement.writeProperty (ChoiceElementCD.PROP_STRING, MidpTypes.createStringValue (NbBundle.getMessage(ChoiceGroupCD.class, "DISP_New_Choice_Element", list.size()))); // NOI18N } } },
@Override protected void notifyCreated (DesignComponent switchCase) { super.notifyCreated (switchCase); DesignComponent switchComponent = getComponent (); ArraySupport.append (switchComponent, PROP_CASES, switchCase); PropertyValue propertyValue = switchCase.readProperty (SwitchCaseEventSourceCD.PROP_OPTION); if (propertyValue.getKind () == PropertyValue.Kind.NULL) { int size = switchComponent.readProperty (PROP_CASES).getArray ().size (); switchCase.writeProperty (SwitchCaseEventSourceCD.PROP_OPTION, MidpTypes.createJavaCodeValue (Integer.toString (size))); } } },
public DesignComponent createReuseEventHandler (DesignComponent eventSource, DesignComponent currentEventHandler, DesignComponent targetComponent) { if (currentEventHandler == null || ! getComponent ().getDocument ().getDescriptorRegistry ().isInHierarchy (SwitchDisplayableEventHandlerCD.TYPEID, currentEventHandler.getType ())) currentEventHandler = getComponent ().getDocument ().createComponent (SwitchDisplayableEventHandlerCD.TYPEID); currentEventHandler.writeProperty (PROP_ALERT, PropertyValue.createNull ()); currentEventHandler.writeProperty (PROP_DISPLAYABLE, PropertyValue.createComponentReference (targetComponent)); return currentEventHandler; } };
@Override public final ComponentProducer.Result accept (ComponentProducer producer, AcceptSuggestion suggestion) { DesignDocument document = getComponent().getDocument(); DesignComponent resource = producer.createComponent(document).getMainComponent(); MidpDocumentSupport.getCategoryComponent(document, ResourcesCategoryCD.TYPEID).addComponent(resource); getComponent().writeProperty(typesMap.get(currentType), PropertyValue.createComponentReference(resource)); return new ComponentProducer.Result(resource); }
public void run() { List<String> propertyNames = element.getPropertyValueNames(); for (String propertyName : propertyNames) { PropertyValue pv = component.readProperty(propertyName); if (PropertyValue.Kind.USERCODE.equals(pv.getKind())) { component.writeProperty(propertyName, component.getComponentDescriptor().getPropertyDescriptor(propertyName).getDefaultValue()); } } } });
protected void actionPerformed () { DesignDocument document = getComponent ().getDocument (); DesignComponent resources = MidpDocumentSupport.getCategoryComponent (document, ResourcesCategoryCD.TYPEID); DesignComponent ticker = document.createComponent (TickerCD.TYPEID); resources.addComponent (ticker); getComponent ().writeProperty (DisplayableCD.PROP_TICKER, PropertyValue.createComponentReference (ticker)); }