public void recursiveInitProperties(Node node) { NodeList children = dom.getChildElements(node); for (int j = 0; j < children.getLength(); j++) { if (!children.item(j).getNamespaceURI().equals(rngaURI)) { if (dom.hasQName(children.item(j), "rng:ref")) { if (isCountValue(children.item(j))) { Relax2Hybrid transform1 = new Relax2Hybrid(); try { transform1.transform(srcDoc, dom, children.item(j)); // now resolve the rng:ref transform1.retrieveRelaxNGRef((Element) children.item(j)); } catch (DOMTransformException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } else continue; recursiveInitProperties(node); } else if (dom.hasQName(children.item(j), "swe:value")) { nameDescriptor = new TextPropertyDescriptor(PROPERTY_COUNT_VALUE, "name"); PropertyLabelProvider plp = new PropertyLabelProvider(node, dom); nameDescriptor.setLabelProvider(plp); nameDescriptor.setCategory(node.getLocalName()); } else { recursiveInitProperties(children.item(j)); } } } }
@Override public IPropertyDescriptor[] getPropertyDescriptors() { List<IPropertyDescriptor> props = new ArrayList<IPropertyDescriptor>(); TextPropertyDescriptor nameDescr = new TextPropertyDescriptor(PROPERTY_NAME, PROPERTY_NAME); nameDescr.setValidator(getDiagram().getUniqueNameValidator(this)); props.add(nameDescr); props.add(new TextPropertyDescriptor(TITLE_PROP, TITLE_PROP)); props.add(new TextPropertyDescriptor(TITLE_ID_PROP, TITLE_ID_PROP)); props.add(new TextPropertyDescriptor(OK_PROP, OK_PROP)); if (!getPlatform().isAndroid()) { props.add(new TextPropertyDescriptor(OK_ID_PROP, OK_ID_PROP)); } props.add(new TextPropertyDescriptor(MESSAGE_PROP, MESSAGE_PROP)); props.add(new TextPropertyDescriptor(MESSAGE_ID_PROP, MESSAGE_ID_PROP)); NumberPropertyDescriptor npd = new NumberPropertyDescriptor( PROPERTY_CHILDREN, "optionsCount", NumberCellEditor.INTEGER, true); // set Maximum number of buttons to 3 under Android platform int maxValue = Platform.Android.equals(getPlatform()) ? 3 : 30; npd.setValidator(new MinmaxValidator(1, maxValue)); props.add(npd); npd = new NumberPropertyDescriptor(CANCEL_PROP, CANCEL_PROP, NumberCellEditor.INTEGER, true); npd.setValidator(new MinmaxValidator(0, MinmaxValidator.MIN_ONLY)); props.add(npd); return props.toArray(new IPropertyDescriptor[props.size()]); }
@Override public Object getPropertyValue(Object id) { String label = null; if ((id == PROPERTY_COUNT_VALUE) && (nameDescriptor != null)) { String displayName = (String) nameDescriptor.getDisplayName(); label = nameDescriptor.getLabelProvider().getText(displayName); return label; } return ""; }
/** Default constructor */ public CommonEntityModel() { // TextPropertyDescriptor aType = new TextPropertyDescriptor(P_SZ_TYPE, // UMLPlugin.getDefault().getResourceString("property.szType")); // TextPropertyDescriptor aLabel = new TextPropertyDescriptor(P_SZ_LABEL, // UMLPlugin.getDefault().getResourceString("property.szLabel")); // TextPropertyDescriptor aSource = new TextPropertyDescriptor(P_SZ_SOURCE, // UMLPlugin.getDefault().getResourceString("property.szSource")); // TextPropertyDescriptor aSourceDec = new TextPropertyDescriptor(P_SZ_SOURCE_DECORATION, // UMLPlugin.getDefault().getResourceString("property.szSourceDecoration")); // TextPropertyDescriptor aTarget = new TextPropertyDescriptor(P_SZ_TARGET, // UMLPlugin.getDefault().getResourceString("property.szTarget")); // TextPropertyDescriptor aTargetDec = new TextPropertyDescriptor(P_SZ_TARGET_DECORATION, // UMLPlugin.getDefault().getResourceString("property.szTargetDecoration")); // // aType.setCategory("Annotation"); // aLabel.setCategory("Annotation"); // aSource.setCategory("Annotation"); // aSourceDec.setCategory("Annotation"); // aTarget.setCategory("Annotation"); // aTargetDec.setCategory("Annotation"); TextPropertyDescriptor STEREO_TYPE = new TextPropertyDescriptor( StereoTypeModel.P_STEREO_TYPE, UMLPlugin.getDefault().getResourceString("property.stereoType")); PropertyDescriptor SIMPLE_ENTITY_NAME = new PropertyDescriptor( P_SIMPLE_ENTITY_NAME, UMLPlugin.getDefault().getResourceString("property.simpleName")); TextPropertyDescriptor ENTITY_NAME = new TextPropertyDescriptor( P_ENTITY_NAME, UMLPlugin.getDefault().getResourceString("property.name")); ColorPropertyDescriptor BACKGROUND_COLOR = new ColorPropertyDescriptor( P_BACKGROUND_COLOR, UMLPlugin.getDefault().getResourceString("property.background")); PropertyDescriptor ATTRIBUTES = new PropertyDescriptor( P_ATTRIBUTES, UMLPlugin.getDefault().getResourceString("property.attributes")); PropertyDescriptor OPERATTIONS = new PropertyDescriptor( P_OPERATIONS, UMLPlugin.getDefault().getResourceString("property.operations")); STEREO_TYPE.setCategory("Object properties"); SIMPLE_ENTITY_NAME.setCategory("Object properties"); ENTITY_NAME.setCategory("Object properties"); BACKGROUND_COLOR.setCategory("Object properties"); ATTRIBUTES.setCategory("Object properties"); OPERATTIONS.setCategory("Object properties"); propertyDescriptors = new IPropertyDescriptor[] { STEREO_TYPE, SIMPLE_ENTITY_NAME, ENTITY_NAME, BACKGROUND_COLOR, ATTRIBUTES, OPERATTIONS, // aType,aLabel,aSource,aSourceDec,aTarget,aTargetDec, }; }
@Override public void setPropertyValue(Object id, Object value) { String str = (String) value; if ((id == PROPERTY_COUNT_VALUE) && (nameDescriptor != null)) { PropertyLabelProvider propProvider = (PropertyLabelProvider) nameDescriptor.getLabelProvider(); Node changeNode = propProvider.getNode(); Element name = dom.getElement((Element) changeNode, "swe:value"); if (str != null && !str.equals("")) { if (!dom.existAttribute(name, "rng:value/@selected")) { dom.setAttributeValue((Element) name, "rng:data/rng:value/@selected", "true"); } dom.setElementValue((Element) name, "rng:data/rng:value", value.toString()); ((Element) changeNode).setAttribute("xng:selected", "true"); } else { Element valueNode = dom.getElement((Element) changeNode, "swe:value/rng:data/rng:value"); ((Element) changeNode).removeAttribute("xng:selected"); valueNode.setTextContent(""); valueNode.removeAttribute("selected"); } this.firePropertyChange("INSERT", null, null); } }
public IPropertyDescriptor[] getPropertyDescriptors() { ArrayList<IPropertyDescriptor> al = new ArrayList<IPropertyDescriptor>(); al.addAll(Arrays.asList(super.getPropertyDescriptors())); PropertyDescriptor a1 = new NoEditableTextPropertyDescriptor(PROP_DATASET, "数据源"); a1.setCategory("高级"); al.add(a1); // PropertyDescriptor a2 = new TextPropertyDescriptor(PROP_POSITION, "位置"); // a2.setCategory("高级"); // al.add(a2); if (formComp.getRenderType() == 1 || formComp.getRenderType() == 3) { PropertyDescriptor a3 = new TextPropertyDescriptor(PROP_COLUMNCOUNT, "列数"); a3.setCategory("高级"); al.add(a3); } PropertyDescriptor a4 = new ObjectComboPropertyDescriptor(PROP_RENDERTYPE, "渲染类型", renderType); a4.setCategory("高级"); al.add(a4); PropertyDescriptor a5 = new TextPropertyDescriptor(PROP_ROWHEIGHT, "每行高度"); a5.setCategory("高级"); al.add(a5); PropertyDescriptor a6 = new ComboBoxPropertyDescriptor(PROP_WITHFORM, "是否是HTML表单", Constant.ISLAZY); a6.setCategory("高级"); al.add(a6); PropertyDescriptor a7 = new TextPropertyDescriptor(PROP_BGCOLOR, "表单背景"); a7.setCategory("高级"); al.add(a7); PropertyDescriptor a8 = new ComboBoxPropertyDescriptor(PROP_RENDERHIDDENELE, "是否渲染隐藏的表单元素", Constant.ISLAZY); a8.setCategory("高级"); al.add(a8); PropertyDescriptor a9 = new TextPropertyDescriptor(PROP_ELEWIDTH, "行宽"); a9.setCategory("高级"); al.add(a9); PropertyDescriptor a10 = new TextPropertyDescriptor(PROP_LABELMINWIDTH, "最小标签宽度"); a10.setCategory("高级"); al.add(a10); TextPropertyDescriptor captionDes = new TextPropertyDescriptor(PROP_CAPTION, "标题"); captionDes.setCategory("基本"); al.add(captionDes); return al.toArray(new IPropertyDescriptor[0]); }
static { TextPropertyDescriptor t1 = new TextPropertyDescriptor(ID_X, "X"); t1.setValidator(NumberCellEditorValidator.INSTANCE()); TextPropertyDescriptor t2 = new TextPropertyDescriptor(ID_Y, "Y"); t2.setValidator(NumberCellEditorValidator.INSTANCE()); t2.setLabelProvider(TextPropertyLabelProvider.INSTANCE()); t1.setLabelProvider(TextPropertyLabelProvider.INSTANCE()); descriptor = new IPropertyDescriptor[] {t1, t2}; }