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

org.bonitasoft.web.designer.model.page.TabsContainer Maven / Gradle / Ivy

/** 
 * Copyright (C) 2015 BonitaSoft S.A.
 * BonitaSoft, 32 rue Gustave Eiffel - 38000 Grenoble
 * 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.0 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, see .
 */
package org.bonitasoft.web.designer.model.page;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.bonitasoft.web.designer.model.JsonViewPersistence;
import org.bonitasoft.web.designer.visitor.ElementVisitor;

import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonView;

@JsonTypeName("tabsContainer")
public class TabsContainer extends Component {

    @Deprecated
    private List tabs;

    private List tabList = new ArrayList<>();

    // We override this id to make import of old pages enable. We do this to fix faster.
    // It would be better to create a migration step for each page or widget
    // This migration step will be migrate all element before 1.4.21 to add id for each type tabsContainer.
    @Override
    public String getId() {
        return "pbTabsContainer";
    }

    @Deprecated
    @JsonView({ JsonViewPersistence.class })
    public List getTabs() {
        return tabs;
    }

    @Deprecated
    public void setTabs(List tabs) {
        tabs.forEach(tab -> {
            var newTabContainer = new TabContainer();
            this.tabList.add(newTabContainer.convert(tab));
        });
    }

    @JsonView({ JsonViewPersistence.class })
    public List getTabList() {
        return tabList;
    }

    public void setTabList(List tabList) {
        this.tabList = tabList;
    }

    @Override
    public  T accept(ElementVisitor visitor) {
        return visitor.visit(this);
    }

    @Override
    public boolean equals(final Object obj) {
        if (obj instanceof TabsContainer) {
            final TabsContainer other = (TabsContainer) obj;
            return new EqualsBuilder()
                    .append(tabs, other.tabs)
                    .isEquals();
        } else {
            return false;
        }
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(tabs)
                .toHashCode();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy