}
});
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 ListBox fonts = new ListBox();
fonts.addItem("");
fonts.addItem("Arial");
fonts.addItem("Times New Roman");
fonts.addItem("Verdana");
fonts.setItemSelected(0, true);
fonts.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
int index = fonts.getSelectedIndex();
if (index != 0) {
getBasicFormatter().setFontName(fonts.getItemText(index));
}
fonts.setItemSelected(0, true);
}
});
tb.add(new WidgetComponent(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) {