All Downloads are FREE. Search and download functionalities are using the official Maven repository.

eu.future.earth.gwt.client.ui.panels.ButtonFlowPanel Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2009 EasyEnterprise, all rights reserved.
 */
package eu.future.earth.gwt.client.ui.panels;

import java.util.ArrayList;
import java.util.Iterator;

import com.google.gwt.uibinder.client.UiConstructor;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.Widget;

public class ButtonFlowPanel extends BaseButtonPanel implements HasWidgets {

    private final FlowPanel buttonHolder = new FlowPanel();

    private final ArrayList buttons = new ArrayList();

    public ArrayList getButtons() {
        return buttons;
    }

    @UiConstructor
    public ButtonFlowPanel() {
        super();
        initWidget(buttonHolder);
        buttonHolder.setStyleName("ftr-buttons-flowpanel");
    }

    @Override
    public void clearButtons() {
        buttonHolder.clear();
        buttons.clear();
    }

    @Override
    public int numberOfButtons() {
        return buttons.size();
    }

    @Override
    public void addButton(Widget button) {
        if (button != null) {
            buttonHolder.add(button);
            buttons.add(button);
        }
    }

    @Override
    public void clear() {
        clearButtons();
    }

    @Override
    public void add(Widget w) {
        addButton(w);
    }

    @Override
    public Iterator iterator() {
        return buttons.iterator();
    }

    @Override
    public boolean remove(Widget w) {
        return buttons.remove(w);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy