001package gwt.material.design.client.ui;
002
003/*
004 * #%L
005 * GwtMaterial
006 * %%
007 * Copyright (C) 2015 GwtMaterialDesign
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023import gwt.material.design.client.base.HasPosition;
024import gwt.material.design.client.base.mixin.CssNameMixin;
025import gwt.material.design.client.constants.HideOn;
026import gwt.material.design.client.constants.Position;
027import gwt.material.design.client.ui.html.ListItem;
028import gwt.material.design.client.ui.html.UnorderedList;
029
030import com.google.gwt.user.client.ui.Widget;
031
032//@formatter:off
033/**
034 *
035 * <p>Material NavSection is a child of MaterialNavBar that will contain toolbar items such as link, icon and other components
036 * <h3>UiBinder Usage:</h3>
037 *
038 * <pre>
039 * {@code
040 * <m:MaterialNavSection align="RIGHT">
041 *     <m:MaterialLink  iconType="ACCOUNT_CIRCLE" iconPosition="left" text="Account"  textColor="white" waves="LIGHT"/>
042 *     <m:MaterialLink  iconType="AUTORENEW" iconPosition="left" text="Refresh" textColor="white" waves="LIGHT"/>
043 *     <m:MaterialLink  iconType="SEARCH" tooltip="Menu" textColor="white" waves="LIGHT"/>
044 *     <m:MaterialLink  iconType="MORE_VERT" tooltip="Starter" textColor="white" waves="LIGHT"/>
045 * </m:MaterialNavSection>
046 * }
047 * </pre>
048 * </p>
049 *
050 * @author kevzlou7979
051 * @author Ben Dol
052 * @see <a href="http://gwt-material-demo.herokuapp.com/#navigations">Material NavSection</a>
053 */
054//@formatter:on
055public class MaterialNavSection extends UnorderedList implements HasPosition {
056
057    private final CssNameMixin<MaterialNavSection, Position> posMixin = new CssNameMixin<>(this);
058
059    /**
060     * Container for App Toolbar and App Sidebar , contains Material
061     * Links, Icons or any other material components.
062     */
063    public MaterialNavSection() {
064        super();
065        setHideOn(HideOn.HIDE_ON_MED_DOWN);
066    }
067
068    @Override
069    public void add(Widget child) {
070        super.add(new ListItem(child));
071    }
072
073    @Override
074    public Position getPosition() {
075        return posMixin.getCssName();
076    }
077
078    @Override
079    public void setPosition(Position position) {
080        posMixin.setCssName(position);
081    }
082}