001 /* 002 * Copyright 2012 GWT-Bootstrap 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package com.github.gwtbootstrap.client.ui; 017 018 import com.github.gwtbootstrap.client.ui.base.AlertBase; 019 020 /** 021 * Simple Alert widget that uses bold text as a heading. 022 * <p> 023 * <h3>UiBinder Usage:</h3> 024 * <code>{@code <b:Alert heading="Warning." type="ERROR">Something went wrong...</b:Alert>}</code> 025 * </p> 026 * <p> 027 * All parameters are optional and map to the class's setters. 028 * </p> 029 * 030 * @since 2.0.4.0 031 * 032 * @author Dominik Mayer 033 * 034 * @see AlertBlock 035 * @see <a 036 * href="http://twitter.github.com/bootstrap/components.html#alerts">Bootstrap 037 * documentation</a> 038 */ 039 public class Alert extends AlertBase { 040 041 042 public Alert() { 043 super(""); 044 } 045 046 public Alert(String html) { 047 super(html); 048 } 049 050 /** 051 * Sets the text of an optional heading. It is wrapped in {@code <strong>} 052 * tags and placed before the text. 053 */ 054 @Override 055 public void setHeading(String text) { 056 if (text == null || text.isEmpty()) 057 super.setHeading(""); 058 else 059 super.setHeading("<strong>" + text + "</strong> "); 060 } 061 }