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.DivWidget;
019 import com.github.gwtbootstrap.client.ui.constants.Constants;
020 import com.google.gwt.dom.client.Style;
021 import com.google.gwt.dom.client.Style.Unit;
022 import com.google.gwt.user.client.ui.Widget;
023
024 //@formatter:off
025 /**
026 * {@link NavList} in a {@link Well}.
027 *
028 * @since 2.0.4.0
029 *
030 * @author Dominik Mayer
031 */
032 //@formatter:on
033 public class WellNavList extends DivWidget {
034
035 private NavList navList = new NavList();
036
037 /**
038 * Creates an empty list.
039 */
040 public WellNavList() {
041 setStyleName(Constants.WELL);
042 super.add(navList);
043 setStyle();
044 }
045
046 private void setStyle() {
047 Style style = getElement().getStyle();
048 style.setPaddingTop(8, Unit.PX);
049 style.setPaddingBottom(8, Unit.PX);
050 style.setPaddingLeft(0, Unit.PX);
051 style.setPaddingRight(0, Unit.PX);
052 }
053
054 //TODO: Restrict type of widgets that can be added?
055 /**
056 * {@inheritDoc}
057 */
058 @Override
059 public void add(Widget child) {
060 navList.add(child);
061 }
062
063 /**
064 * {@inheritDoc}
065 */
066 @Override
067 public void insert(Widget w, int beforeIndex) {
068 navList.insert(w, beforeIndex);
069 }
070 }