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); } });
private void saveValue(String text) { if (text.length() > 0) { if (noneItem.equals(text)) { super.setValue(NULL_VALUE); } else { super.setValue(PropertyValue.createComponentReference(getCommandEvenSource(text))); } } }
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; }
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 public Result postInitialize (DesignDocument document, DesignComponent list) { DesignComponent listSelectCommand = MidpDocumentSupport.getSingletonCommand (document, ListSelectCommandCD.TYPEID); DesignComponent listSelectCommandEventSource = document.createComponent (ListSelectCommandEventSourceCD.TYPEID); listSelectCommandEventSource.writeProperty (CommandEventSourceCD.PROP_DISPLAYABLE, PropertyValue.createComponentReference (list)); listSelectCommandEventSource.writeProperty (CommandEventSourceCD.PROP_COMMAND, PropertyValue.createComponentReference (listSelectCommand)); MidpDocumentSupport.addEventSource (list, DisplayableCD.PROP_COMMANDS, listSelectCommandEventSource); DesignComponent listEventHandler = document.createComponent (ListEventHandlerCD.TYPEID); MidpDocumentSupport.updateEventHandlerWithNew (listSelectCommandEventSource, listEventHandler); list.writeProperty(ListCD.PROP_SELECT_COMMAND, PropertyValue.createComponentReference (listSelectCommandEventSource)); return new Result (list, listSelectCommandEventSource, listEventHandler); }
@Override public Result accept(Transferable transferable, AcceptSuggestion suggestion) { DesignComponent component = DesignComponentDataFlavorSupport.getTransferableDesignComponent(transferable); String propertyName = typesMap.get(component.getType()); if (propertyName == null) throw new IllegalStateException(); getComponent().writeProperty(propertyName, PropertyValue.createComponentReference(component)); return new ComponentProducer.Result(component); } }
public static void updateEventHandlerWithAlert(DesignComponent eventHandler, DesignComponent alert) { if (alert != null) { eventHandler.writeProperty(SwitchDisplayableEventHandlerCD.PROP_ALERT, PropertyValue.createComponentReference(alert)); } else { eventHandler.writeProperty(SwitchDisplayableEventHandlerCD.PROP_ALERT, PropertyValue.createNull()); } }
@Override public Result postInitialize (DesignDocument document, DesignComponent ifCallPoint) { DesignComponent trueCase = document.createComponent (IfTrueEventSourceCD.TYPEID); ifCallPoint.addComponent (trueCase); ifCallPoint.writeProperty (IfPointCD.PROP_TRUE, PropertyValue.createComponentReference (trueCase)); DesignComponent falseCase = document.createComponent (IfFalseEventSourceCD.TYPEID); ifCallPoint.addComponent (falseCase); ifCallPoint.writeProperty (IfPointCD.PROP_FALSE, PropertyValue.createComponentReference (falseCase)); return new Result (ifCallPoint, trueCase, falseCase); }
public static void append (DesignComponent component, String propertyName, DesignComponent element) { PropertyValue value = component.readProperty (propertyName); ArrayList<PropertyValue> list = new ArrayList<PropertyValue> (value.getArray ()); list.add (PropertyValue.createComponentReference (element)); value = PropertyValue.createArray (value.getType ().getComponentType (), list); component.writeProperty (propertyName, value); }
@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); }
public static void addEventSource(DesignComponent component, String propertyName, DesignComponent eventSource) { component.addComponent(eventSource); PropertyValue sources = component.readProperty(propertyName); sources = PropertyValueSupport.addArrayValue(sources, PropertyValue.createComponentReference(eventSource)); component.writeProperty(propertyName, sources); }
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; } } }
@Override public final ComponentProducer.Result accept (ComponentProducer producer, AcceptSuggestion suggestion) { DesignComponent displayable = getComponent(); DesignDocument document = displayable.getDocument(); DesignComponent command = producer.createComponent(document).getMainComponent(); MidpDocumentSupport.getCategoryComponent(document, CommandsCategoryCD.TYPEID).addComponent(command); DesignComponent source = document.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 new ComponentProducer.Result (source); }
@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); }
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)); }
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 DesignComponent createReuseEventHandler (DesignComponent eventSource, DesignComponent currentEventHandler, DesignComponent targetComponent) { if (currentEventHandler == null || ! getComponent ().getDocument ().getDescriptorRegistry ().isInHierarchy (ExitMidletEventHandlerCD.TYPEID, currentEventHandler.getType ())) currentEventHandler = getComponent ().getDocument ().createComponent (ExitMidletEventHandlerCD.TYPEID); currentEventHandler.writeProperty (ExitMidletEventHandlerCD.PROP_MOBILE_DEVICE, PropertyValue.createComponentReference (targetComponent)); return currentEventHandler; } };
public DesignComponent createReuseEventHandler (DesignComponent eventSource, DesignComponent currentEventHandler, DesignComponent targetComponent) { if (currentEventHandler == null || ! getComponent ().getDocument ().getDescriptorRegistry ().isInHierarchy (MethodPointEventHandlerCD.TYPEID, currentEventHandler.getType ())) currentEventHandler = getComponent ().getDocument ().createComponent (MethodPointEventHandlerCD.TYPEID); currentEventHandler.writeProperty (MethodPointEventHandlerCD.PROP_METHOD_POINT, PropertyValue.createComponentReference (targetComponent)); return currentEventHandler; } };
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; } };