Java tutorial
/* Copyright (c) The m-m-m Team, Licensed under the Apache License, Version 2.0 * http://www.apache.org/licenses/LICENSE-2.0 */ package net.sf.mmm.client.ui.gwt.widgets.richtext; import net.sf.mmm.client.ui.api.common.RichTextFeature; import com.google.gwt.dom.client.Style; import com.google.gwt.dom.client.Style.FontWeight; /** * This is the implementation of {@link FeatureBehavior} for {@link RichTextFeature#BOLD}. * * @author Joerg Hohwiller (hohwille at users.sourceforge.net) * @since 1.0.0 */ class FeatureBehaviorBold extends AbstractToggleFeatureBehavior { /** * The constructor. * * @param richTextToolbar is the {@link RichTextToolbar} instance. */ FeatureBehaviorBold(RichTextToolbar richTextToolbar) { super(richTextToolbar); } /** * {@inheritDoc} */ @Override public RichTextFeature getFeature() { return RichTextFeature.BOLD; } /** * {@inheritDoc} */ @Override public Boolean getValue() { return Boolean.valueOf(getFormatter().isBold()); } /** * {@inheritDoc} */ @Override public void toggle() { getFormatter().toggleBold(); } /** * {@inheritDoc} */ @Override protected void updateFontSettings(boolean checked, Style style) { FontWeight weight; if (checked) { weight = FontWeight.BOLD; } else { weight = FontWeight.NORMAL; } style.setFontWeight(weight); } }