}
}
});
toolBar.add(fonts);
toolBar.add(new SeparatorToolItem());
}
if (enableFontSize) {
fontIncrease = new TextButton();
configureButton(fontIncrease, appearance.fontIncrease(), m.increaseFontSizeTipTitle(),
m.increaseFontSizeTipText());
fontIncrease.addSelectHandler(buttonHandler);
toolBar.add(fontIncrease);
fontDecrease = new TextButton();
configureButton(fontDecrease, appearance.fontDecrease(), m.decreaseFontSizeTipTitle(),
m.decreaseFontSizeTipText());
fontDecrease.addSelectHandler(buttonHandler);
toolBar.add(fontDecrease);
toolBar.add(new SeparatorToolItem());
}
if (enableFormat) {
bold = new ToggleButton();
configureButton(bold, appearance.bold(), m.boldTipTitle(), m.boldTipText());
bold.addSelectHandler(buttonHandler);
toolBar.add(bold);
italic = new ToggleButton();
configureButton(italic, appearance.italic(), m.italicTipTitle(), m.italicTipText());
italic.addSelectHandler(buttonHandler);
toolBar.add(italic);
underline = new ToggleButton();
configureButton(underline, appearance.underline(), m.underlineTipTitle(), m.underlineTipText());
underline.addSelectHandler(buttonHandler);
toolBar.add(underline);
toolBar.add(new SeparatorToolItem());
}
if (enableAlignments) {
justifyLeft = new TextButton();
configureButton(justifyLeft, appearance.justifyLeft(), m.justifyLeftTipTitle(), m.justifyLeftTipText());
justifyLeft.addSelectHandler(buttonHandler);
toolBar.add(justifyLeft);
justifyCenter = new TextButton();
configureButton(justifyCenter, appearance.justifyCenter(), m.justifyCenterTipTitle(), m.justifyCenterTipText());
justifyCenter.addSelectHandler(buttonHandler);
toolBar.add(justifyCenter);
justifyRight = new TextButton();
configureButton(justifyRight, appearance.justifyRight(), m.justifyRightTipTitle(), m.justifyRightTipText());
justifyRight.addSelectHandler(buttonHandler);
toolBar.add(justifyRight);
toolBar.add(new SeparatorToolItem());
}
if (enableLists) {
ol = new TextButton();
configureButton(ol, appearance.ol(), m.olTipTitle(), m.olTipText());
ol.addSelectHandler(buttonHandler);
toolBar.add(ol);
ul = new TextButton();
configureButton(ul, appearance.ul(), m.ulTipTitle(), m.ulTipText());
ul.addSelectHandler(buttonHandler);
toolBar.add(ul);
toolBar.add(new SeparatorToolItem());
}
if (enableLinks) {
link = new TextButton();
configureButton(link, appearance.link(), m.linkTipTitle(), m.linkTipText());
link.addSelectHandler(buttonHandler);
toolBar.add(link);
toolBar.add(new SeparatorToolItem());
}
if (enableColors) {
fontColor = new TextButton();
configureButton(fontColor, appearance.fontColor(), m.foreColorTipTitle(), m.foreColorTipText());
final ColorMenu fontColorMenu = new ColorMenu();
fontColorMenu.setFocusOnShow(false);
fontColorMenu.getPalette().addValueChangeHandler(new ValueChangeHandler<String>() {
@Override
public void onValueChange(ValueChangeEvent<String> event) {
fontColorMenu.hide();
textArea.getFormatter().setForeColor(event.getValue());
}
});
fontColor.setMenu(fontColorMenu);
toolBar.add(fontColor);
fontHighlight = new TextButton();
configureButton(fontHighlight, appearance.fontHighlight(), m.backColorTipTitle(), m.backColorTipText());
final ColorMenu fontHighlightMenu = new ColorMenu();
fontHighlightMenu.setFocusOnShow(false);
fontHighlightMenu.getPalette().addValueChangeHandler(new ValueChangeHandler<String>() {
@Override
public void onValueChange(ValueChangeEvent<String> event) {
fontHighlightMenu.hide();
textArea.getFormatter().setBackColor(event.getValue());
}
});
fontHighlight.setMenu(fontHighlightMenu);
toolBar.add(fontHighlight);
}
if (enableSourceEditMode) {
toolBar.add(new SeparatorToolItem());
sourceEdit = new ToggleButton();
configureButton(sourceEdit, appearance.source(), m.sourceEditTipTitle(), m.sourceEditTipText());
sourceEdit.addSelectHandler(new SelectHandler() {
@Override