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

com.publicobject.issuesbrowser.swing.CreationDateMatcherEditor Maven / Gradle / Ivy

/* Glazed Lists                                                 (c) 2003-2006 */
/* http://publicobject.com/glazedlists/                      publicobject.com,*/
/*                                                     O'Dell Engineering Ltd.*/
package com.publicobject.issuesbrowser.swing;

import ca.odell.glazedlists.Filterator;
import ca.odell.glazedlists.matchers.MatcherEditor;
import ca.odell.glazedlists.nachocalendar.NachoDateRangeMatcherEditor;
import com.publicobject.issuesbrowser.Issue;

import java.util.Date;
import java.util.List;

/**
 * This FilterComponent allows the user to specify a range of dates which
 * filters the Issues by their creation date. Only Issues created within the
 * specified range are considered a match.
 *
 * @author James Lemieux
 */
public class CreationDateMatcherEditor extends NachoDateRangeMatcherEditor implements FilterComponent {
    /** A Filterator which extracts the creation date from Issue objects. */
    private static final Filterator ISSUE_CREATION_DATE_FILTERATOR = new IssueCreationDateFilterator();

    public CreationDateMatcherEditor() {
        super(ISSUE_CREATION_DATE_FILTERATOR);
    }

    @Override
    public String toString() {
        return "Creation Date";
    }

    @Override
    public MatcherEditor getMatcherEditor() {
        return this;
    }

    /**
     * This Filterator extracts the creation date from each Issue object.
     */
    private static final class IssueCreationDateFilterator implements Filterator {
        @Override
        public void getFilterValues(List baseList, Issue element) {
            baseList.add(element.getCreationTimestamp());
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy