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

com.citytechinc.cq.component.dialog.Dialog Maven / Gradle / Ivy

There is a newer version: 7.0.0
Show newest version
package com.citytechinc.cq.component.dialog;

import com.citytechinc.cq.component.dialog.tabpanel.TabPanel;
import com.citytechinc.cq.component.dialog.tabpanel.TabPanelParameters;
import com.citytechinc.cq.component.dialog.widgetcollection.WidgetCollection;
import com.citytechinc.cq.component.dialog.widgetcollection.WidgetCollectionParameters;

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

public class Dialog extends AbstractWidget {

    private final String title;

    private final String activeTab;

    private final String fileName;

    private final Integer width;

    private final Integer height;

    public Dialog(DialogParameters parameters) {
        super(parameters);
        this.title = parameters.getTitle();
        this.activeTab = "0";
        this.fileName = parameters.getFileName();
        this.height = parameters.getHeight();
        this.width = parameters.getWidth();
    }

    public static final List buildTabPanel(List tabs) {
        List containedElements = new ArrayList();
        WidgetCollectionParameters wcp = new WidgetCollectionParameters();
        wcp.setContainedElements(tabs);
        DialogElement tabPanelContainer = new WidgetCollection(wcp);

        TabPanelParameters tpp = new TabPanelParameters();
        tpp.setContainedElements(Arrays.asList(tabPanelContainer));
        DialogElement tabPanel = new TabPanel(tpp);

        WidgetCollectionParameters widgetCollectionForTabPanelParams = new WidgetCollectionParameters();
        widgetCollectionForTabPanelParams.setContainedElements(Arrays.asList(tabPanel));
        containedElements.add(new WidgetCollection(widgetCollectionForTabPanelParams));
        return containedElements;
    }

    public String getTitle() {
        return title;
    }

    public String getActiveTab() {
        return activeTab;
    }

    public String getFileName() {
        return fileName + ".xml";
    }

    public Integer getWidth() {
        return width;
    }

    public Integer getHeight() {
        return height;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy