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 */ 016package com.github.gwtbootstrap.client.ui.base; 017 018import com.google.gwt.dom.client.Element; 019import com.google.gwt.text.shared.testing.PassthroughParser; 020import com.google.gwt.text.shared.testing.PassthroughRenderer; 021 022/** 023 * Abstract base class for most text entry widgets. and Support boostrap style. 024 * 025 * @since 2.0.4.0 026 * @author ohashi keisuke 027 * @see com.google.gwt.user.client.ui.TextBoxBase 028 */ 029public class TextBoxBase extends ValueBoxBase<String> { 030 031 /** 032 * Creates a text box that wraps the given browser element handle. This is 033 * only used by subclasses. 034 * 035 * @param elem 036 * the browser element to wrap 037 */ 038 protected TextBoxBase(Element elem) { 039 super(elem, PassthroughRenderer.instance(), PassthroughParser.instance()); 040 } 041 042 /** 043 * Overridden to return "" from an empty text box. 044 */ 045 @Override 046 public String getValue() { 047 String raw = super.getValue(); 048 return raw == null 049 ? "" 050 : raw; 051 } 052 053}