tb = new ToolBar();
ComponentHelper.setParent(this, tb);
if (sourceEditMode) {
tb.add(sourceEdit = createToggleButton(g.getSource(), m.getSourceEditTipText(), m.getSourceEditTipTitle()));
tb.add(new SeparatorToolItem());
}
if (getBasicFormatter() != null) {
if (enableFont) {
final SimpleComboBox<String> fonts = new SimpleComboBox<String>();
fonts.setTriggerAction(TriggerAction.ALL);
fonts.add("Arial");
fonts.add("Times New Roman");
fonts.add("Verdana");
fonts.setEditable(false);
fonts.setSimpleValue("Arial");
fonts.addSelectionChangedListener(new SelectionChangedListener<SimpleComboValue<String>>() {
@Override
public void selectionChanged(SelectionChangedEvent<SimpleComboValue<String>> se) {
getBasicFormatter().setFontName(fonts.getSimpleValue());
}
});
tb.add(fonts);
tb.add(new SeparatorToolItem());
}
if (enableFontSize) {
tb.add(increasefontsize = createButton(g.getFontIncrease(), m.getIncreaseFontSizeTipText(),
m.getIncreaseFontSizeTipTitle()));
tb.add(decreasefontsize = createButton(g.getFontDecrease(), m.getDecreaseFontSizeTipText(),
m.getDecreaseFontSizeTipTitle()));
tb.add(new SeparatorToolItem());
}
if (enableFormat) {
tb.add(bold = createToggleButton(g.getBold(), m.getBoldTipText(), m.getBoldTipTitle()));
tb.add(italic = createToggleButton(g.getItalic(), m.getItalicTipText(), m.getItalicTipTitle()));
tb.add(underline = createToggleButton(g.getUnderline(), m.getUnderlineTipText(), m.getUnderlineTipTitle()));
tb.add(new SeparatorToolItem());
}
if (enableAlignments) {
tb.add(justifyLeft = createButton(g.getJustifyLeft(), m.getJustifyLeftTipText(), m.getJustifyLeftTipTitle()));
tb.add(justifyCenter = createButton(g.getJustifyCenter(), m.getJustifyCenterTipText(),
m.getJustifyCenterTipTitle()));
tb.add(justifyRight = createButton(g.getJustifyRight(), m.getJustifyRightTipText(),
m.getJustifyRightTipTitle()));
tb.add(new SeparatorToolItem());
}
}
if (getExtendedFormatter() != null) {
if (enableLists) {
tb.add(ol = createButton(g.getOl(), m.getOlTipText(), m.getOlTipTitle()));
tb.add(ul = createButton(g.getUl(), m.getUlTipText(), m.getUlTipTitle()));
tb.add(new SeparatorToolItem());
}
if (enableLinks) {
tb.add(link = createButton(g.getLink(), m.getLinkTipText(), m.getLinkTipTitle()));
tb.add(new SeparatorToolItem());
}
if (enableColors) {
tb.add(forecolor = createColorButton(g.getFontColor(), m.getForeColorTipText(), m.getForColorTipTitle(),
new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {