toolbar = new ToolBar();
if (sourceEditMode) {
toolbar.add(sourceEdit = createToggleButton(getImages().getSource(), getMessages().getSourceEditTipText(),
getMessages().getSourceEditTipTitle()));
toolbar.add(new SeparatorToolItem());
}
if (getBasicFormatter() != null) {
if (enableFont) {
final ListBox listBox = new ListBox();
listBox.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
ListBox listBox = (ListBox) event.getSource();
getBasicFormatter().setFontName(listBox.getValue(listBox.getSelectedIndex()));
}
});
listBox.addItem("Arial");
listBox.addItem("Times New Roman");
listBox.addItem("Verdana");
toolbar.add(new WidgetComponent(listBox));
toolbar.add(new SeparatorToolItem());
}
if (enableFontSize) {
toolbar.add(increasefontsize = createButton(getImages().getFontIncrease(),
getMessages().getIncreaseFontSizeTipText(), getMessages().getIncreaseFontSizeTipTitle()));
toolbar.add(decreasefontsize = createButton(getImages().getFontDecrease(),
getMessages().getDecreaseFontSizeTipText(), getMessages().getDecreaseFontSizeTipTitle()));
toolbar.add(new SeparatorToolItem());
}
if (enableFormat) {
toolbar.add(bold = createToggleButton(getImages().getBold(), getMessages().getBoldTipText(),
getMessages().getBackColorTipTitle()));
toolbar.add(italic = createToggleButton(getImages().getItalic(), getMessages().getItalicTipText(),
getMessages().getItalicTipTitle()));
toolbar.add(underline = createToggleButton(getImages().getUnderline(), getMessages().getUnderlineTipText(),
getMessages().getUnderlineTipTitle()));
toolbar.add(new SeparatorToolItem());
}
if (enableAlignments) {
toolbar.add(justifyLeft = createButton(getImages().getJustifyLeft(), getMessages().getJustifyLeftTipText(),
getMessages().getJustifyLeftTipTitle()));
toolbar.add(justifyCenter = createButton(getImages().getJustifyCenter(),
getMessages().getJustifyCenterTipText(), getMessages().getJustifyCenterTipTitle()));
toolbar.add(justifyRight = createButton(getImages().getJustifyRight(),
getMessages().getJustifyRightTipText(), getMessages().getJustifyRightTipTitle()));
toolbar.add(new SeparatorToolItem());
}
}
if (getExtendedFormatter() != null) {
if (enableLists) {
toolbar.add(ol = createButton(getImages().getOl(), getMessages().getOlTipText(),
getMessages().getOlTipTitle()));
toolbar.add(ul = createButton(getImages().getUl(), getMessages().getUlTipText(),
getMessages().getUlTipTitle()));
toolbar.add(new SeparatorToolItem());
}
if (enableLinks) {
toolbar.add(link = createButton(getImages().getLink(), getMessages().getLinkTipText(),
getMessages().getLinkTipTitle()));
toolbar.add(new SeparatorToolItem());
}
if (enableColors) {
toolbar.add(forecolor = createColorButton(getImages().getFontColor(), getMessages().getForeColorTipText(),
getMessages().getForColorTipTitle(), new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {