piramide.interaction.reasoner.web.client.ui.common.widgets.PiramideStackPanel.java Source code

Java tutorial

Introduction

Here is the source code for piramide.interaction.reasoner.web.client.ui.common.widgets.PiramideStackPanel.java

Source

/*
 * Copyright (C) 2010 PIRAmIDE-SP3 authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * This software consists of contributions made by many individuals, 
 * listed below:
 *
 * Author: Aitor Almeida <aitor.almeida@deusto.es>
 *         Pablo Ordua <pablo.orduna@deusto.es>
 *         Eduardo Castillejo <eduardo.castillejo@deusto.es>
 *
 */
package piramide.interaction.reasoner.web.client.ui.common.widgets;

import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.StackPanel;
import com.google.gwt.user.client.ui.Widget;

public class PiramideStackPanel extends StackPanel {

    private String header = null;

    @Override
    public void add(Widget widget) {
        if (this.header == null) {
            this.header = ((HasText) widget).getText();
        } else {
            super.add(widget);
            setStackText(getWidgetCount() - 1, this.header, false);
            this.header = null;
        }
    }
}