001: /*
002: * Copyright (c) 2004-2006, Jean-François Brazeau. All rights reserved.
003: *
004: * Redistribution and use in source and binary forms, with or without
005: * modification, are permitted provided that the following conditions are met:
006: *
007: * 1. Redistributions of source code must retain the above copyright notice,
008: * this list of conditions and the following disclaimer.
009: *
010: * 2. Redistributions in binary form must reproduce the above copyright
011: * notice, this list of conditions and the following disclaimer in the
012: * documentation and/or other materials provided with the distribution.
013: *
014: * 3. The name of the author may not be used to endorse or promote products
015: * derived from this software without specific prior written permission.
016: *
017: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
018: * IMPLIEDWARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
019: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
020: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
021: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
022: * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
023: * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
024: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
025: * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
026: * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
027: */
028: package jfb.tools.activitymgr.ui.dialogs;
029:
030: import jfb.tools.activitymgr.core.beans.Collaborator;
031: import jfb.tools.activitymgr.core.beans.Task;
032:
033: import org.apache.log4j.Logger;
034: import org.eclipse.swt.SWT;
035: import org.eclipse.swt.layout.GridData;
036: import org.eclipse.swt.widgets.Composite;
037: import org.eclipse.swt.widgets.Control;
038: import org.eclipse.swt.widgets.Shell;
039:
040: /**
041: * Dialogue permettant d'afficher une liste de contriutions.
042: */
043: public class ContributionsViewerDialog extends AbstractDialog {
044:
045: /** Logger */
046: private static Logger log = Logger
047: .getLogger(ContributionsViewerDialog.class);
048:
049: /** Table contenant les données */
050: private ContributionsViewerTable contributionsTable;
051:
052: /** Filtre de recherche (stocké dans cet objet en attendant l'invocation du createDialogArea) */
053: private Task task;
054: private Collaborator contributor;
055: private Integer day;
056: private Integer month;
057: private Integer year;
058:
059: /**
060: * Constructeur par défaut.
061: * @param parentShell shell parent.
062: */
063: public ContributionsViewerDialog(Shell parentShell) {
064: super (parentShell, "Selected contributions", null, null);
065: setShellStyle(SWT.RESIZE | SWT.DIALOG_TRIM
066: | SWT.APPLICATION_MODAL);
067: }
068:
069: /* (non-Javadoc)
070: * @see jfb.tools.activitymgr.ui.util.AbstractDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
071: */
072: protected Control createDialogArea(Composite parent) {
073: log.debug("createDialogArea");
074: Composite c = (Composite) super .createDialogArea(parent);
075: GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
076: contributionsTable = new ContributionsViewerTable(c, gridData);
077: contributionsTable.setFilter(task, contributor, year, month,
078: day);
079: return c;
080: }
081:
082: /* (non-Javadoc)
083: * @see jfb.tools.activitymgr.ui.util.AbstractDialog#validateUserEntry()
084: */
085: protected Object validateUserEntry() throws DialogException {
086: // Ce dialogue n'a pas pour but d'effectuer une saisie.
087: return null;
088: }
089:
090: /**
091: * Initialise le filtre de recherche des contributions.
092: * @param task la tache.
093: * @param contributor le collaborateur.
094: * @param year l'année.
095: * @param month le mois.
096: * @param day le jour.
097: */
098: public void setFilter(Task task, Collaborator contributor,
099: Integer year, Integer month, Integer day) {
100: this.task = task;
101: this.contributor = contributor;
102: this.year = year;
103: this.month = month;
104: this.day = day;
105: }
106:
107: }
|