public void preApply() {
updateBlackboard();
}
private void updateBlackboard() {
StyleBlackboard styleBlackboard = getLayer().getStyleBlackboard();
style = (VectorLegendStyle) styleBlackboard.get(VectorLegendStyleContent.ID);
if (style == null) {
style = VectorLegendStyleContent.createDefault();
styleBlackboard.put(VectorLegendStyleContent.ID, style);
styleBlackboard.setSelected(new String[]{VectorLegendStyleContent.ID});
}
RGB bg = backgroundColour.getColorValue();
try {
int bAlpha = Integer.parseInt(backgroundAlphaText.getText());
style.backgroundColor = new Color(bg.red, bg.green, bg.blue, bAlpha);
} catch (Exception e) {
style.backgroundColor = new Color(bg.red, bg.green, bg.blue);
}
bg = foregroundColor.getColorValue();
try {
int fAlpha = Integer.parseInt(forgroundAlphaText.getText());
style.foregroundColor = new Color(bg.red, bg.green, bg.blue, fAlpha);
} catch (Exception e) {
style.foregroundColor = new Color(bg.red, bg.green, bg.blue);
}
bg = fontColour.getColorValue();
style.fontColor = new Color(bg.red, bg.green, bg.blue);
style.xPos = Integer.parseInt(xposText.getText());
style.yPos = Integer.parseInt(yposText.getText());
style.legendHeight = Integer.parseInt(legHeightText.getText());
style.legendWidth = Integer.parseInt(legWidthText.getText());
style.boxWidth = Integer.parseInt(boxWidthText.getText());
style.isRoundedRectangle = isroundedButton.getSelection();
styleBlackboard.put(VectorLegendStyleContent.ID, style);
}