* Initialize the composite with values from a rule.
*
* @param ruleWrapper the rule to take the info from.
*/
public void init( RuleWrapper ruleWrapper ) {
PointSymbolizerWrapper symbolizersWrapper = ruleWrapper.getGeometrySymbolizersWrapper().adapt(
PointSymbolizerWrapper.class);
mainComposite = new Composite(parent, SWT.NONE);
mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
mainComposite.setLayout(new GridLayout(3, true));
boolean widgetEnabled = symbolizersWrapper.hasStroke();
borderEnableButton = new Button(mainComposite, SWT.CHECK);
GridData borderEnableButtonGD = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
borderEnableButtonGD.horizontalSpan = 3;
borderEnableButton.setLayoutData(borderEnableButtonGD);
borderEnableButton.setText(Messages.PointBoderParametersComposite_0);
borderEnableButton.setSelection(widgetEnabled);
borderEnableButton.addSelectionListener(this);
// header
new Label(mainComposite, SWT.NONE);
Label valueLabel = new Label(mainComposite, SWT.NONE);
valueLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false));
valueLabel.setText(Messages.PointBoderParametersComposite_1);
Label fieldsLabel = new Label(mainComposite, SWT.NONE);
fieldsLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false));
fieldsLabel.setText(Messages.PointBoderParametersComposite_2);
// border width
Label borderWidthLabel = new Label(mainComposite, SWT.NONE);
borderWidthLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
borderWidthLabel.setText(Messages.PointBoderParametersComposite_3);
borderWidthSpinner = new Spinner(mainComposite, SWT.BORDER);
borderWidthSpinner.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
borderWidthSpinner.setMaximum(500);
borderWidthSpinner.setMinimum(0);
borderWidthSpinner.setIncrement(10);
String width = symbolizersWrapper.getStrokeWidth();
Double tmpWidth = isDouble(width);
int tmp = 3;
if (tmpWidth != null) {
tmp = tmpWidth.intValue();
}
borderWidthSpinner.setSelection(tmp * 10);
borderWidthSpinner.setDigits(1);
borderWidthSpinner.addSelectionListener(this);
borderWidthAttributecombo = new Combo(mainComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
borderWidthAttributecombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
borderWidthAttributecombo.setItems(numericAttributesArrays);
borderWidthAttributecombo.addSelectionListener(this);
borderWidthAttributecombo.select(0);
if (tmpWidth == null) {
int index = getAttributeIndex(width, numericAttributesArrays);
if (index != -1) {
borderWidthAttributecombo.select(index);
}
}
// border alpha
Label borderOpactityLabel = new Label(mainComposite, SWT.NONE);
borderOpactityLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
borderOpactityLabel.setText(Messages.PointBoderParametersComposite_4);
borderOpacitySpinner = new Spinner(mainComposite, SWT.BORDER);
borderOpacitySpinner.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
borderOpacitySpinner.setMaximum(100);
borderOpacitySpinner.setMinimum(0);
borderOpacitySpinner.setIncrement(10);
String opacity = symbolizersWrapper.getStrokeOpacity();
Double tmpOpacity = isDouble(opacity);
tmp = 100;
if (tmpOpacity != null) {
tmp = (int) (tmpOpacity.doubleValue() * 100);
}
borderOpacitySpinner.setSelection(tmp);
borderOpacitySpinner.addSelectionListener(this);
borderOpacityAttributecombo = new Combo(mainComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
borderOpacityAttributecombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
borderOpacityAttributecombo.setItems(numericAttributesArrays);
borderOpacityAttributecombo.addSelectionListener(this);
borderOpacityAttributecombo.select(0);
if (tmpOpacity == null) {
int index = getAttributeIndex(opacity, numericAttributesArrays);
if (index != -1) {
borderOpacityAttributecombo.select(index);
}
}
// border color
Label borderColorLabel = new Label(mainComposite, SWT.NONE);
borderColorLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
borderColorLabel.setText(Messages.PointBoderParametersComposite_5);
Color tmpColor;
try {
tmpColor = Color.decode(symbolizersWrapper.getStrokeColor());
} catch (Exception e) {
tmpColor = Color.gray;
}
borderColorEditor = new StolenColorEditor(mainComposite, this);
borderColorEditor.setColor(tmpColor);