/*
* Copyright 2011 Philippe Blanc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package me.l1k3.ui.client;
import me.l1k3.fx.client.FXOpen;
import me.l1k3.fx.client.channel.inter.DimensionConstant;
import me.l1k3.fx.client.inter.FXShowAndHide;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
public class ShowAndHidePanelEx extends ShowAndHidePanel {
private Panel wrapper;
private Panel container;
public ShowAndHidePanelEx() {
this(true);
}
public ShowAndHidePanelEx(boolean visible) {
this(visible, new FXOpen(DimensionConstant.Direction.VERTICAL));
}
public ShowAndHidePanelEx(boolean visible, FXShowAndHide effect) {
super(visible, effect);
wrapper = new FlowPanel();
wrapper.setStyleName("wrapper");
add(wrapper);
}
public void addToWrapper(Widget widget) {
wrapper.add(widget);
}
public void addToContent(Widget widget) {
if(container==null) {
container = new VerticalPanel();
container.setStyleName("content");
wrapper.add(container);
}
container.add(widget);
}
public void addCloseButton(String title) {
Anchor close = createAnchor("close tab", "");
close.setStyleName("close");
addCloseButton(close);
}
public void addCloseButton(Widget close) {
wrapper.add(close);
HTML clear = new HTML();
clear.setStyleName("clear");
wrapper.add(clear);
}
}