public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { super.createControls(parent, tabbedPropertySheetPage); parent.setLayout(new GridLayout(2, false)); IPropertyDescriptor pd = getPropertyDesriptor(JRDesignGenericElement.PROPERTY_EVALUATION_TIME); IPropertyDescriptor gpd = getPropertyDesriptor(JRDesignGenericElement.PROPERTY_EVALUATION_GROUP_NAME); getWidgetFactory().createCLabel(parent, pd.getDisplayName()); widgets.put(pd.getId(), new SPEvaluationTime(parent, this, pd, gpd)); createWidget4Property(parent, MGenericElement.PROPERTY_NAME); createWidget4Property(parent, MGenericElement.PROPERTY_NAMESPACE); }
@Override public String getDisplayName() { return mDelegate.getDisplayName(); }
public PropertyDescriptorWrapper(IPropertyDescriptor delegate) { super(delegate.getId(), delegate.getDisplayName()); mDelegate = delegate; }
public String getDisplayName() { return descriptor.getDisplayName(); } /* (non-Javadoc)
/* * (non-Javadoc) Method declared on IPropertySheetEntry. */ public String getDisplayName() { return descriptor.getDisplayName(); }
private void createDecoratedTextField( final IPropertyDescriptor descriptor, FormToolkit toolkit, Composite parent, final IMessageManager mmng) { final Object id = descriptor.getId(); String labelText = descriptor.getDisplayName(); String tooltip = Tooltips.tooltip(id.toString()); GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); boolean isDescription = NODE_DESCRIPTION.equals(id); Control widget; boolean isComplexProperty = descriptor instanceof ComplexPropertyDescriptor; boolean isUnionProperty = descriptor instanceof ComplexUnionPropertyDescriptor; if (isComplexProperty) { widget = bindNestedComplexProperties( toolkit, parent, mmng, (ComplexPropertyDescriptor) descriptor, id, labelText, tooltip); } else { Label label = toolkit.createLabel(parent, labelText); label.setToolTipText(tooltip); if (isDescription) { label.setLayoutData(gd); } if (isUnionProperty) { widget = bindNestedComplexUnionProperties( toolkit, parent, mmng, id, labelText, tooltip, (ComplexUnionPropertyDescriptor) descriptor); } else if (descriptor instanceof ExpressionPropertyDescriptor) { // lets create a composite and add a text are and a combo box // ExpandableComposite composite = // toolkit.createExpandableComposite(parent, SWT.HORIZONTAL); Composite composite = toolkit.createComposite(parent); GridLayout layout = new GridLayout(3, false); zeroMargins(layout); composite.setLayout(layout); widget = composite; Text text = toolkit.createText(composite, "", SWT.BORDER); text.setToolTipText(tooltip); gd = new GridData(GridData.FILL_HORIZONTAL); // gd.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING; // gd.horizontalAlignment = SWT.LEFT; // gd.verticalIndent = 0; // gd.verticalAlignment = GridData.FILL; text.setLayoutData(gd); ISWTObservableValue textValue = Forms.observe(text); // NOTE this code only works if the LanguageExpressionBean is // not // replaced under our feet! final LanguageExpressionBean expression = LanguageExpressionBean.bindToNodeProperty(node, id); final String expressionPropertyName = "expression"; Forms.bindBeanProperty( bindingContext, mmng, expression, expressionPropertyName, isMandatory(expression, expressionPropertyName), expressionPropertyName, textValue, text); String languageLabel = EditorMessages.propertiesLanguageTitle; toolkit.createLabel(composite, languageLabel); // toolkit.createSeparator(composite, SWT.SEPARATOR); Combo combo = new Combo(composite, SWT.NONE | SWT.BORDER); combo.setItems(new Languages().languageArray()); toolkit.adapt(combo, true, true); ISWTObservableValue comboValue = WidgetProperties.selection().observe(combo); Forms.bindBeanProperty( bindingContext, mmng, expression, "language", isMandatory(expression, "language"), languageLabel, comboValue, combo); String language = expression.getLanguage(); if (language == null) { language = CamelModelHelper.getDefaultLanguageName(); expression.setLanguage(language); } // now lets forward property events to the node expression.addPropertyChangeListener( new PropertyChangeListener() { /* * (non-Javadoc) * * @see * java.beans.PropertyChangeListener#propertyChange(java * .beans .PropertyChangeEvent) */ @Override public void propertyChange(PropertyChangeEvent event) { node.firePropertyChange(id.toString(), null, expression); } }); } else { String propertyName = getPropertyName(id); Class refType = isBeanRef(node, propertyName); if (refType != null) { Combo combo = new Combo(parent, SWT.NONE | SWT.BORDER); String[] beanRefs = getBeanRefs(refType); combo.setItems(beanRefs); toolkit.adapt(combo, true, true); widget = combo; ISWTObservableValue comboValue = WidgetProperties.selection().observe(combo); Forms.bindBeanProperty( bindingContext, mmng, node, propertyName, isMandatory(node, propertyName), labelText, comboValue, combo); } else if (isEndpointUri(node, propertyName)) { Combo combo = new Combo(parent, SWT.NONE | SWT.BORDER); combo.setItems(getEndpointUris()); toolkit.adapt(combo, true, true); widget = combo; ISWTObservableValue comboValue = WidgetProperties.selection().observe(combo); Forms.bindBeanProperty( bindingContext, mmng, node, propertyName, isMandatory(node, propertyName), labelText, comboValue, combo); } else if (descriptor instanceof BooleanPropertyDescriptor) { Button checkbox = new Button(parent, SWT.CHECK); widget = checkbox; ISWTObservableValue textValue = Forms.observe(checkbox); Forms.bindBeanProperty( bindingContext, mmng, node, propertyName, isMandatory(node, propertyName), labelText, textValue, checkbox); } else if (descriptor instanceof ListPropertyDescriptor) { if (CamelModelHelper.isPropertyListOFSetHeaders(id)) { Control control = bindSetHeaderTable(toolkit, parent, id); widget = control; } else { Control control = bindListOfValues(toolkit, parent, id); widget = control; } } else if (descriptor instanceof EnumPropertyDescriptor) { EnumPropertyDescriptor enumProperty = (EnumPropertyDescriptor) descriptor; ComboViewer combo = new ComboViewer(parent, SWT.READ_ONLY | SWT.BORDER); combo.setContentProvider(ArrayContentProvider.getInstance()); combo.setInput(getEnumValues(enumProperty.getEnumType())); IViewerObservableValue comboValue = ViewersObservables.observeSingleSelection(combo); Control control = combo.getControl(); Forms.bindBeanProperty( bindingContext, mmng, node, propertyName, isMandatory(node, propertyName), labelText, comboValue, control); toolkit.adapt(control, true, true); widget = control; } else { Text text; if (isDescription) { text = toolkit.createText( parent, "", SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL); } else { text = toolkit.createText(parent, "", SWT.BORDER); } text.setToolTipText(tooltip); widget = text; ISWTObservableValue textValue = Forms.observe(text); Forms.bindBeanProperty( bindingContext, mmng, node, propertyName, isMandatory(node, propertyName), labelText, textValue, text); } } } boolean isComplexOrUnion = isComplexProperty || isUnionProperty; if (isDescription || isComplexOrUnion) { gd = new GridData(GridData.FILL_BOTH); gd.heightHint = 90; gd.grabExcessVerticalSpace = true; gd.grabExcessHorizontalSpace = true; if (isComplexOrUnion) { gd.heightHint = -1; } if (isComplexProperty) { gd.horizontalSpan = 2; } } else { gd = new GridData(GridData.FILL_HORIZONTAL); } gd.widthHint = 250; widget.setLayoutData(gd); }