// label alpha
Label labelOpactityLabel = new Label(mainComposite, SWT.NONE);
labelOpactityLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
labelOpactityLabel.setText(Messages.PointLabelsParametersComposite_5);
labelOpacitySpinner = new Spinner(mainComposite, SWT.BORDER);
labelOpacitySpinner.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
labelOpacitySpinner.setMaximum(100);
labelOpacitySpinner.setMinimum(0);
labelOpacitySpinner.setIncrement(10);
String opacity = textSymbolizerWrapper.getOpacity();
Double tmpOpacity = isDouble(opacity);
int tmp = 100;
if (tmpOpacity != null) {
tmp = (int) (tmpOpacity.doubleValue() * 100);
}
labelOpacitySpinner.setSelection(tmp);
labelOpacitySpinner.addSelectionListener(this);
labelOpacityAttributecombo = new Combo(mainComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
labelOpacityAttributecombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
labelOpacityAttributecombo.setItems(numericAttributesArrays);
labelOpacityAttributecombo.addSelectionListener(this);
labelOpacityAttributecombo.select(0);
if (tmpOpacity == null) {
int index = getAttributeIndex(opacity, numericAttributesArrays);
if (index != -1) {
labelOpacityAttributecombo.select(index);
}
}
// rotation
Label rotationLabel = new Label(mainComposite, SWT.NONE);
rotationLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
rotationLabel.setText(Messages.PointLabelsParametersComposite_6);
rotationSpinner = new Spinner(mainComposite, SWT.BORDER);
rotationSpinner.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
rotationSpinner.setMaximum(360);
rotationSpinner.setMinimum(-360);
rotationSpinner.setIncrement(45);
String rotationStr = textSymbolizerWrapper.getRotation();
Double tmpRotation = isDouble(rotationStr);
tmp = 0;
if (tmpRotation != null) {
tmp = tmpRotation.intValue();
}
rotationSpinner.setSelection(tmp);
rotationSpinner.addSelectionListener(this);
rotationAttributecombo = new Combo(mainComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
rotationAttributecombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
rotationAttributecombo.setItems(numericAttributesArrays);
rotationAttributecombo.addSelectionListener(this);
rotationAttributecombo.select(0);
if (tmpRotation == null) {
int index = getAttributeIndex(rotationStr, numericAttributesArrays);
if (index != -1) {
rotationAttributecombo.select(index);
}
}
// font
Label fontLabel = new Label(mainComposite, SWT.NONE);
fontLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
fontLabel.setText(Messages.PointLabelsParametersComposite_7);
fontEditor = new FontEditor(mainComposite);
GridData fontButtonGD = new GridData(SWT.FILL, SWT.FILL, true, false);
fontButtonGD.horizontalSpan = 2;
fontButton = fontEditor.getButton();
fontButton.setLayoutData(fontButtonGD);
fontEditor.setListener(this);
FontData[] fontData = textSymbolizerWrapper.getFontData();
if (fontData != null) {
fontEditor.setFontList(fontData);
}
// font color
Label fontColorLabel = new Label(mainComposite, SWT.NONE);
fontColorLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
fontColorLabel.setText(Messages.PointLabelsParametersComposite_8);
fontColorEditor = new StolenColorEditor(mainComposite, this);
fontColorButton = fontColorEditor.getButton();
GridData fontColorButtonGD = new GridData(SWT.FILL, SWT.CENTER, true, false);
fontColorButtonGD.horizontalSpan = 2;
fontColorButton.setLayoutData(fontColorButtonGD);
Color tmpColor = null;;
try {
tmpColor = Color.decode(textSymbolizerWrapper.getColor());
} catch (Exception e) {
tmpColor = Color.black;
}
fontColorEditor.setColor(tmpColor);
// label halo
Label haloLabel = new Label(mainComposite, SWT.NONE);
haloLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
haloLabel.setText(Messages.PointLabelsParametersComposite_9);
haloColorEditor = new StolenColorEditor(mainComposite, this);
haloColorButton = haloColorEditor.getButton();
GridData haloColorButtonGD = new GridData(SWT.FILL, SWT.CENTER, true, false);
haloColorButton.setLayoutData(haloColorButtonGD);
tmpColor = null;;
try {
tmpColor = Color.decode(textSymbolizerWrapper.getHaloColor());
} catch (Exception e) {
tmpColor = Color.black;
}
haloColorEditor.setColor(tmpColor);
haloRadiusSpinner = new Spinner(mainComposite, SWT.BORDER);
haloRadiusSpinner.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
haloRadiusSpinner.setMaximum(20);
haloRadiusSpinner.setMinimum(0);
haloRadiusSpinner.setIncrement(1);
String haloRadius = textSymbolizerWrapper.getHaloRadius();
Double tmpRadius = isDouble(haloRadius);
tmp = 0;
if (tmpRadius != null) {
tmp = tmpRadius.intValue();
}
haloRadiusSpinner.setSelection(tmp);
haloRadiusSpinner.addSelectionListener(this);
// anchor
Label anchorLabel = new Label(mainComposite, SWT.NONE);
anchorLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
anchorLabel.setText(Messages.PointLabelsParametersComposite_10);
anchorVerticalCombo = new Combo(mainComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
anchorVerticalCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
anchorVerticalCombo.setItems(Alignments.toVerticalStrings());
anchorVerticalCombo.addSelectionListener(this);
String anchorY = textSymbolizerWrapper.getAnchorY();
Alignments vertAlign = Alignments.verticalAlignmentfromDouble(anchorY);
anchorVerticalCombo.select(vertAlign.toIndex());
anchorHorizontalCombo = new Combo(mainComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
anchorHorizontalCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
anchorHorizontalCombo.setItems(Alignments.toHorizontalStrings());
anchorHorizontalCombo.addSelectionListener(this);
String anchorX = textSymbolizerWrapper.getAnchorX();
Alignments horAlign = Alignments.horizontalAlignmentfromDouble(anchorX);
anchorHorizontalCombo.select(horAlign.toIndex());
// displacement
Label displacementLabel = new Label(mainComposite, SWT.NONE);
displacementLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
displacementLabel.setText(Messages.PointLabelsParametersComposite_11);
String displacementX = textSymbolizerWrapper.getDisplacementX();
String displacementY = textSymbolizerWrapper.getDisplacementY();
Double tmpXdisplacement = Utilities.isNumber(displacementX, Double.class);
Double tmpYdisplacement = Utilities.isNumber(displacementY, Double.class);
if (tmpXdisplacement == null || tmpYdisplacement == null) {
tmpXdisplacement = 0.0;
tmpYdisplacement = 0.0;
}
xDisplacementSpinner = new Spinner(mainComposite, SWT.BORDER);
xDisplacementSpinner.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
xDisplacementSpinner.setMaximum(Utilities.DISPLACEMENT_MAX);
xDisplacementSpinner.setMinimum(Utilities.DISPLACEMENT_MIN);
xDisplacementSpinner.setIncrement(Utilities.DISPLACEMENT_STEP);
xDisplacementSpinner.setSelection((int) (10 * tmpXdisplacement));
xDisplacementSpinner.setDigits(1);
xDisplacementSpinner.addSelectionListener(this);
yDisplacementSpinner = new Spinner(mainComposite, SWT.BORDER);
yDisplacementSpinner.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
yDisplacementSpinner.setMaximum(Utilities.DISPLACEMENT_MAX);
yDisplacementSpinner.setMinimum(Utilities.DISPLACEMENT_MIN);
yDisplacementSpinner.setIncrement(Utilities.DISPLACEMENT_STEP);
yDisplacementSpinner.setSelection((int) (10 * tmpYdisplacement));