<commit_before>/*
 * Copyright 2002-2004 the original author or 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.
 */
package org.springframework.richclient.application.support;

import java.awt.BorderLayout;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;

import javax.swing.JComponent;
import javax.swing.JPanel;

import org.springframework.richclient.application.Application;
import org.springframework.richclient.application.ApplicationPage;
import org.springframework.richclient.application.ApplicationPageDescriptor;
import org.springframework.richclient.application.ApplicationPageLayoutBuilder;
import org.springframework.richclient.application.ApplicationWindow;
import org.springframework.richclient.application.View;
import org.springframework.richclient.application.ViewDescriptor;
import org.springframework.richclient.application.ViewDescriptorRegistry;
import org.springframework.richclient.application.ViewListener;
import org.springframework.util.Assert;
import org.springframework.util.closure.support.AbstractConstraint;

/**
 * Provides a standard implementation of {@link ApplicationPage}
 */
public class DefaultApplicationPage implements ApplicationPage,
        ApplicationPageLayoutBuilder {

    private ApplicationPageDescriptor descriptor;

    private JComponent control;

    private ApplicationWindow window;

    private ViewDescriptorRegistry viewDescriptorRegistry;

    private Set viewPanes = new LinkedHashSet();

    private Set viewListeners = new LinkedHashSet();

    private ViewPane activeView;

    protected DefaultApplicationPage() {
        this.viewDescriptorRegistry = Application.services()
                .getViewDescriptorRegistry();
    }

    public DefaultApplicationPage(ApplicationWindow window,
            ApplicationPageDescriptor pageDescriptor) {
        this.viewDescriptorRegistry = Application.services()
                .getViewDescriptorRegistry();
        setApplicationWindow(window);
        setDescriptor(pageDescriptor);
    }

    public void setApplicationWindow(ApplicationWindow window) {
        Assert.notNull(window, "The containing window is required");
        Assert
                .state(this.window == null,
                        "Page window already set: it should only be set once, during initialization");
        this.window = window;
        addViewListener(new SharedCommandTargeter(this.window));
    }

    public void setDescriptor(ApplicationPageDescriptor descriptor) {
        Assert.notNull(descriptor, "The page's descriptor is required");
        Assert
                .state(
                        this.descriptor == null,
                        "Page descriptor already set: it should only be set once, during initialization");
        this.descriptor = descriptor;
    }

    public String getId() {
        return descriptor.getId();
    }

    public ApplicationWindow getApplicationWindow() {
        return window;
    }
<commit_msg>*** empty log message ***<commit_after>/*
 * Copyright 2002-2004 the original author or 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.
 */
package org.springframework.richclient.application.support;

import java.awt.BorderLayout;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;

import javax.swing.JComponent;
import javax.swing.JPanel;

import org.springframework.richclient.application.Application;
import org.springframework.richclient.application.ApplicationPage;
import org.springframework.richclient.application.ApplicationPageDescriptor;
import org.springframework.richclient.application.ApplicationPageLayoutBuilder;
import org.springframework.richclient.application.ApplicationWindow;
import org.springframework.richclient.application.View;
import org.springframework.richclient.application.ViewDescriptor;
import org.springframework.richclient.application.ViewDescriptorRegistry;
import org.springframework.richclient.application.ViewListener;
import org.springframework.util.Assert;
import org.springframework.util.closure.support.AbstractConstraint;

/**
 * Provides a standard implementation of {@link ApplicationPage}
 */
public class DefaultApplicationPage implements ApplicationPage,
        ApplicationPageLayoutBuilder {

    private ApplicationPageDescriptor descriptor;

    private JComponent control;

    private ApplicationWindow window;

    private ViewDescriptorRegistry viewDescriptorRegistry = Application
            .services().getViewDescriptorRegistry();

    private Set viewPanes = new LinkedHashSet();

    private Set viewListeners = new LinkedHashSet();

    private ViewPane activeView;

    protected DefaultApplicationPage() {
    }

    public DefaultApplicationPage(ApplicationWindow window,
            ApplicationPageDescriptor pageDescriptor) {
        setApplicationWindow(window);
        setDescriptor(pageDescriptor);
    }

    public void setApplicationWindow(ApplicationWindow window) {
        Assert.notNull(window, "The containing window is required");
        Assert
                .state(this.window == null,
                        "Page window already set: it should only be set once, during initialization");
        this.window = window;
        addViewListener(new SharedCommandTargeter(this.window));
    }

    public void setDescriptor(ApplicationPageDescriptor descriptor) {
        Assert.notNull(descriptor, "The page's descriptor is required");
        Assert
                .state(
                        this.descriptor == null,
                        "Page descriptor already set: it should only be set once, during initialization");
        this.descriptor = descriptor;
    }

    public String getId() {
        return descriptor.getId();
    }

    public ApplicationWindow getApplicationWindow() {
        return window;
    }

{'fraction_non_alphanumeric': 0.07305336832895888, 'fraction_numerical': 0.003499562554680665, 'mean_word_length': 3.7238292011019283, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2896673', 'n_tokens_mistral': 1570, 'n_tokens_neox': 1509, 'n_words': 484}