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

org.valkyriercp.taskpane.TaskPaneNavigatorApplicationWindow Maven / Gradle / Ivy

There is a newer version: 1.3
Show newest version
package org.valkyriercp.taskpane;

import org.valkyriercp.application.ApplicationPage;
import org.valkyriercp.application.config.ApplicationConfig;
import org.valkyriercp.application.support.DefaultApplicationWindow;
import org.valkyriercp.command.support.AbstractCommand;
import org.valkyriercp.command.support.CommandGroup;

import javax.swing.*;

public class TaskPaneNavigatorApplicationWindow extends DefaultApplicationWindow
{
    private JSplitPane framedPage;

    private boolean onlyOneExpanded;

    private IconGenerator taskPaneIconGenerator;

    public TaskPaneNavigatorApplicationWindow(ApplicationConfig config) {
        super(config);
    }

    @Override
    protected JComponent createWindowContentPane()
    {
        CommandGroup navigationCommandGroup = getAdvisor()
                .getNavigationCommandGroup();
        TaskPaneNavigatorView taskPaneNavigatorView = new TaskPaneNavigatorView(navigationCommandGroup);
        taskPaneNavigatorView.setIconGenerator(getTaskPaneIconGenerator());
        taskPaneNavigatorView.setOnlyOneExpanded(onlyOneExpanded);

        framedPage = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, new JScrollPane(taskPaneNavigatorView.getControl(), JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER),
                null);
        framedPage.setOneTouchExpandable(false);

        return framedPage;
    }

    public boolean hasOnlyOneExpanded()
    {
        return onlyOneExpanded;
    }

    public void setOnlyOneExpanded(boolean onlyOneExpanded)
    {
        this.onlyOneExpanded = onlyOneExpanded;
    }

    @Override
    protected void setActivePage(ApplicationPage page)
    {
        framedPage.setRightComponent(page.getControl());
        framedPage.revalidate();
    }

    public IconGenerator getTaskPaneIconGenerator()
    {
        return taskPaneIconGenerator;
    }

    public void setTaskPaneIconGenerator(IconGenerator taskPaneIconGenerator)
    {
        this.taskPaneIconGenerator = taskPaneIconGenerator;
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy