public List<PropertyDescriptor> getDeclaredPropertyDescriptors () { return Arrays.asList( new PropertyDescriptor(PROP_COMMANDS, CommandEventSourceCD.TYPEID.getArrayType (), PropertyValue.createEmptyArray (CommandEventSourceCD.TYPEID), true, false, MidpVersionable.MIDP), new PropertyDescriptor(PROP_TITLE, MidpTypes.TYPEID_JAVA_LANG_STRING, PropertyValue.createNull(), true, true, MidpVersionable.MIDP), new PropertyDescriptor(PROP_TICKER, TickerCD.TYPEID, PropertyValue.createNull(), true, true, MidpVersionable.MIDP), new PropertyDescriptor(PROP_COMMAND_LISTENER, CommandListenerCD.TYPEID, PropertyValue.createNull (), false, true, MidpVersionable.MIDP) ); }
public static PropertyValue remove (PropertyValue array, DesignComponent itemToRemove) { ArrayList<PropertyValue> list = new ArrayList<PropertyValue> (array.getArray ()); Iterator<PropertyValue> iterator = list.iterator (); while (iterator.hasNext ()) { PropertyValue value = iterator.next (); if (value.getComponent ().equals (itemToRemove)) iterator.remove (); } array = PropertyValue.createArray (array.getType ().getComponentType (), list); return array; }
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); }
public static PropertyValue addArrayValue (PropertyValue array, PropertyValue value) { assert array != null && value != null; assert array.getKind ().equals (PropertyValue.Kind.ARRAY); TypeID componentType = array.getType ().getComponentType (); assert value.isCompatible (componentType); ArrayList<PropertyValue> values = new ArrayList<PropertyValue> (array.getArray ()); values.add (value); return PropertyValue.createArray (componentType, values); }
public BooleanInplaceEditor(DesignPropertyEditor propertyEditor) { this.propertyEditor = propertyEditor; checkBox = new JCheckBox(); PropertyValue value = (PropertyValue) propertyEditor.getValue(); if (value != null && value.getKind() == PropertyValue.Kind.VALUE) { if (!(value.getPrimitiveValue() instanceof Boolean)) { Boolean selected = (Boolean) value.getPrimitiveValue(); checkBox.setSelected(selected); } } else if (value == PropertyValue.createNull()) checkBox.setSelected(false); }
@Override public String getAsText() { PropertyValue value = (PropertyValue) super.getValue(); if (value == null || value.getKind() == PropertyValue.Kind.NULL) { return PropertyEditorUserCode.NULL_TEXT; } return (String) value.getPrimitiveValue (); }
throw new IllegalArgumentException(); return createUserCode(serialized.substring(1)); case NULL_ID: return createNull(); case REFERENCE_ID: throw new IllegalArgumentException("No component for given serilezed value"); // NOI18N return createComponentReference(document.getComponentByUID(componentID)); throw new IllegalArgumentException(); return createValue(descriptor, type, descriptor.deserialize(serialized.substring(1))); throw new IllegalArgumentException(); return createEnumValue(descriptor, type, descriptor.deserialize(serialized.substring(1))); assert elementLength >= 0; pos = index + 1; propertyValues.add(deserialize(serialized.substring(pos, pos + elementLength), document, componentType)); pos += elementLength; return createArray(componentType, propertyValues);
public void generateParameterCode (DesignComponent component, MultiGuardedSection section, int index) { PropertyValue propertyValue = component.readProperty(ChoiceGroupCD.PROP_ELEMENTS); List<PropertyValue> array = propertyValue.getArray (); DesignComponent choiceElement = array.get (index).getComponent (); PropertyValue string = choiceElement.readProperty(ChoiceElementCD.PROP_FONT); MidpCodeSupport.generateCodeForPropertyValue (section.getWriter (), string); }
private static void writeSceneItemsToSceneDC(DesignDocument doc, Map<Identifiable, DesignComponent> designIdMap, DesignComponent dcScene, Scene scene) { List<PropertyValue> sceneItemProps = dcScene.readProperty(SceneCD.PROPERTY_SCENE_ITEMS).getArray(); for (Iterator<PropertyValue> it = sceneItemProps.iterator(); it.hasNext();) { PropertyValue propertyValue = it.next(); DesignComponent dcSceneItemComp = propertyValue.getComponent(); dcSceneItemComp.removeFromParentComponent(); dcScene.writeProperty(SceneCD.PROPERTY_SCENE_ITEMS, PropertyValue.createEmptyArray(SceneItemCD.TYPEID)); assert (layerDC != null); sceneItemDC.writeProperty(SceneItemCD.PROPERTY_LAYER, PropertyValue.createComponentReference(layerDC)); sceneItemDC.writeProperty(SceneItemCD.PROPERTY_LOCK, MidpTypes.createBooleanValue(scene.isLayerLocked(layer))); sceneItemDC.writeProperty(SceneItemCD.PROPERTY_VISIBLE, MidpTypes.createBooleanValue(scene.isLayerVisible(layer))); PropertyValue sceneItemPropVal = PropertyValue.createComponentReference(sceneItemDC); scenePropValues.add(sceneItemPropVal); dcScene.writeProperty(SceneCD.PROPERTY_SCENE_ITEMS, PropertyValue.createArray(SceneItemCD.TYPEID, scenePropValues));
public List<PropertyDescriptor> getDeclaredPropertyDescriptors() { return Arrays.asList( new PropertyDescriptor(PROP_DATE, MidpTypes.TYPEID_LONG, PropertyValue.createNull (), true, true, MidpVersionable.MIDP), new PropertyDescriptor(PROP_TIME_ZONE, MidpTypes.TYPEID_JAVA_LANG_STRING, PropertyValue.createNull(), true, true, MidpVersionable.MIDP), new PropertyDescriptor(PROP_INPUT_MODE, MidpTypes.TYPEID_INT, PropertyValue.createNull (), false, true, MidpVersionable.MIDP) ); }
public boolean isRequiredToBeSet (DesignComponent component, int index) { PropertyValue propertyValue = component.readProperty (ListCD.PROP_ELEMENTS); List<PropertyValue> array = propertyValue.getArray (); DesignComponent listElement = array.get (index).getComponent (); PropertyValue string = listElement.readProperty (ListElementEventSourceCD.PROP_FONT); return string.getKind () != PropertyValue.Kind.NULL; }
public static PropertyValue createLongValue (long longValue) { return PropertyValue.createValue (MidpPrimitiveDescriptor.longPD, TYPEID_LONG, longValue); }
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() { if (propertyEditor != null && propertyEditor.isExecuteInsideWriteTransactionUsed()) { if (! propertyEditor.executeInsideWriteTransaction()) return; } for (String propertyName : values.getPropertyNames()) { if (values.getValue(propertyName) instanceof PropertyValue) { component.writeProperty(propertyName, (PropertyValue) values.getValue(propertyName)); continue; } if (values.getValue(propertyName) == null) component.writeProperty(propertyName, PropertyValue.createNull()); else if (values.getValue(propertyName) instanceof DesignComponent) { component.writeProperty(propertyName, PropertyValue.createComponentReference((DesignComponent) values.getValue(propertyName))); } else { component.writeProperty(propertyName, PropertyValue.createValue(component.getDocument().getDocumentInterface().getProjectType(), getComponentTypeID(component,propertyName) , values.getValue(propertyName))); } } } });
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; } } }
DesignComponent parentComponent = getComponent().getParentComponent(); List<PropertyValue> array = parentComponent.readProperty(arrayPropertyName).getArray(); if (array == null || array.size() < 1) return super.accept(transferable, suggestion); int componentIndex = -1; for (PropertyValue value : array) { if (value.getComponent().equals(componentTrans)) { movedValue = value; componentTransIndex = array.indexOf(value); if (value.getComponent().equals(getComponent())) componentIndex = array.indexOf(value); if (dragComponent == null) return super.accept(transferable, suggestion); parentComponent.writeProperty(arrayPropertyName, PropertyValue.createArray(arrayType, newArray)); return new Result(dragComponent);
public void run() { DesignComponent valueComponent = value.getComponent(); decodeValue[0] = getComponentDisplayName(valueComponent); } });
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()); } }
dcSequenceContainer.addComponent(dcSequence); PropertyValue seqPropVal = PropertyValue.createComponentReference(dcSequence); sequenceDCs.add(seqPropVal); dcSequenceContainer.writeProperty(SequenceContainerCDProperties.PROP_SEQUENCES, PropertyValue.createArray(SequenceCD.TYPEID, sequenceDCs));
public static PropertyValue append (PropertyValue array, PropertyValue itemToAppend) { ArrayList<PropertyValue> list = new ArrayList<PropertyValue> (array.getArray ()); list.add (itemToAppend); array = PropertyValue.createArray (array.getType ().getComponentType (), list); return array; }