- "Done" checkbox in the table is painted in disabled state if a task cannot be marked as done.
- New option: Switch "Spent time", "Percent Complete" and "Effort" automatically to "Computed" if a subtask is added.
-Keyboard shortcuts for "Move Up" (Ctrl+Up) and "Move Down" (Ctrl+Down)</change>
- Bugfix for #68682 (filed for the dev build): Order is not preserved.
- Table cell editor for effort.
- New icon for the root node.
1.1 --- a/tasklist.editor/src/org/netbeans/modules/tasklist/editor/Bundle.properties Tue Dec 13 10:52:35 2005 +0000
1.2 +++ b/tasklist.editor/src/org/netbeans/modules/tasklist/editor/Bundle.properties Wed Dec 14 00:34:40 2005 +0000
1.3 @@ -14,10 +14,5 @@
1.4 OpenIDE-Module-Short-Description=This module adds editor integration to the tasklist module
1.5 OpenIDE-Module-Long-Description=This module adds editor integration to the tasklist module, by adding a "New Task" action in the editor context menu, and providing an annotation in the editor for highlighting editor-related tasks.
1.6
1.7 +## NewTaskEditorAction
1.8 new-todo-item=New Task...
1.9 -HINT_TASK=Tasks
1.10 -
1.11 -LBL_Goto=Go To Source
1.12 -
1.13 -FileNotFound=The associated file {0} could not be found
1.14 -NotInEditor=Cannot show {0} in the editor
2.1 --- a/tasklist.editor/src/org/netbeans/modules/tasklist/editor/TaskModule.java Tue Dec 13 10:52:35 2005 +0000
2.2 +++ b/tasklist.editor/src/org/netbeans/modules/tasklist/editor/TaskModule.java Wed Dec 14 00:34:40 2005 +0000
2.3 @@ -32,8 +32,8 @@
2.4
2.5 static final long serialVersionUID = -3935204626992817943L;
2.6
2.7 - /** Called at startup; adds my own localizer for translation
2.8 - @todo Use lookup instead of the above addTaskListener approach
2.9 + /**
2.10 + * Called at startup; adds my own localizer for translation
2.11 */
2.12 public void restored() {
2.13 LocaleSupport.addLocalizer(new NbLocalizer(NewTaskEditorAction.class));
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/tasklist.timerwin/build.xml Wed Dec 14 00:34:40 2005 +0000
3.3 @@ -0,0 +1,21 @@
3.4 +<?xml version="1.0" encoding="UTF-8"?>
3.5 +<project name="tasklist/timerwin" default="netbeans" basedir=".">
3.6 + <description>Builds, tests, and runs the project org.netbeans.modules.tasklist.timerwin</description>
3.7 + <import file="../../nbbuild/templates/projectized.xml"/>
3.8 +
3.9 + <target name="genc">
3.10 + <javah classpath="build/classes"
3.11 + class="org.netbeans.modules.tasklist.timerwin.AlwaysOnTop"
3.12 + destdir="native"/>
3.13 + </target>
3.14 +
3.15 + <target name="release" depends="init">
3.16 + <mkdir dir="${cluster}/modules/lib"/>
3.17 + <copy file="native/alwaysontop.dll" todir="${cluster}/modules/lib"/>
3.18 + </target>
3.19 +
3.20 + <target name="changelog">
3.21 + <style in="module-updates.xml" out="../www/updates/tasklist-timerwin.html"
3.22 + style="../www/updates/updates.xsl"/>
3.23 + </target>
3.24 +</project>
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/tasklist.timerwin/manifest.mf Wed Dec 14 00:34:40 2005 +0000
4.3 @@ -0,0 +1,6 @@
4.4 +Manifest-Version: 1.0
4.5 +OpenIDE-Module: org.netbeans.modules.tasklist.timerwin
4.6 +OpenIDE-Module-Implementation-Version: 1
4.7 +OpenIDE-Module-Layer: org/netbeans/modules/tasklist/timerwin/layer.xml
4.8 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/tasklist/timerwin/Bundle.properties
4.9 +
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/tasklist.timerwin/module-updates.xml Wed Dec 14 00:34:40 2005 +0000
5.3 @@ -0,0 +1,6 @@
5.4 +<updates>
5.5 + <update version="1.0.0.??? (NetBeans 5.0)">
5.6 + <change>Initial commit</change>
5.7 + </update>
5.8 +</updates>
5.9 +
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/tasklist.timerwin/native/createdll.bat Wed Dec 14 00:34:40 2005 +0000
6.3 @@ -0,0 +1,6 @@
6.4 +set PATH=%PATH%;C:\Programme\Microsoft Visual C++ Toolkit 2003\bin
6.5 +set INCLUDE=C:\Programme\Microsoft Visual C++ Toolkit 2003\include;C:\Programme\Microsoft Platform SDK\Include;C:\Programme\j2sdk1.4.2_09\include;C:\Programme\j2sdk1.4.2_09\include\win32
6.6 +set LIB=C:\Programme\Microsoft Platform SDK\Lib;C:\Programme\Microsoft Visual C++ Toolkit 2003\lib;C:\Programme\j2sdk1.4.2_09\lib
6.7 +
6.8 +cl.exe /LD org_netbeans_modules_tasklist_timerwin_AlwaysOnTop.cpp jawt.lib user32.lib
6.9 +pause
6.10 \ No newline at end of file
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/tasklist.timerwin/native/org_netbeans_modules_tasklist_timerwin_AlwaysOnTop.cpp Wed Dec 14 00:34:40 2005 +0000
7.3 @@ -0,0 +1,47 @@
7.4 +#define _WIN32_WINNT 0x500
7.5 +
7.6 +#include <assert.h>
7.7 +#include "windows.h"
7.8 +#include "jawt.h"
7.9 +#include "jawt_md.h"
7.10 +#include "jni.h"
7.11 +#include "org_netbeans_modules_tasklist_timerwin_AlwaysOnTop.h"
7.12 +
7.13 +JNIEXPORT jboolean JNICALL Java_org_netbeans_modules_tasklist_timerwin_AlwaysOnTop_setAlwaysOnTopWin32
7.14 + (JNIEnv * env, jclass clazz, jobject dialog) {
7.15 + jboolean jres = JNI_FALSE;
7.16 +
7.17 + // Get the AWT
7.18 + JAWT awt;
7.19 + awt.version = JAWT_VERSION_1_3;
7.20 + jboolean result = JAWT_GetAWT(env, &awt);
7.21 + if (result != JNI_FALSE) {
7.22 + // Get the drawing surface
7.23 + JAWT_DrawingSurface* ds = awt.GetDrawingSurface(env, dialog);
7.24 + if (ds != NULL) {
7.25 + // Lock the drawing surface
7.26 + jint lock = ds->Lock(ds);
7.27 + if ((lock & JAWT_LOCK_ERROR) == 0) {
7.28 + // Get the drawing surface info
7.29 + JAWT_DrawingSurfaceInfo* dsi = ds->GetDrawingSurfaceInfo(ds);
7.30 +
7.31 + // Get the platform-specific drawing info
7.32 + JAWT_Win32DrawingSurfaceInfo* dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
7.33 +
7.34 + HWND hwnd = dsi_win->hwnd;
7.35 + if (SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE))
7.36 + jres = JNI_TRUE;
7.37 +
7.38 + // Free the drawing surface info
7.39 + ds->FreeDrawingSurfaceInfo(dsi);
7.40 +
7.41 + // Unlock the drawing surface
7.42 + ds->Unlock(ds);
7.43 + }
7.44 +
7.45 + // Free the drawing surface
7.46 + awt.FreeDrawingSurface(ds);
7.47 + }
7.48 + }
7.49 + return jres;
7.50 +}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/tasklist.timerwin/native/org_netbeans_modules_tasklist_timerwin_AlwaysOnTop.h Wed Dec 14 00:34:40 2005 +0000
8.3 @@ -0,0 +1,24 @@
8.4 +/* DO NOT EDIT THIS FILE - it is machine generated */
8.5 +#include <jni.h>
8.6 +/* Header for class org_netbeans_modules_tasklist_timerwin_AlwaysOnTop */
8.7 +
8.8 +#ifndef _Included_org_netbeans_modules_tasklist_timerwin_AlwaysOnTop
8.9 +#define _Included_org_netbeans_modules_tasklist_timerwin_AlwaysOnTop
8.10 +#ifdef __cplusplus
8.11 +extern "C" {
8.12 +#endif
8.13 +/* Inaccessible static: libLoaded */
8.14 +/* Inaccessible static: setAlwaysOnTopMethod */
8.15 +/* Inaccessible static: class_00024javax_00024swing_00024JWindow */
8.16 +/*
8.17 + * Class: org_netbeans_modules_tasklist_timerwin_AlwaysOnTop
8.18 + * Method: setAlwaysOnTopWin32
8.19 + * Signature: (Ljavax/swing/JDialog;)Z
8.20 + */
8.21 +JNIEXPORT jboolean JNICALL Java_org_netbeans_modules_tasklist_timerwin_AlwaysOnTop_setAlwaysOnTopWin32
8.22 + (JNIEnv *, jclass, jobject);
8.23 +
8.24 +#ifdef __cplusplus
8.25 +}
8.26 +#endif
8.27 +#endif
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/tasklist.timerwin/nbproject/project.properties Wed Dec 14 00:34:40 2005 +0000
9.3 @@ -0,0 +1,14 @@
9.4 +# Sun Public License Notice
9.5 +#
9.6 +# The contents of this file are subject to the Sun Public License
9.7 +# Version 1.0 (the "License"). You may not use this file except in
9.8 +# compliance with the License. A copy of the License is available at
9.9 +# http://www.sun.com/
9.10 +#
9.11 +# The Original Code is NetBeans. The Initial Developer of the Original
9.12 +# Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
9.13 +# Microsystems, Inc. All Rights Reserved.
9.14 +
9.15 +nbm.homepage=http://tasklist.netbeans.org/updates/tasklist-timerwin.html
9.16 +extra.module.files=modules/lib/alwaysontop.dll
9.17 +spec.version.base=1.0.0
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/tasklist.timerwin/nbproject/project.xml Wed Dec 14 00:34:40 2005 +0000
10.3 @@ -0,0 +1,79 @@
10.4 +<?xml version="1.0" encoding="UTF-8"?>
10.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
10.6 + <type>org.netbeans.modules.apisupport.project</type>
10.7 + <configuration>
10.8 + <data xmlns="http://www.netbeans.org/ns/nb-module-project/2">
10.9 + <code-name-base>org.netbeans.modules.tasklist.timerwin</code-name-base>
10.10 + <module-dependencies>
10.11 + <dependency>
10.12 + <code-name-base>org.jdesktop.layout</code-name-base>
10.13 + <build-prerequisite/>
10.14 + <compile-dependency/>
10.15 + <run-dependency>
10.16 + <release-version>1</release-version>
10.17 + <specification-version>1.3</specification-version>
10.18 + </run-dependency>
10.19 + </dependency>
10.20 + <dependency>
10.21 + <code-name-base>org.netbeans.modules.tasklist.core</code-name-base>
10.22 + <build-prerequisite/>
10.23 + <compile-dependency/>
10.24 + <run-dependency>
10.25 + <release-version>2</release-version>
10.26 + <implementation-version/>
10.27 + </run-dependency>
10.28 + </dependency>
10.29 + <dependency>
10.30 + <code-name-base>org.netbeans.modules.tasklist.usertasks</code-name-base>
10.31 + <build-prerequisite/>
10.32 + <compile-dependency/>
10.33 + <run-dependency>
10.34 + <release-version>2</release-version>
10.35 + <implementation-version/>
10.36 + </run-dependency>
10.37 + </dependency>
10.38 + <dependency>
10.39 + <code-name-base>org.openide.dialogs</code-name-base>
10.40 + <build-prerequisite/>
10.41 + <compile-dependency/>
10.42 + <run-dependency>
10.43 + <specification-version>6.2</specification-version>
10.44 + </run-dependency>
10.45 + </dependency>
10.46 + <dependency>
10.47 + <code-name-base>org.openide.filesystems</code-name-base>
10.48 + <build-prerequisite/>
10.49 + <compile-dependency/>
10.50 + <run-dependency>
10.51 + <specification-version>6.2</specification-version>
10.52 + </run-dependency>
10.53 + </dependency>
10.54 + <dependency>
10.55 + <code-name-base>org.openide.options</code-name-base>
10.56 + <build-prerequisite/>
10.57 + <compile-dependency/>
10.58 + <run-dependency>
10.59 + <specification-version>6.2</specification-version>
10.60 + </run-dependency>
10.61 + </dependency>
10.62 + <dependency>
10.63 + <code-name-base>org.openide.util</code-name-base>
10.64 + <build-prerequisite/>
10.65 + <compile-dependency/>
10.66 + <run-dependency>
10.67 + <specification-version>6.5</specification-version>
10.68 + </run-dependency>
10.69 + </dependency>
10.70 + <dependency>
10.71 + <code-name-base>org.openide.windows</code-name-base>
10.72 + <build-prerequisite/>
10.73 + <compile-dependency/>
10.74 + <run-dependency>
10.75 + <specification-version>6.2</specification-version>
10.76 + </run-dependency>
10.77 + </dependency>
10.78 + </module-dependencies>
10.79 + <public-packages/>
10.80 + </data>
10.81 + </configuration>
10.82 +</project>
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/tasklist.timerwin/src/org/netbeans/modules/tasklist/timerwin/AllUserTasksTreeModel.java Wed Dec 14 00:34:40 2005 +0000
11.3 @@ -0,0 +1,81 @@
11.4 +/*
11.5 + * Sun Public License Notice
11.6 + *
11.7 + * The contents of this file are subject to the Sun Public License
11.8 + * Version 1.0 (the "License"). You may not use this file except in
11.9 + * compliance with the License. A copy of the License is available at
11.10 + * http://www.sun.com/
11.11 + *
11.12 + * The Original Code is NetBeans. The Initial Developer of the Original
11.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
11.14 + * Microsystems, Inc. All Rights Reserved.
11.15 + */
11.16 +
11.17 +package org.netbeans.modules.tasklist.timerwin;
11.18 +
11.19 +import javax.swing.tree.TreeModel;
11.20 +import org.netbeans.modules.tasklist.core.util.ObjectList;
11.21 +import org.netbeans.modules.tasklist.usertasks.UserTaskView;
11.22 +import org.netbeans.modules.tasklist.usertasks.UserTaskViewRegistry;
11.23 +import org.netbeans.modules.tasklist.usertasks.model.UserTaskList;
11.24 +
11.25 +/**
11.26 + * TreeModel for user tasks
11.27 + *
11.28 + * @author tl
11.29 + */
11.30 +public class AllUserTasksTreeModel implements TreeModel {
11.31 + private Object root = new Object();
11.32 + private UserTaskList[] utl;
11.33 +
11.34 + /**
11.35 + * Creates a new model for a task list.
11.36 + *
11.37 + * @param utl a task list
11.38 + */
11.39 + public AllUserTasksTreeModel() {
11.40 + UserTaskView[] all = UserTaskViewRegistry.getInstance().getAll();
11.41 + utl = new UserTaskList[all.length];
11.42 + for (int i = 0; i < all.length; i++) {
11.43 + utl[i] = all[i].getUserTaskList();
11.44 + }
11.45 + }
11.46 +
11.47 + public boolean isLeaf(Object node) {
11.48 + if (node == root)
11.49 + return false;
11.50 + else
11.51 + return ((ObjectList.Owner) node).getObjectList().size() == 0;
11.52 + }
11.53 +
11.54 + public int getChildCount(Object parent) {
11.55 + if (parent == root)
11.56 + return utl.length;
11.57 + else
11.58 + return ((ObjectList.Owner) parent).getObjectList().size();
11.59 + }
11.60 +
11.61 + public void valueForPathChanged(javax.swing.tree.TreePath path, Object newValue) {
11.62 + }
11.63 +
11.64 + public void removeTreeModelListener(javax.swing.event.TreeModelListener l) {
11.65 + }
11.66 +
11.67 + public void addTreeModelListener(javax.swing.event.TreeModelListener l) {
11.68 + }
11.69 +
11.70 + public Object getChild(Object parent, int index) {
11.71 + if (parent == root)
11.72 + return utl[index];
11.73 + else
11.74 + return ((ObjectList.Owner) parent).getObjectList().get(index);
11.75 + }
11.76 +
11.77 + public Object getRoot() {
11.78 + return root;
11.79 + }
11.80 +
11.81 + public int getIndexOfChild(Object parent, Object child) {
11.82 + return -1;
11.83 + }
11.84 +}
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/tasklist.timerwin/src/org/netbeans/modules/tasklist/timerwin/AlwaysOnTop.java Wed Dec 14 00:34:40 2005 +0000
12.3 @@ -0,0 +1,79 @@
12.4 +/*
12.5 + * Sun Public License Notice
12.6 + *
12.7 + * The contents of this file are subject to the Sun Public License
12.8 + * Version 1.0 (the "License"). You may not use this file except in
12.9 + * compliance with the License. A copy of the License is available at
12.10 + * http://www.sun.com/
12.11 + *
12.12 + * The Original Code is NetBeans. The Initial Developer of the Original
12.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
12.14 + * Microsystems, Inc. All Rights Reserved.
12.15 + */
12.16 +
12.17 +package org.netbeans.modules.tasklist.timerwin;
12.18 +
12.19 +import java.lang.reflect.InvocationTargetException;
12.20 +import java.lang.reflect.Method;
12.21 +import javax.swing.JDialog;
12.22 +import javax.swing.JWindow;
12.23 +
12.24 +/**
12.25 + * "Always on top" attribute for dialogs.
12.26 + *
12.27 + * @author tl
12.28 + */
12.29 +public class AlwaysOnTop {
12.30 + private static boolean libLoaded;
12.31 + private static Method setAlwaysOnTopMethod;
12.32 +
12.33 + static {
12.34 + try {
12.35 + setAlwaysOnTopMethod = JWindow.class.getDeclaredMethod(
12.36 + "setAlwaysOnTop", // NOI18N
12.37 + new Class[] {Boolean.TYPE});
12.38 + } catch (Throwable t) {
12.39 + // ignore
12.40 + }
12.41 +
12.42 + if (setAlwaysOnTopMethod == null) {
12.43 + try {
12.44 + System.loadLibrary("alwaysontop"); // NOI18N
12.45 + libLoaded = true;
12.46 + } catch (Throwable t) {
12.47 + libLoaded = false;
12.48 + }
12.49 + }
12.50 + }
12.51 +
12.52 + /**
12.53 + * Sets the "always on top" attribute for a dialog.
12.54 + * Works on JDK 5.0 or Win32.
12.55 + *
12.56 + * @param d a dialog
12.57 + * @return true = success
12.58 + */
12.59 + public static boolean setAlwaysOnTop(JDialog d) {
12.60 + if (setAlwaysOnTopMethod != null) {
12.61 + try {
12.62 + setAlwaysOnTopMethod.invoke(d, new Object[] {Boolean.TRUE});
12.63 + return true;
12.64 + } catch (Throwable ex) {
12.65 + // ignore
12.66 + }
12.67 + }
12.68 + if (libLoaded) {
12.69 + return setAlwaysOnTopWin32(d);
12.70 + }
12.71 +
12.72 + return false;
12.73 + }
12.74 +
12.75 + /**
12.76 + * Sets the "always on top" attribute for a dialog on win32
12.77 + *
12.78 + * @param d a dialog
12.79 + * @return true = success
12.80 + */
12.81 + private static native boolean setAlwaysOnTopWin32(JDialog d);
12.82 +}
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/tasklist.timerwin/src/org/netbeans/modules/tasklist/timerwin/Bundle.properties Wed Dec 14 00:34:40 2005 +0000
13.3 @@ -0,0 +1,28 @@
13.4 +#
13.5 +# Sun Public License Notice
13.6 +#
13.7 +# The contents of this file are subject to the Sun Public License
13.8 +# Version 1.0 (the "License"). You may not use this file except in
13.9 +# compliance with the License. A copy of the License is available at
13.10 +# http://www.sun.com/
13.11 +#
13.12 +# The Original Code is NetBeans. The Initial Developer of the Original
13.13 +# Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
13.14 +# Microsystems, Inc. All Rights Reserved.
13.15 +#
13.16 +
13.17 +## ShowViewAction
13.18 +CTL_ShowViewAction=Timer Window
13.19 +
13.20 +OpenIDE-Module-Display-Category=Task List
13.21 +OpenIDE-Module-Long-Description=\
13.22 + This module proved an always-on-top window where you can select current task easier than from a User Tasks window.
13.23 +## manifest.mf
13.24 +OpenIDE-Module-Name=Timer Window
13.25 +
13.26 +## UTChooserPanel
13.27 +ChooseTask=Choose Task
13.28 +
13.29 +## UserTaskListCellRenderer
13.30 +None=<none>
13.31 +OpenIDE-Module-Short-Description=Provides an always-on-top window for selected currently running task.
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/tasklist.timerwin/src/org/netbeans/modules/tasklist/timerwin/MoveWindowMouseListener.java Wed Dec 14 00:34:40 2005 +0000
14.3 @@ -0,0 +1,84 @@
14.4 +/*
14.5 + * Sun Public License Notice
14.6 + *
14.7 + * The contents of this file are subject to the Sun Public License
14.8 + * Version 1.0 (the "License"). You may not use this file except in
14.9 + * compliance with the License. A copy of the License is available at
14.10 + * http://www.sun.com/
14.11 + *
14.12 + * The Original Code is NetBeans. The Initial Developer of the Original
14.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
14.14 + * Microsystems, Inc. All Rights Reserved.
14.15 + */
14.16 +
14.17 +package org.netbeans.modules.tasklist.timerwin;
14.18 +
14.19 +import java.awt.Component;
14.20 +import java.awt.Point;
14.21 +import java.awt.Window;
14.22 +import java.awt.event.MouseAdapter;
14.23 +import java.awt.event.MouseEvent;
14.24 +import java.awt.event.MouseMotionListener;
14.25 +import javax.swing.SwingUtilities;
14.26 +
14.27 +/**
14.28 + * Dragging a window.
14.29 + *
14.30 + * @author tl
14.31 + */
14.32 +public class MoveWindowMouseListener extends MouseAdapter implements
14.33 + MouseMotionListener {
14.34 + private boolean mp;
14.35 + private Point p;
14.36 + private Component c;
14.37 +
14.38 + /**
14.39 + * Creates a new instance of MoveWindowMouseListener.
14.40 + *
14.41 + * @param c window where this component resides will be dragged.
14.42 + */
14.43 + public MoveWindowMouseListener(Component c) {
14.44 + this.c = c;
14.45 + c.addMouseListener(this);
14.46 + c.addMouseMotionListener(this);
14.47 + }
14.48 +
14.49 + public void mouseMoved(java.awt.event.MouseEvent e) {
14.50 + }
14.51 +
14.52 + public void mouseDragged(java.awt.event.MouseEvent e) {
14.53 + if (mp) {
14.54 + // TAUtils.LOGGER.fine(e.getPoint() + " " + p);
14.55 + Window w = SwingUtilities.windowForComponent(c);
14.56 + w.setLocation(w.getX() + (e.getX() - p.x),
14.57 + w.getY() + (e.getY() - p.y));
14.58 + }
14.59 + }
14.60 +
14.61 + public void mousePressed(java.awt.event.MouseEvent e) {
14.62 + if (e.getButton() == MouseEvent.BUTTON1) {
14.63 + mp = true;
14.64 + p = e.getPoint();
14.65 + draggingStarted();
14.66 + }
14.67 + }
14.68 +
14.69 + public void mouseReleased(java.awt.event.MouseEvent e) {
14.70 + if (e.getButton() == MouseEvent.BUTTON1) {
14.71 + mp = false;
14.72 + draggingFinished();
14.73 + }
14.74 + }
14.75 +
14.76 + /**
14.77 + * Will be called when the dragging was finished.
14.78 + */
14.79 + private void draggingFinished() {
14.80 + }
14.81 +
14.82 + /**
14.83 + * Will be called when the dragging was started.
14.84 + */
14.85 + private void draggingStarted() {
14.86 + }
14.87 +}
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
15.2 +++ b/tasklist.timerwin/src/org/netbeans/modules/tasklist/timerwin/ShowViewAction.java Wed Dec 14 00:34:40 2005 +0000
15.3 @@ -0,0 +1,63 @@
15.4 +/*
15.5 + * Sun Public License Notice
15.6 + *
15.7 + * The contents of this file are subject to the Sun Public License
15.8 + * Version 1.0 (the "License"). You may not use this file except in
15.9 + * compliance with the License. A copy of the License is available at
15.10 + * http://www.sun.com/
15.11 + *
15.12 + * The Original Code is NetBeans. The Initial Developer of the Original
15.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
15.14 + * Microsystems, Inc. All Rights Reserved.
15.15 + */
15.16 +
15.17 +package org.netbeans.modules.tasklist.timerwin;
15.18 +
15.19 +import java.awt.BorderLayout;
15.20 +import javax.swing.JDialog;
15.21 +import org.openide.util.HelpCtx;
15.22 +import org.openide.util.NbBundle;
15.23 +import org.openide.util.actions.CallableSystemAction;
15.24 +
15.25 +/**
15.26 + * Shows "running task" view.
15.27 + *
15.28 + * @author tl
15.29 + */
15.30 +public final class ShowViewAction extends CallableSystemAction {
15.31 + private static JDialog win;
15.32 +
15.33 + public void performAction() {
15.34 + if (win == null) {
15.35 + win = new JDialog();
15.36 + win.setUndecorated(true);
15.37 + new MoveWindowMouseListener(win.getContentPane());
15.38 + win.getContentPane().add(new TimeAccPanel(), BorderLayout.CENTER);
15.39 + win.pack();
15.40 + }
15.41 + win.setVisible(true);
15.42 + System.out.println(AlwaysOnTop.class.getName());
15.43 + AlwaysOnTop.setAlwaysOnTop(win);
15.44 + }
15.45 +
15.46 + public String getName() {
15.47 + return NbBundle.getMessage(ShowViewAction.class,
15.48 + "CTL_ShowViewAction"); // NOI18N
15.49 + }
15.50 +
15.51 + protected void initialize() {
15.52 + super.initialize();
15.53 + }
15.54 +
15.55 + protected String iconResource() {
15.56 + return "org/netbeans/modules/tasklist/timerwin/view.gif"; // NOI18N
15.57 + }
15.58 +
15.59 + public HelpCtx getHelpCtx() {
15.60 + return HelpCtx.DEFAULT_HELP;
15.61 + }
15.62 +
15.63 + protected boolean asynchronous() {
15.64 + return false;
15.65 + }
15.66 +}
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
16.2 +++ b/tasklist.timerwin/src/org/netbeans/modules/tasklist/timerwin/TAUtils.java Wed Dec 14 00:34:40 2005 +0000
16.3 @@ -0,0 +1,37 @@
16.4 +/*
16.5 + * Sun Public License Notice
16.6 + *
16.7 + * The contents of this file are subject to the Sun Public License
16.8 + * Version 1.0 (the "License"). You may not use this file except in
16.9 + * compliance with the License. A copy of the License is available at
16.10 + * http://www.sun.com/
16.11 + *
16.12 + * The Original Code is NetBeans. The Initial Developer of the Original
16.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
16.14 + * Microsystems, Inc. All Rights Reserved.
16.15 + */
16.16 +
16.17 +package org.netbeans.modules.tasklist.timerwin;
16.18 +
16.19 +import java.util.logging.Level;
16.20 +import java.util.logging.Logger;
16.21 +import org.netbeans.modules.tasklist.core.TLUtils;
16.22 +
16.23 +/**
16.24 + * Utilities.
16.25 + *
16.26 + * @author tl
16.27 + */
16.28 +public class TAUtils {
16.29 + public static final Logger LOGGER = TLUtils.getLogger(TAUtils.class);
16.30 +
16.31 + static {
16.32 + LOGGER.setLevel(Level.FINE);
16.33 + }
16.34 +
16.35 + /**
16.36 + * Creates a new instance of TAUtils
16.37 + */
16.38 + private TAUtils() {
16.39 + }
16.40 +}
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
17.2 +++ b/tasklist.timerwin/src/org/netbeans/modules/tasklist/timerwin/TimeAccPanel.form Wed Dec 14 00:34:40 2005 +0000
17.3 @@ -0,0 +1,84 @@
17.4 +<?xml version="1.0" encoding="UTF-8" ?>
17.5 +
17.6 +<Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
17.7 + <Properties>
17.8 + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
17.9 + <Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
17.10 + <EtchetBorder/>
17.11 + </Border>
17.12 + </Property>
17.13 + <Property name="opaque" type="boolean" value="false"/>
17.14 + </Properties>
17.15 + <AuxValues>
17.16 + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
17.17 + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
17.18 + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
17.19 + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
17.20 + <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,31,0,0,1,30"/>
17.21 + </AuxValues>
17.22 +
17.23 + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
17.24 + <Property name="alignment" type="int" value="0"/>
17.25 + <Property name="verticalGap" type="int" value="2"/>
17.26 + </Layout>
17.27 + <SubComponents>
17.28 + <Container class="javax.swing.JPanel" name="jPanel1">
17.29 + <Properties>
17.30 + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
17.31 + <Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
17.32 + <EtchetBorder/>
17.33 + </Border>
17.34 + </Property>
17.35 + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
17.36 + <Dimension value="[10, 22]"/>
17.37 + </Property>
17.38 + </Properties>
17.39 +
17.40 + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
17.41 + </Container>
17.42 + <Component class="javax.swing.JComboBox" name="jComboBoxTasks">
17.43 + <Properties>
17.44 + <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
17.45 + <StringArray count="4">
17.46 + <StringItem index="0" value="Item 1"/>
17.47 + <StringItem index="1" value="Item 2"/>
17.48 + <StringItem index="2" value="Item 3"/>
17.49 + <StringItem index="3" value="Item 4"/>
17.50 + </StringArray>
17.51 + </Property>
17.52 + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
17.53 + <Dimension value="[200, 22]"/>
17.54 + </Property>
17.55 + </Properties>
17.56 + <Events>
17.57 + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBoxTasksActionPerformed"/>
17.58 + </Events>
17.59 + </Component>
17.60 + <Component class="javax.swing.JButton" name="jButtonChoose">
17.61 + <Properties>
17.62 + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
17.63 + <Image iconType="3" name="/org/netbeans/modules/tasklist/timerwin/dots.gif"/>
17.64 + </Property>
17.65 + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
17.66 + <Dimension value="[22, 22]"/>
17.67 + </Property>
17.68 + </Properties>
17.69 + <Events>
17.70 + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonChooseActionPerformed"/>
17.71 + </Events>
17.72 + </Component>
17.73 + <Component class="javax.swing.JButton" name="jButtonClose">
17.74 + <Properties>
17.75 + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
17.76 + <Image iconType="3" name="/org/netbeans/modules/tasklist/timerwin/close.gif"/>
17.77 + </Property>
17.78 + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
17.79 + <Dimension value="[22, 22]"/>
17.80 + </Property>
17.81 + </Properties>
17.82 + <Events>
17.83 + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonCloseActionPerformed"/>
17.84 + </Events>
17.85 + </Component>
17.86 + </SubComponents>
17.87 +</Form>
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
18.2 +++ b/tasklist.timerwin/src/org/netbeans/modules/tasklist/timerwin/TimeAccPanel.java Wed Dec 14 00:34:40 2005 +0000
18.3 @@ -0,0 +1,278 @@
18.4 +/*
18.5 + * Sun Public License Notice
18.6 + *
18.7 + * The contents of this file are subject to the Sun Public License
18.8 + * Version 1.0 (the "License"). You may not use this file except in
18.9 + * compliance with the License. A copy of the License is available at
18.10 + * http://www.sun.com/
18.11 + *
18.12 + * The Original Code is NetBeans. The Initial Developer of the Original
18.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
18.14 + * Microsystems, Inc. All Rights Reserved.
18.15 + */
18.16 +
18.17 +package org.netbeans.modules.tasklist.timerwin;
18.18 +
18.19 +import java.beans.PropertyChangeEvent;
18.20 +import java.beans.PropertyChangeListener;
18.21 +import javax.swing.DefaultComboBoxModel;
18.22 +import javax.swing.SwingUtilities;
18.23 +import javax.swing.event.ChangeEvent;
18.24 +import javax.swing.event.ChangeListener;
18.25 +import org.netbeans.modules.tasklist.core.util.ObjectList;
18.26 +import org.netbeans.modules.tasklist.usertasks.UserTaskView;
18.27 +import org.netbeans.modules.tasklist.usertasks.UserTaskViewRegistry;
18.28 +import org.netbeans.modules.tasklist.usertasks.model.StartedUserTask;
18.29 +import org.netbeans.modules.tasklist.usertasks.model.UserTask;
18.30 +
18.31 +/**
18.32 + * Panel with running task.
18.33 + *
18.34 + * @author tl
18.35 + */
18.36 +public class TimeAccPanel extends javax.swing.JPanel {
18.37 + private PropertyChangeListener pcl;
18.38 + private ObjectList.Listener oll;
18.39 + private ChangeListener registryListener;
18.40 +
18.41 + /**
18.42 + * Creates new form TimeAccPanel
18.43 + */
18.44 + public TimeAccPanel() {
18.45 + initComponents();
18.46 +
18.47 + registryListener = new ChangeListener() {
18.48 + public void stateChanged(ChangeEvent e) {
18.49 + viewsChanged();
18.50 + }
18.51 + };
18.52 + UserTaskViewRegistry.getInstance().addChangeListener(
18.53 + registryListener);
18.54 +
18.55 + pcl = new PropertyChangeListener() {
18.56 + public void propertyChange(PropertyChangeEvent evt) {
18.57 + String n = evt.getPropertyName();
18.58 + if (n == UserTask.PROP_SPENT_TIME ||
18.59 + n == UserTask.PROP_PROGRESS)
18.60 + jComboBoxTasks.repaint();
18.61 + }
18.62 + };
18.63 +
18.64 + oll = new ObjectList.Listener() {
18.65 + public void listChanged(ObjectList.Event e) {
18.66 + if (e.getType() == ObjectList.Event.EVENT_REMOVED) {
18.67 + Object[] list = e.getObjects();
18.68 + for (int i = 0; i < list.length; i++) {
18.69 + int index = findUserTask((UserTask) list[i]);
18.70 + if (index >= 0)
18.71 + removeUserTask(index);
18.72 + }
18.73 + }
18.74 + }
18.75 + };
18.76 +
18.77 + StartedUserTask.getInstance().addChangeListener(new ChangeListener() {
18.78 + public void stateChanged(ChangeEvent e) {
18.79 + startedTaskChanged();
18.80 + }
18.81 + });
18.82 +
18.83 + DefaultComboBoxModel m = new DefaultComboBoxModel();
18.84 + m.addElement(null);
18.85 + jComboBoxTasks.setModel(m);
18.86 +
18.87 + UserTask ut = StartedUserTask.getInstance().getStarted();
18.88 + if (ut != null) {
18.89 + addUserTask(ut);
18.90 + jComboBoxTasks.setSelectedIndex(1);
18.91 + }
18.92 +
18.93 + jComboBoxTasks.setRenderer(new UserTaskListCellRenderer());
18.94 + }
18.95 +
18.96 + /**
18.97 + * A task was stopped or started.
18.98 + */
18.99 + private void startedTaskChanged() {
18.100 + UserTask started = StartedUserTask.getInstance().getStarted();
18.101 + if (started == null) {
18.102 + jComboBoxTasks.setSelectedIndex(0);
18.103 + } else {
18.104 + DefaultComboBoxModel m =
18.105 + (DefaultComboBoxModel) jComboBoxTasks.getModel();
18.106 + int index = findUserTask(started);
18.107 + if (index < 0) {
18.108 + addUserTask(started);
18.109 + index = 1;
18.110 + }
18.111 + jComboBoxTasks.setSelectedIndex(index);
18.112 + }
18.113 + }
18.114 +
18.115 + /**
18.116 + * A view was closed or opened.
18.117 + */
18.118 + private void viewsChanged() {
18.119 + DefaultComboBoxModel m =
18.120 + (DefaultComboBoxModel) jComboBoxTasks.getModel();
18.121 + for (int i = 0; i < m.getSize(); ) {
18.122 + UserTask ut = (UserTask) m.getElementAt(i);
18.123 + if (ut == null) {
18.124 + i++;
18.125 + continue;
18.126 + }
18.127 +
18.128 + if (ut.getList() == null) {
18.129 + removeUserTask(i);
18.130 + continue;
18.131 + }
18.132 +
18.133 + UserTaskView utv = UserTaskViewRegistry.getInstance().
18.134 + findView(ut.getList().getFile());
18.135 + if (utv == null) {
18.136 + removeUserTask(i);
18.137 + continue;
18.138 + }
18.139 +
18.140 + i++;
18.141 + }
18.142 + }
18.143 +
18.144 + /**
18.145 + * Removes a task from the combobox.
18.146 + *
18.147 + * @param index index of the task
18.148 + */
18.149 + private void removeUserTask(int index) {
18.150 + DefaultComboBoxModel m =
18.151 + (DefaultComboBoxModel) jComboBoxTasks.getModel();
18.152 + UserTask ut = (UserTask) m.getElementAt(index);
18.153 + ut.removePropertyChangeListener(pcl);
18.154 + if (ut.getParent() != null)
18.155 + ut.getParent().getSubtasks().removeListener(oll);
18.156 + if (ut.getList() != null)
18.157 + ut.getList().getSubtasks().removeListener(oll);
18.158 + m.removeElementAt(index);
18.159 + }
18.160 +
18.161 + /**
18.162 + * Adds a task to the combobox.
18.163 + *
18.164 + * @param ut a task
18.165 + */
18.166 + private void addUserTask(UserTask ut) {
18.167 + DefaultComboBoxModel m =
18.168 + (DefaultComboBoxModel) jComboBoxTasks.getModel();
18.169 + m.insertElementAt(ut, 1);
18.170 + ut.addPropertyChangeListener(pcl);
18.171 + if (ut.getParent() != null)
18.172 + ut.getParent().getSubtasks().addListener(oll);
18.173 + else
18.174 + ut.getList().getSubtasks().addListener(oll);
18.175 + }
18.176 +
18.177 + /**
18.178 + * Searches a UT in the combo box.
18.179 + *
18.180 + * @param ut a task
18.181 + * @return it's index or -1
18.182 + */
18.183 + private int findUserTask(UserTask ut) {
18.184 + DefaultComboBoxModel m =
18.185 + (DefaultComboBoxModel) jComboBoxTasks.getModel();
18.186 + int index = -1;
18.187 + for (int i = 0; i < m.getSize(); i++) {
18.188 + if (m.getElementAt(i) == ut) {
18.189 + index = i;
18.190 + break;
18.191 + }
18.192 + }
18.193 + return index;
18.194 + }
18.195 +
18.196 + /** This method is called from within the constructor to
18.197 + * initialize the form.
18.198 + * WARNING: Do NOT modify this code. The content of this method is
18.199 + * always regenerated by the Form Editor.
18.200 + */
18.201 + // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
18.202 + private void initComponents() {
18.203 + jPanel1 = new javax.swing.JPanel();
18.204 + jComboBoxTasks = new javax.swing.JComboBox();
18.205 + jButtonChoose = new javax.swing.JButton();
18.206 + jButtonClose = new javax.swing.JButton();
18.207 +
18.208 + setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 2));
18.209 +
18.210 + setBorder(javax.swing.BorderFactory.createEtchedBorder());
18.211 + setOpaque(false);
18.212 + jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
18.213 + jPanel1.setPreferredSize(new java.awt.Dimension(10, 22));
18.214 + add(jPanel1);
18.215 +
18.216 + jComboBoxTasks.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
18.217 + jComboBoxTasks.setPreferredSize(new java.awt.Dimension(200, 22));
18.218 + jComboBoxTasks.addActionListener(new java.awt.event.ActionListener() {
18.219 + public void actionPerformed(java.awt.event.ActionEvent evt) {
18.220 + jComboBoxTasksActionPerformed(evt);
18.221 + }
18.222 + });
18.223 +
18.224 + add(jComboBoxTasks);
18.225 +
18.226 + jButtonChoose.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/tasklist/timerwin/dots.gif")));
18.227 + jButtonChoose.setPreferredSize(new java.awt.Dimension(22, 22));
18.228 + jButtonChoose.addActionListener(new java.awt.event.ActionListener() {
18.229 + public void actionPerformed(java.awt.event.ActionEvent evt) {
18.230 + jButtonChooseActionPerformed(evt);
18.231 + }
18.232 + });
18.233 +
18.234 + add(jButtonChoose);
18.235 +
18.236 + jButtonClose.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/tasklist/timerwin/close.gif")));
18.237 + jButtonClose.setPreferredSize(new java.awt.Dimension(22, 22));
18.238 + jButtonClose.addActionListener(new java.awt.event.ActionListener() {
18.239 + public void actionPerformed(java.awt.event.ActionEvent evt) {
18.240 + jButtonCloseActionPerformed(evt);
18.241 + }
18.242 + });
18.243 +
18.244 + add(jButtonClose);
18.245 +
18.246 + }// </editor-fold>//GEN-END:initComponents
18.247 +
18.248 + private void jComboBoxTasksActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxTasksActionPerformed
18.249 + Object sel = jComboBoxTasks.getSelectedItem();
18.250 + if (sel instanceof UserTask) {
18.251 + if (StartedUserTask.getInstance().getStarted() != null)
18.252 + StartedUserTask.getInstance().start(null);
18.253 + StartedUserTask.getInstance().start((UserTask) sel);
18.254 + } else {
18.255 + if (StartedUserTask.getInstance().getStarted() != null)
18.256 + StartedUserTask.getInstance().start(null);
18.257 + }
18.258 + }//GEN-LAST:event_jComboBoxTasksActionPerformed
18.259 +
18.260 + private void jButtonChooseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonChooseActionPerformed
18.261 + UserTask ut = UTChooserPanel.choose();
18.262 + if (ut != null) {
18.263 + if (StartedUserTask.getInstance().getStarted() != null)
18.264 + StartedUserTask.getInstance().start(null);
18.265 + StartedUserTask.getInstance().start(ut);
18.266 + }
18.267 + }//GEN-LAST:event_jButtonChooseActionPerformed
18.268 +
18.269 + private void jButtonCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCloseActionPerformed
18.270 + SwingUtilities.getWindowAncestor(this).setVisible(false);
18.271 + }//GEN-LAST:event_jButtonCloseActionPerformed
18.272 +
18.273 +
18.274 + // Variables declaration - do not modify//GEN-BEGIN:variables
18.275 + private javax.swing.JButton jButtonChoose;
18.276 + private javax.swing.JButton jButtonClose;
18.277 + private javax.swing.JComboBox jComboBoxTasks;
18.278 + private javax.swing.JPanel jPanel1;
18.279 + // End of variables declaration//GEN-END:variables
18.280 +
18.281 +}
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
19.2 +++ b/tasklist.timerwin/src/org/netbeans/modules/tasklist/timerwin/UTChooserPanel.form Wed Dec 14 00:34:40 2005 +0000
19.3 @@ -0,0 +1,48 @@
19.4 +<?xml version="1.0" encoding="UTF-8" ?>
19.5 +
19.6 +<Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
19.7 + <AuxValues>
19.8 + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
19.9 + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
19.10 + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
19.11 + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
19.12 + <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,117,0,0,1,99"/>
19.13 + </AuxValues>
19.14 +
19.15 + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
19.16 + <SubComponents>
19.17 + <Container class="javax.swing.JScrollPane" name="jScrollPane1">
19.18 + <AuxValues>
19.19 + <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
19.20 + </AuxValues>
19.21 + <Constraints>
19.22 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
19.23 + <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="11" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
19.24 + </Constraint>
19.25 + </Constraints>
19.26 +
19.27 + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
19.28 + <SubComponents>
19.29 + <Component class="javax.swing.JTree" name="jTree">
19.30 + <Properties>
19.31 + <Property name="rootVisible" type="boolean" value="false"/>
19.32 + <Property name="showsRootHandles" type="boolean" value="true"/>
19.33 + </Properties>
19.34 + <Events>
19.35 + <EventHandler event="valueChanged" listener="javax.swing.event.TreeSelectionListener" parameters="javax.swing.event.TreeSelectionEvent" handler="jTreeValueChanged"/>
19.36 + </Events>
19.37 + </Component>
19.38 + </SubComponents>
19.39 + </Container>
19.40 + <Component class="javax.swing.JLabel" name="jLabel1">
19.41 + <Properties>
19.42 + <Property name="text" type="java.lang.String" value=" "/>
19.43 + </Properties>
19.44 + <Constraints>
19.45 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
19.46 + <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
19.47 + </Constraint>
19.48 + </Constraints>
19.49 + </Component>
19.50 + </SubComponents>
19.51 +</Form>
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
20.2 +++ b/tasklist.timerwin/src/org/netbeans/modules/tasklist/timerwin/UTChooserPanel.java Wed Dec 14 00:34:40 2005 +0000
20.3 @@ -0,0 +1,171 @@
20.4 +/*
20.5 + * Sun Public License Notice
20.6 + *
20.7 + * The contents of this file are subject to the Sun Public License
20.8 + * Version 1.0 (the "License"). You may not use this file except in
20.9 + * compliance with the License. A copy of the License is available at
20.10 + * http://www.sun.com/
20.11 + *
20.12 + * The Original Code is NetBeans. The Initial Developer of the Original
20.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
20.14 + * Microsystems, Inc. All Rights Reserved.
20.15 + */
20.16 +
20.17 +package org.netbeans.modules.tasklist.timerwin;
20.18 +
20.19 +import java.awt.Dialog;
20.20 +import java.awt.Dimension;
20.21 +import java.awt.Image;
20.22 +import javax.swing.ImageIcon;
20.23 +import javax.swing.border.EmptyBorder;
20.24 +import javax.swing.tree.DefaultTreeCellRenderer;
20.25 +import javax.swing.tree.TreePath;
20.26 +import org.netbeans.modules.tasklist.usertasks.model.UserTask;
20.27 +import org.netbeans.modules.tasklist.usertasks.model.UserTaskList;
20.28 +import org.netbeans.modules.tasklist.usertasks.renderers.UserTaskIconProvider;
20.29 +import org.openide.DialogDescriptor;
20.30 +import org.openide.DialogDisplayer;
20.31 +import org.openide.filesystems.FileUtil;
20.32 +import org.openide.util.NbBundle;
20.33 +import org.openide.util.Utilities;
20.34 +
20.35 +/**
20.36 + * Chooser for a user task.
20.37 + *
20.38 + * @author tl
20.39 + */
20.40 +public class UTChooserPanel extends javax.swing.JPanel {
20.41 + /**
20.42 + * Tree cell renderer for user tasks
20.43 + */
20.44 + private static class MyTreeCellRenderer extends DefaultTreeCellRenderer {
20.45 + private ImageIcon icon = new ImageIcon();
20.46 +
20.47 + public java.awt.Component getTreeCellRendererComponent(
20.48 + javax.swing.JTree tree, Object value, boolean sel, boolean expanded,
20.49 + boolean leaf, int row, boolean hasFocus) {
20.50 +
20.51 + super.getTreeCellRendererComponent(
20.52 + tree, value, sel, expanded, leaf, row, hasFocus);
20.53 + if (value instanceof UserTask) {
20.54 + UserTask ut = (UserTask) value;
20.55 + this.setText(ut.getSummary());
20.56 + this.setIcon(icon);
20.57 +
20.58 + icon.setImage(UserTaskIconProvider.getUserTaskImage(ut, false));
20.59 + } else if (value instanceof UserTaskList) {
20.60 + UserTaskList utl = (UserTaskList) value;
20.61 + this.setText(FileUtil.getFileDisplayName(utl.getFile()));
20.62 + this.setIcon(icon);
20.63 + icon.setImage(UserTaskIconProvider.getUserTaskListImage());
20.64 + }
20.65 +
20.66 + return this;
20.67 + }
20.68 + }
20.69 +
20.70 + /**
20.71 + * Shows a dialog for choosing a task.
20.72 + *
20.73 + * @return choosed task or null if cancelled
20.74 + */
20.75 + public static UserTask choose() {
20.76 + UTChooserPanel dp = new UTChooserPanel();
20.77 + dp.setBorder(new EmptyBorder(11, 11, 12, 12));
20.78 + DialogDescriptor dd = new DialogDescriptor(dp,
20.79 + NbBundle.getMessage(
20.80 + UTChooserPanel.class, "ChooseTask")); // NOI18N
20.81 + dp.dd = dd;
20.82 + dd.setValid(false);
20.83 + Dialog d = DialogDisplayer.getDefault().createDialog(dd);
20.84 + d.setBounds(Utilities.findCenterBounds(new Dimension(400, 400)));
20.85 + d.show();
20.86 + if (dd.getValue() == DialogDescriptor.OK_OPTION) {
20.87 + return dp.getSelectedUserTask();
20.88 + } else {
20.89 + return null;
20.90 + }
20.91 + }
20.92 +
20.93 + private DialogDescriptor dd;
20.94 +
20.95 + /**
20.96 + * Creates new form UTChooserPanel
20.97 + */
20.98 + public UTChooserPanel() {
20.99 + initComponents();
20.100 + jTree.setCellRenderer(new MyTreeCellRenderer());
20.101 + jTree.setModel(new AllUserTasksTreeModel());
20.102 + }
20.103 +
20.104 + /**
20.105 + * Returns selected user task or null.
20.106 + *
20.107 + * @return selected user task or null
20.108 + */
20.109 + public UserTask getSelectedUserTask() {
20.110 + TreePath tp = jTree.getSelectionPath();
20.111 + if (tp == null)
20.112 + return null;
20.113 + Object obj = tp.getLastPathComponent();
20.114 + if (obj instanceof UserTask)
20.115 + return (UserTask) obj;
20.116 + else
20.117 + return null;
20.118 + }
20.119 +
20.120 + /**
20.121 + * This method is called from within the constructor to
20.122 + * initialize the form.
20.123 + * WARNING: Do NOT modify this code. The content of this method is
20.124 + * always regenerated by the Form Editor.
20.125 + */
20.126 + // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
20.127 + private void initComponents() {
20.128 + java.awt.GridBagConstraints gridBagConstraints;
20.129 +
20.130 + jScrollPane1 = new javax.swing.JScrollPane();
20.131 + jTree = new javax.swing.JTree();
20.132 + jLabel1 = new javax.swing.JLabel();
20.133 +
20.134 + setLayout(new java.awt.GridBagLayout());
20.135 +
20.136 + jTree.setRootVisible(false);
20.137 + jTree.setShowsRootHandles(true);
20.138 + jTree.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
20.139 + public void valueChanged(javax.swing.event.TreeSelectionEvent evt) {
20.140 + jTreeValueChanged(evt);
20.141 + }
20.142 + });
20.143 +
20.144 + jScrollPane1.setViewportView(jTree);
20.145 +
20.146 + gridBagConstraints = new java.awt.GridBagConstraints();
20.147 + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
20.148 + gridBagConstraints.weightx = 1.0;
20.149 + gridBagConstraints.weighty = 1.0;
20.150 + gridBagConstraints.insets = new java.awt.Insets(0, 0, 11, 0);
20.151 + add(jScrollPane1, gridBagConstraints);
20.152 +
20.153 + jLabel1.setText(" ");
20.154 + gridBagConstraints = new java.awt.GridBagConstraints();
20.155 + gridBagConstraints.gridx = 0;
20.156 + gridBagConstraints.gridy = 1;
20.157 + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
20.158 + add(jLabel1, gridBagConstraints);
20.159 +
20.160 + }// </editor-fold>//GEN-END:initComponents
20.161 +
20.162 + private void jTreeValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_jTreeValueChanged
20.163 + UserTask ut = getSelectedUserTask();
20.164 + dd.setValid(ut != null && ut.isStartable() && !ut.isStarted());
20.165 + }//GEN-LAST:event_jTreeValueChanged
20.166 +
20.167 +
20.168 + // Variables declaration - do not modify//GEN-BEGIN:variables
20.169 + private javax.swing.JLabel jLabel1;
20.170 + private javax.swing.JScrollPane jScrollPane1;
20.171 + private javax.swing.JTree jTree;
20.172 + // End of variables declaration//GEN-END:variables
20.173 +
20.174 +}
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
21.2 +++ b/tasklist.timerwin/src/org/netbeans/modules/tasklist/timerwin/UserTaskListCellRenderer.java Wed Dec 14 00:34:40 2005 +0000
21.3 @@ -0,0 +1,67 @@
21.4 +/*
21.5 + * Sun Public License Notice
21.6 + *
21.7 + * The contents of this file are subject to the Sun Public License
21.8 + * Version 1.0 (the "License"). You may not use this file except in
21.9 + * compliance with the License. A copy of the License is available at
21.10 + * http://www.sun.com/
21.11 + *
21.12 + * The Original Code is NetBeans. The Initial Developer of the Original
21.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
21.14 + * Microsystems, Inc. All Rights Reserved.
21.15 + */
21.16 +
21.17 +package org.netbeans.modules.tasklist.timerwin;
21.18 +
21.19 +import java.awt.Component;
21.20 +import javax.swing.DefaultListCellRenderer;
21.21 +import javax.swing.ImageIcon;
21.22 +import javax.swing.JList;
21.23 +import org.netbeans.modules.tasklist.usertasks.Settings;
21.24 +import org.netbeans.modules.tasklist.usertasks.model.Duration;
21.25 +import org.netbeans.modules.tasklist.usertasks.model.UserTask;
21.26 +import org.netbeans.modules.tasklist.usertasks.renderers.UserTaskIconProvider;
21.27 +import org.openide.util.NbBundle;
21.28 +
21.29 +/**
21.30 + * ListCellRenderer für UT.
21.31 + *
21.32 + * @author tl
21.33 + */
21.34 +public class UserTaskListCellRenderer extends DefaultListCellRenderer {
21.35 + private static final String NONE = NbBundle.getMessage(
21.36 + UserTaskListCellRenderer.class, "None"); // NOI18N
21.37 +
21.38 + private ImageIcon icon = new ImageIcon();
21.39 +
21.40 + /**
21.41 + * Creates a new instance of UserTaskListCellRenderer
21.42 + */
21.43 + public UserTaskListCellRenderer() {
21.44 + }
21.45 +
21.46 + public Component getListCellRendererComponent(
21.47 + JList list,
21.48 + Object value,
21.49 + int index,
21.50 + boolean isSelected,
21.51 + boolean cellHasFocus)
21.52 + {
21.53 + super.getListCellRendererComponent(list, value, index, isSelected,
21.54 + cellHasFocus);
21.55 + if (value == null) {
21.56 + setText(NONE);
21.57 + setIcon(null);
21.58 + } else {
21.59 + UserTask ut = (UserTask) value;
21.60 + Settings set = Settings.getDefault();
21.61 + Duration d = new Duration(ut.getSpentTime(), set.getHoursPerDay(),
21.62 + set.getDaysPerWeek());
21.63 + setText("[" + d.format() + "] " + ut.getSummary());
21.64 + icon.setImage(UserTaskIconProvider.getUserTaskImage(
21.65 + (UserTask) value, false));
21.66 + setIcon(icon);
21.67 + }
21.68 + return this;
21.69 + }
21.70 +}
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
22.2 +++ b/tasklist.timerwin/src/org/netbeans/modules/tasklist/timerwin/layer.xml Wed Dec 14 00:34:40 2005 +0000
22.3 @@ -0,0 +1,31 @@
22.4 +<?xml version="1.0" encoding="UTF-8"?>
22.5 +<!--
22.6 + Sun Public License Notice
22.7 +
22.8 +The contents of this file are subject to the Sun Public License
22.9 +Version 1.0 (the "License"). You may not use this file except in
22.10 +compliance with the License. A copy of the License is available at
22.11 +http://www.sun.com/
22.12 +
22.13 +The Original Code is NetBeans. The Initial Developer of the Original
22.14 +Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
22.15 +Microsystems, Inc. All Rights Reserved.
22.16 +-->
22.17 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
22.18 +<filesystem>
22.19 + <folder name="Actions">
22.20 + <folder name="Window">
22.21 + <file name="org-netbeans-modules-tasklist-timerwin-ShowViewAction.instance">
22.22 + <attr name="instanceClass" stringvalue="org.netbeans.modules.tasklist.timerwin.ShowViewAction"/>
22.23 + </file>
22.24 + </folder>
22.25 + </folder>
22.26 + <folder name="Menu">
22.27 + <folder name="Window">
22.28 + <attr name="org-netbeans-modules-tasklist-usertasks-actions-ViewTasksAction.instance/org-netbeans-modules-tasklist-timerwin-ShowViewAction.shadow" boolvalue="true"/>
22.29 + <file name="org-netbeans-modules-tasklist-timerwin-ShowViewAction.shadow">
22.30 + <attr name="originalFile" stringvalue="Actions/Window/org-netbeans-modules-tasklist-timerwin-ShowViewAction.instance"/>
22.31 + </file>
22.32 + </folder>
22.33 + </folder>
22.34 +</filesystem>
23.1 --- a/tasklist.usertasks/javahelp/org/netbeans/modules/tasklist/usertasks/docs/content/actions.html Tue Dec 13 10:52:35 2005 +0000
23.2 +++ b/tasklist.usertasks/javahelp/org/netbeans/modules/tasklist/usertasks/docs/content/actions.html Wed Dec 14 00:34:40 2005 +0000
23.3 @@ -21,7 +21,8 @@
23.4 </td>
23.5 <td style="vertical-align: top;">
23.6 <h3>Task List's local menu</h3>
23.7 - <img src="listMenu.gif" alt="Task List Menu"><br>
23.8 + <img src="listMenu.gif" alt="Task List Menu"
23.9 + style="width: 225px; height: 226px;"><br>
23.10 </td>
23.11 <td style="vertical-align: top; width: 90%;"><br>
23.12 </td>
24.1 --- a/tasklist.usertasks/javahelp/org/netbeans/modules/tasklist/usertasks/docs/content/options.html Tue Dec 13 10:52:35 2005 +0000
24.2 +++ b/tasklist.usertasks/javahelp/org/netbeans/modules/tasklist/usertasks/docs/content/options.html Wed Dec 14 00:34:40 2005 +0000
24.3 @@ -47,6 +47,11 @@
24.4 </li>
24.5 <li><b>Hours per Day: </b>number of working hours per day</li>
24.6 <li><b>Days per Week: </b>number of working days per week</li>
24.7 + <li><b>Automatically Switch "Spent Time", "Effort" and "Percent
24.8 +Complete" to "Computed" if a subtask is added:</b> if you create a new
24.9 +subtask the corresponding values of the parent task will be computed
24.10 +automatically.<br>
24.11 + </li>
24.12 <li><b>Default User Tasks File</b>: Name of file where the tasks are
24.13 stored.
24.14 Default: {userdir}/tasklist.ics. </li>
25.1 --- a/tasklist.usertasks/manifest.mf Tue Dec 13 10:52:35 2005 +0000
25.2 +++ b/tasklist.usertasks/manifest.mf Wed Dec 14 00:34:40 2005 +0000
25.3 @@ -1,6 +1,6 @@
25.4 Manifest-Version: 1.0
25.5 OpenIDE-Module: org.netbeans.modules.tasklist.usertasks/2
25.6 -OpenIDE-Module-Implementation-Version: 53
25.7 +OpenIDE-Module-Implementation-Version: 54
25.8 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/tasklist/usertasks/Bundle.properties
25.9 OpenIDE-Module-Layer: org/netbeans/modules/tasklist/usertasks/mf-layer.xml
25.10
26.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/Bundle.properties Tue Dec 13 10:52:35 2005 +0000
26.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/Bundle.properties Wed Dec 14 00:34:40 2005 +0000
26.3 @@ -107,10 +107,6 @@
26.4 #yes for done property
26.5 Yes=yes
26.6
26.7 -ProgressLabel=P&rogress\:
26.8 -
26.9 -ProgressComputed=Compute &automatically
26.10 -
26.11 CreatedLabel=Created\:
26.12 LastEditedLabel=Last Edited\:
26.13
26.14 @@ -120,7 +116,6 @@
26.15 Effort=Effort
26.16 General=General
26.17 TimeRelated=Time Related
26.18 -Value=Value
26.19 UseThisValue=Use This Value:
26.20 Progress=Progress
26.21 ComputeEffortAutomatically=Compute automatically as a sum of the subtask values
27.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/TaskListDataObject.java Tue Dec 13 10:52:35 2005 +0000
27.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/TaskListDataObject.java Wed Dec 14 00:34:40 2005 +0000
27.3 @@ -60,7 +60,8 @@
27.4 * Opens the TC in the Swing thread
27.5 */
27.6 private void open_() {
27.7 - UserTaskView view = UserTaskView.findView(getPrimaryEntry().getFile());
27.8 + UserTaskView view = UserTaskViewRegistry.getInstance().
27.9 + findView(getPrimaryEntry().getFile());
27.10 if (view == null) {
27.11 FileObject fo = getPrimaryEntry().getFile();
27.12 try {
28.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/UserTaskNode.java Tue Dec 13 10:52:35 2005 +0000
28.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/UserTaskNode.java Wed Dec 14 00:34:40 2005 +0000
28.3 @@ -477,8 +477,7 @@
28.4 public org.openide.nodes.Node.Cookie getCookie(Class type) {
28.5 UserTask uitem = (UserTask) item;
28.6 if (type == StartCookie.class) {
28.7 - if (uitem.isStarted() || uitem.isSpentTimeComputed() ||
28.8 - uitem.isDone()) {
28.9 + if (uitem.isStarted() || !uitem.isStartable()) {
28.10 return null;
28.11 } else {
28.12 return new StartCookie(uitem);
29.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/UserTaskView.java Tue Dec 13 10:52:35 2005 +0000
29.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/UserTaskView.java Wed Dec 14 00:34:40 2005 +0000
29.3 @@ -16,6 +16,8 @@
29.4 import java.awt.BorderLayout;
29.5 import java.awt.Image;
29.6 import java.awt.Point;
29.7 +import java.awt.event.InputEvent;
29.8 +import java.awt.event.KeyEvent;
29.9 import java.beans.PropertyChangeEvent;
29.10 import java.beans.PropertyChangeListener;
29.11 import java.io.IOException;
29.12 @@ -32,9 +34,11 @@
29.13 import java.util.logging.Level;
29.14
29.15 import javax.swing.ActionMap;
29.16 +import javax.swing.JComponent;
29.17 import javax.swing.JPanel;
29.18 import javax.swing.JScrollPane;
29.19 import javax.swing.JToolBar;
29.20 +import javax.swing.KeyStroke;
29.21 import javax.swing.SwingUtilities;
29.22 import javax.swing.border.EmptyBorder;
29.23 import javax.swing.tree.TreePath;
29.24 @@ -84,14 +88,12 @@
29.25 import org.openide.util.NbBundle;
29.26 import org.openide.util.Utilities;
29.27 import org.openide.util.actions.SystemAction;
29.28 -import org.openide.util.lookup.Lookups;
29.29 import org.openide.windows.Mode;
29.30 import org.openide.windows.TopComponent;
29.31 import org.openide.windows.WindowManager;
29.32 import org.netbeans.modules.tasklist.usertasks.model.UserTask;
29.33 import org.netbeans.modules.tasklist.usertasks.model.UserTaskList;
29.34 import org.openide.util.Lookup;
29.35 -import org.openide.util.lookup.ProxyLookup;
29.36
29.37 /**
29.38 * View showing the user tasks.
29.39 @@ -116,16 +118,6 @@
29.40
29.41 private static int nextViewId = 0;
29.42
29.43 - private static UserTaskView defview = null;
29.44 -
29.45 - /**
29.46 - * Keeps track of all UserTaskViews. Access should be synchronized on
29.47 - * UserTaskView.class
29.48 - */
29.49 - private transient static List views = new ArrayList();
29.50 -
29.51 - private transient static WeakReference lastActivated = null;
29.52 -
29.53 static {
29.54 // repaint the view if the number of working hours per day has
29.55 // changed (spent time, rem. effort and effort columns should be
29.56 @@ -138,11 +130,10 @@
29.57 return;
29.58
29.59 synchronized(UserTaskView.class) {
29.60 - Iterator it = views.iterator();
29.61 - while (it.hasNext()) {
29.62 - WeakReference wr = (WeakReference) it.next();
29.63 - UserTaskView utv = (UserTaskView) wr.get();
29.64 - utv.repaint();
29.65 + UserTaskView[] all = UserTaskViewRegistry.
29.66 + getInstance().getAll();
29.67 + for (int i = 0; i < all.length; i++) {
29.68 + all[i].repaint();
29.69 }
29.70 }
29.71 }
29.72 @@ -150,89 +141,6 @@
29.73 );
29.74 }
29.75
29.76 - /**
29.77 - * Returns the view with the default task list. The view will be opened if
29.78 - * it was not.
29.79 - *
29.80 - * @return the default view or null if an error occured
29.81 - */
29.82 - public static UserTaskView getDefault() {
29.83 - if (defview == null) {
29.84 - try {
29.85 - defview = new UserTaskView(
29.86 - UserTaskList.getDefault(), true);
29.87 - defview.showInMode();
29.88 - } catch (IOException ioe) {
29.89 - DialogDisplayer.getDefault().notify(new Message(
29.90 - ioe, NotifyDescriptor.ERROR_MESSAGE));
29.91 - }
29.92 - }
29.93 - return defview;
29.94 - }
29.95 -
29.96 - /**
29.97 - * Returns all opened views.
29.98 - *
29.99 - * @return array of all opened views
29.100 - */
29.101 - public static UserTaskView[] getAll() {
29.102 - synchronized(UserTaskView.class) {
29.103 - WeakReference[] r = (WeakReference[]) views.toArray(
29.104 - new WeakReference[views.size()]);
29.105 - List views = new ArrayList();
29.106 - for (int i = 0; i < r.length; i++) {
29.107 - UserTaskView v = (UserTaskView) r[i].get();
29.108 - if (v != null)
29.109 - views.add(v);
29.110 - }
29.111 - return (UserTaskView[]) views.toArray(new UserTaskView[views.size()]);
29.112 - }
29.113 - }
29.114 -
29.115 - /**
29.116 - * Return the currently active user task view, or null
29.117 - *
29.118 - * @return current view
29.119 - */
29.120 - public static UserTaskView getCurrent() {
29.121 - TopComponent activated = WindowManager.getDefault().
29.122 - getRegistry().getActivated();
29.123 - if (activated instanceof UserTaskView)
29.124 - return (UserTaskView) activated;
29.125 - else
29.126 - return null;
29.127 - }
29.128 -
29.129 - /**
29.130 - * Returns the last activated view.
29.131 - *
29.132 - * @return the view that was activated as the last one or null
29.133 - */
29.134 - public static UserTaskView getLastActivated() {
29.135 - if (lastActivated == null)
29.136 - return null;
29.137 - UserTaskView v = (UserTaskView) lastActivated.get();
29.138 - if (v.isOpened())
29.139 - return v;
29.140 - else
29.141 - return null;
29.142 - }
29.143 -
29.144 - /**
29.145 - * Locate a particular view showing the given list
29.146 - * @return found view or null
29.147 - */
29.148 - public static UserTaskView findView(FileObject file) {
29.149 - Iterator it = views.iterator();
29.150 - while (it.hasNext()) {
29.151 - WeakReference wr = (WeakReference) it.next();
29.152 - UserTaskView tlv = (UserTaskView) wr.get();
29.153 - if (tlv != null && tlv.getUserTaskList().getFile() == file)
29.154 - return tlv;
29.155 - }
29.156 - return null;
29.157 - }
29.158 -
29.159 private UserTasksTreeTable tt;
29.160 private JScrollPane scrollPane;
29.161 private boolean initialized = false;
29.162 @@ -301,7 +209,7 @@
29.163 RemoveFilterAction removeFilter =
29.164 (RemoveFilterAction) SystemAction.get(RemoveFilterAction.class);
29.165 removeFilter.enable();
29.166 - lastActivated = new WeakReference(this);
29.167 + UserTaskViewRegistry.getInstance().setLastActivated(this);
29.168 }
29.169
29.170 /**
29.171 @@ -312,7 +220,8 @@
29.172 * @throws IOException
29.173 * @throws ClassNotFoundException
29.174 */
29.175 - public void readExternalCore(ObjectInput objectInput) throws IOException, java.lang.ClassNotFoundException {
29.176 + public void readExternalCore(ObjectInput objectInput) throws IOException,
29.177 + java.lang.ClassNotFoundException {
29.178 // Don't call super!
29.179 // See writeExternal for justification
29.180 // super.readExternal(objectInput);
29.181 @@ -350,10 +259,6 @@
29.182 objectInput.readObject(); // ignoring title
29.183 int persistentInt = objectInput.read();
29.184 }
29.185 -
29.186 - synchronized (UserTaskView.class) {
29.187 - views.add(new WeakReference(this));
29.188 - }
29.189 }
29.190
29.191 /**
29.192 @@ -393,7 +298,7 @@
29.193 default_ = true;
29.194 setList(UserTaskList.getDefault());
29.195 init();
29.196 - defview = this;
29.197 + UserTaskViewRegistry.getInstance().setDefaultView(this);
29.198 }
29.199 }
29.200 if (ver >= 3) {
29.201 @@ -682,10 +587,6 @@
29.202 private void init() {
29.203 assert SwingUtilities.isEventDispatchThread();
29.204
29.205 - synchronized (UserTaskView.class) {
29.206 - views.add(new WeakReference(this));
29.207 - }
29.208 -
29.209 tasklist.getFile().addFileChangeListener(this);
29.210
29.211 setIcon(ICON);
29.212 @@ -771,37 +672,33 @@
29.213 * Called when the object is opened. Add the GUI.
29.214 */
29.215 protected void componentOpened() {
29.216 + UserTaskViewRegistry.getInstance().viewOpened(this);
29.217 if (initialized) {
29.218 return;
29.219 }
29.220 initialized = true;
29.221 ExplorerUtils.activateActions(manager, false);
29.222 ExplorerUtils.activateActions(manager, true);
29.223 - lastActivated = new WeakReference(this);
29.224 + UserTaskViewRegistry.getInstance().setLastActivated(this);
29.225 }
29.226
29.227
29.228 /** Called when the window is closed. Cleans up. */
29.229 protected void componentClosed() {
29.230 + UserTask started = StartedUserTask.getInstance().getStarted();
29.231 + if (started != null && started.getList() == getUserTaskList())
29.232 + started.stop();
29.233 +
29.234 getUserTaskList().destroy();
29.235
29.236 - if (defview == this)
29.237 - defview = null;
29.238 -
29.239 - Iterator it = views.iterator();
29.240 - while (it.hasNext()) {
29.241 - WeakReference wr = (WeakReference) it.next();
29.242 - UserTaskView tlv = (UserTaskView) wr.get();
29.243 - if (tlv == this) {
29.244 - it.remove();
29.245 - break;
29.246 - }
29.247 - }
29.248 + UserTaskViewRegistry.getInstance().viewClosed(this);
29.249 }
29.250
29.251 protected void componentDeactivated() {
29.252 super.componentDeactivated();
29.253 - assert initialized : "#37438 dangling componentDeactivated event, no componentOpened() called at " + this; // NOI18N
29.254 + assert initialized :
29.255 + "#37438 dangling componentDeactivated event, " + // NOI18N
29.256 + "no componentOpened() called at " + this; // NOI18N
29.257 ExplorerUtils.activateActions(manager, false);
29.258 }
29.259
29.260 @@ -950,6 +847,13 @@
29.261 * Configures actions.
29.262 */
29.263 private void configureActions() {
29.264 + getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
29.265 + put(KeyStroke.getKeyStroke(KeyEvent.VK_UP,
29.266 + InputEvent.CTRL_MASK), "moveUp"); // NOI18N
29.267 + getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
29.268 + put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN,
29.269 + InputEvent.CTRL_MASK), "moveDown"); // NOI18N
29.270 +
29.271 ActionMap map = getActionMap();
29.272 map.put(javax.swing.text.DefaultEditorKit.copyAction,
29.273 ExplorerUtils.actionCopy(manager));
29.274 @@ -959,6 +863,8 @@
29.275 ExplorerUtils.actionPaste(manager));
29.276 // old code: ExplorerUtils.actionDelete(manager, true)
29.277 map.put("delete", new UTDeleteAction(tt)); // NOI18N
29.278 + map.put("moveUp", MoveUpAction.get(MoveUpAction.class)); // NOI18N
29.279 + map.put("moveDown", MoveDownAction.get(MoveDownAction.class)); // NOI18N
29.280
29.281 FindAction find = (FindAction) FindAction.get(FindAction.class);
29.282 FilterAction filter = (FilterAction)
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
30.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/UserTaskViewRegistry.java Wed Dec 14 00:34:40 2005 +0000
30.3 @@ -0,0 +1,233 @@
30.4 +/*
30.5 + * Sun Public License Notice
30.6 + *
30.7 + * The contents of this file are subject to the Sun Public License
30.8 + * Version 1.0 (the "License"). You may not use this file except in
30.9 + * compliance with the License. A copy of the License is available at
30.10 + * http://www.sun.com/
30.11 + *
30.12 + * The Original Code is NetBeans. The Initial Developer of the Original
30.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
30.14 + * Microsystems, Inc. All Rights Reserved.
30.15 + */
30.16 +
30.17 +package org.netbeans.modules.tasklist.usertasks;
30.18 +
30.19 +import java.io.IOException;
30.20 +import java.lang.ref.WeakReference;
30.21 +import java.util.ArrayList;
30.22 +import java.util.Iterator;
30.23 +import java.util.List;
30.24 +import javax.swing.event.ChangeEvent;
30.25 +import javax.swing.event.ChangeListener;
30.26 +import javax.swing.event.EventListenerList;
30.27 +import org.netbeans.modules.tasklist.usertasks.model.UserTaskList;
30.28 +import org.openide.DialogDisplayer;
30.29 +import org.openide.NotifyDescriptor;
30.30 +import org.openide.NotifyDescriptor.Message;
30.31 +import org.openide.filesystems.FileObject;
30.32 +import org.openide.windows.TopComponent;
30.33 +import org.openide.windows.WindowManager;
30.34 +
30.35 +/**
30.36 + * Registry for all open UserTaskViews.
30.37 + *
30.38 + * @author tl
30.39 + */
30.40 +public class UserTaskViewRegistry {
30.41 + private static UserTaskViewRegistry instance =
30.42 + new UserTaskViewRegistry();
30.43 +
30.44 + /**
30.45 + * Returns the only instance of this class.
30.46 + *
30.47 + * @return the instance.
30.48 + */
30.49 + public static UserTaskViewRegistry getInstance() {
30.50 + return instance;
30.51 + }
30.52 +
30.53 + private UserTaskView defview = null;
30.54 +
30.55 + /**
30.56 + * Keeps track of all UserTaskViews. Access should be synchronized on
30.57 + * UserTaskView.class
30.58 + */
30.59 + private List views = new ArrayList();
30.60 +
30.61 + private WeakReference lastActivated = null;
30.62 + private EventListenerList listenerList = new EventListenerList();
30.63 +
30.64 + /**
30.65 + * Returns the view with the default task list. The view will be opened if
30.66 + * it was not.
30.67 + *
30.68 + * @return the default view or null if an error occured
30.69 + */
30.70 + public UserTaskView getDefault() {
30.71 + if (defview == null) {
30.72 + try {
30.73 + defview = new UserTaskView(
30.74 + UserTaskList.getDefault(), true);
30.75 + defview.showInMode();
30.76 + } catch (IOException ioe) {
30.77 + DialogDisplayer.getDefault().notify(new Message(
30.78 + ioe, NotifyDescriptor.ERROR_MESSAGE));
30.79 + }
30.80 + }
30.81 + return defview;
30.82 + }
30.83 +
30.84 + /**
30.85 + * Returns all opened views.
30.86 + *
30.87 + * @return array of all opened views
30.88 + */
30.89 + public UserTaskView[] getAll() {
30.90 + synchronized(UserTaskView.class) {
30.91 + WeakReference[] r = (WeakReference[]) views.toArray(
30.92 + new WeakReference[views.size()]);
30.93 + List views = new ArrayList();
30.94 + for (int i = 0; i < r.length; i++) {
30.95 + UserTaskView v = (UserTaskView) r[i].get();
30.96 + if (v != null)
30.97 + views.add(v);
30.98 + }
30.99 + return (UserTaskView[]) views.toArray(new UserTaskView[views.size()]);
30.100 + }
30.101 + }
30.102 +
30.103 + /**
30.104 + * Return the currently active user task view, or null
30.105 + *
30.106 + * @return current view
30.107 + */
30.108 + public UserTaskView getCurrent() {
30.109 + TopComponent activated = WindowManager.getDefault().
30.110 + getRegistry().getActivated();
30.111 + if (activated instanceof UserTaskView)
30.112 + return (UserTaskView) activated;
30.113 + else
30.114 + return null;
30.115 + }
30.116 +
30.117 + /**
30.118 + * Returns the last activated view.
30.119 + *
30.120 + * @return the view that was activated as the last one or null
30.121 + */
30.122 + public UserTaskView getLastActivated() {
30.123 + if (lastActivated == null)
30.124 + return null;
30.125 + UserTaskView v = (UserTaskView) lastActivated.get();
30.126 + if (v.isOpened())
30.127 + return v;
30.128 + else
30.129 + return null;
30.130 + }
30.131 +
30.132 + /**
30.133 + * Locate a particular view showing the given list
30.134 + * @return found view or null
30.135 + */
30.136 + public UserTaskView findView(FileObject file) {
30.137 + Iterator it = views.iterator();
30.138 + while (it.hasNext()) {
30.139 + WeakReference wr = (WeakReference) it.next();
30.140 + UserTaskView tlv = (UserTaskView) wr.get();
30.141 + if (tlv != null && tlv.getUserTaskList().getFile() == file)
30.142 + return tlv;
30.143 + }
30.144 + return null;
30.145 + }
30.146 +
30.147 + /**
30.148 + * Sets the last activated view.
30.149 + *
30.150 + * @param v the last activated view
30.151 + */
30.152 + public void setLastActivated(UserTaskView v) {
30.153 + lastActivated = new WeakReference(v);
30.154 + }
30.155 +
30.156 + /**
30.157 + * Registers a new view.
30.158 + *
30.159 + * @param v the view
30.160 + */
30.161 + public void viewOpened(UserTaskView v) {
30.162 + synchronized (UserTaskView.class) {
30.163 + views.add(new WeakReference(v));
30.164 + }
30.165 + fireChange();
30.166 + }
30.167 +
30.168 + /**
30.169 + * Sets default view.
30.170 + *
30.171 + * @param v the default view
30.172 + */
30.173 + public void setDefaultView(UserTaskView v) {
30.174 + defview = v;
30.175 + }
30.176 +
30.177 + /**
30.178 + * A view was closed.
30.179 + *
30.180 + * @param v the view
30.181 + */
30.182 + public void viewClosed(UserTaskView v) {
30.183 + if (defview == v)
30.184 + defview = null;
30.185 +
30.186 + Iterator it = views.iterator();
30.187 + while (it.hasNext()) {
30.188 + WeakReference wr = (WeakReference) it.next();
30.189 + UserTaskView tlv = (UserTaskView) wr.get();
30.190 + if (tlv == v) {
30.191 + it.remove();
30.192 + break;
30.193 + }
30.194 + }
30.195 + fireChange();
30.196 + }
30.197 +
30.198 + /**
30.199 + * Adds a listener that will be modified if a view was closed or a new view
30.200 + * was opened.
30.201 + *
30.202 + * @param l a listener
30.203 + */
30.204 + public void addChangeListener(ChangeListener l) {
30.205 + listenerList.add(ChangeListener.class, l);
30.206 + }
30.207 +
30.208 + /**
30.209 + * Removes a listener registered with addChangeListener.
30.210 + *
30.211 + * @param l the listener
30.212 + */
30.213 + public void removeChangeListener(ChangeListener l) {
30.214 + listenerList.remove(ChangeListener.class, l);
30.215 + }
30.216 +
30.217 + /**
30.218 + * Fires a change.
30.219 + */
30.220 + private void fireChange() {
30.221 + ChangeEvent event = null;
30.222 + Object[] listeners = listenerList.getListenerList();
30.223 + for (int i = listeners.length - 2; i >= 0; i -= 2) {
30.224 + if (listeners[i] == ChangeListener.class) {
30.225 + if (event == null)
30.226 + event = new ChangeEvent(this);
30.227 + ((ChangeListener) listeners[i + 1]).stateChanged(event);
30.228 + }
30.229 + }
30.230 + }
30.231 + /**
30.232 + * Creates a new instance of UserTaskViewRegistry
30.233 + */
30.234 + private UserTaskViewRegistry() {
30.235 + }
30.236 +}
31.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/UserTasksTreeTable.java Tue Dec 13 10:52:35 2005 +0000
31.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/UserTasksTreeTable.java Wed Dec 14 00:34:40 2005 +0000
31.3 @@ -14,6 +14,8 @@
31.4 package org.netbeans.modules.tasklist.usertasks;
31.5
31.6 import java.awt.Point;
31.7 +import java.awt.event.ActionEvent;
31.8 +import java.beans.PropertyChangeListener;
31.9 import java.io.Serializable;
31.10 import java.util.ArrayList;
31.11 import java.util.List;
31.12 @@ -21,6 +23,7 @@
31.13
31.14 import javax.swing.Action;
31.15 import javax.swing.ImageIcon;
31.16 +import javax.swing.KeyStroke;
31.17 import javax.swing.ListSelectionModel;
31.18 import javax.swing.event.ListSelectionEvent;
31.19 import javax.swing.event.ListSelectionListener;
31.20 @@ -34,11 +37,13 @@
31.21 import org.netbeans.modules.tasklist.usertasks.actions.ExpandAllUserTasksAction;
31.22 import org.netbeans.modules.tasklist.usertasks.actions.NewTaskAction;
31.23 import org.netbeans.modules.tasklist.usertasks.editors.CategoryTableCellEditor;
31.24 +import org.netbeans.modules.tasklist.usertasks.editors.EffortTableCellEditor;
31.25 import org.netbeans.modules.tasklist.usertasks.editors.OwnerTableCellEditor;
31.26 import org.netbeans.modules.tasklist.usertasks.editors.PercentsTableCellEditor;
31.27 import org.netbeans.modules.tasklist.usertasks.editors.PriorityTableCellEditor;
31.28 import org.netbeans.modules.tasklist.usertasks.renderers.CategoryTableCellRenderer;
31.29 import org.netbeans.modules.tasklist.usertasks.renderers.DateTableCellRenderer;
31.30 +import org.netbeans.modules.tasklist.usertasks.renderers.DoneTreeTableCellRenderer;
31.31 import org.netbeans.modules.tasklist.usertasks.renderers.DueDateTableCellRenderer;
31.32 import org.netbeans.modules.tasklist.usertasks.renderers.DurationTableCellRenderer;
31.33 import org.netbeans.modules.tasklist.usertasks.renderers.EffortTableCellRenderer;
31.34 @@ -47,7 +52,6 @@
31.35 import org.netbeans.modules.tasklist.usertasks.renderers.PriorityTableCellRenderer;
31.36 import org.netbeans.modules.tasklist.usertasks.renderers.SummaryTreeCellRenderer;
31.37 import org.netbeans.modules.tasklist.usertasks.treetable.AdvancedTreeTableNode;
31.38 -import org.netbeans.modules.tasklist.usertasks.treetable.BooleanTableCellRenderer;
31.39 import org.netbeans.modules.tasklist.usertasks.treetable.DefaultMutableTreeTableNode;
31.40 import org.netbeans.modules.tasklist.usertasks.treetable.DefaultTreeTableModel;
31.41 import org.netbeans.modules.tasklist.usertasks.treetable.NodesTreeTable;
31.42 @@ -182,13 +186,17 @@
31.43 tcm.getColumn(UserTasksTreeTableModel.PRIORITY).setCellRenderer(
31.44 new PriorityTableCellRenderer());
31.45
31.46 + tcm.getColumn(UserTasksTreeTableModel.EFFORT).setCellEditor(
31.47 + new EffortTableCellEditor());
31.48 +
31.49 r = new SortingHeaderRenderer();
31.50 r.setIcon(new ImageIcon(
31.51 UserTasksTreeTable.class.getResource("checkbox.gif"))); // NOI18N
31.52 tcm.getColumn(UserTasksTreeTableModel.DONE).setHeaderRenderer(r);
31.53 tcm.getColumn(UserTasksTreeTableModel.DONE).setCellRenderer(
31.54 - new BooleanTableCellRenderer());
31.55 + new DoneTreeTableCellRenderer());
31.56 tcm.getColumn(UserTasksTreeTableModel.DONE).setMinWidth(17);
31.57 +
31.58 tcm.getColumn(UserTasksTreeTableModel.PERCENT_COMPLETE).setCellRenderer(
31.59 new PercentsTableCellRenderer());
31.60 DurationTableCellRenderer dr = new DurationTableCellRenderer();
32.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/CollapseAllAction.java Tue Dec 13 10:52:35 2005 +0000
32.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/CollapseAllAction.java Wed Dec 14 00:34:40 2005 +0000
32.3 @@ -14,6 +14,7 @@
32.4 package org.netbeans.modules.tasklist.usertasks.actions;
32.5
32.6 import org.netbeans.modules.tasklist.usertasks.UserTaskView;
32.7 +import org.netbeans.modules.tasklist.usertasks.UserTaskViewRegistry;
32.8 import org.openide.util.HelpCtx;
32.9 import org.openide.util.NbBundle;
32.10 import org.openide.util.actions.CallableSystemAction;
32.11 @@ -29,7 +30,7 @@
32.12 * Do the actual expansion
32.13 */
32.14 public void performAction() {
32.15 - UserTaskView view = UserTaskView.getCurrent();
32.16 + UserTaskView view = UserTaskViewRegistry.getInstance().getCurrent();
32.17 if (view != null) {
32.18 view.getTreeTable().collapseAll();
32.19 }
33.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/ExpandAllUserTasksAction.java Tue Dec 13 10:52:35 2005 +0000
33.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/ExpandAllUserTasksAction.java Wed Dec 14 00:34:40 2005 +0000
33.3 @@ -14,6 +14,7 @@
33.4 package org.netbeans.modules.tasklist.usertasks.actions;
33.5
33.6 import org.netbeans.modules.tasklist.usertasks.UserTaskView;
33.7 +import org.netbeans.modules.tasklist.usertasks.UserTaskViewRegistry;
33.8 import org.openide.util.HelpCtx;
33.9 import org.openide.util.NbBundle;
33.10 import org.openide.util.actions.CallableSystemAction;
33.11 @@ -30,7 +31,7 @@
33.12 * Do the actual expansion
33.13 */
33.14 public void performAction() {
33.15 - UserTaskView view = UserTaskView.getCurrent();
33.16 + UserTaskView view = UserTaskViewRegistry.getInstance().getCurrent();
33.17 if (view != null) {
33.18 view.getTreeTable().expandAll();
33.19 }
34.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/MoveDownAction.java Tue Dec 13 10:52:35 2005 +0000
34.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/MoveDownAction.java Wed Dec 14 00:34:40 2005 +0000
34.3 @@ -13,8 +13,11 @@
34.4
34.5 package org.netbeans.modules.tasklist.usertasks.actions;
34.6
34.7 -import java.io.Serializable;
34.8 +import java.awt.event.InputEvent;
34.9 +import java.awt.event.KeyEvent;
34.10 +import javax.swing.KeyStroke;
34.11 import org.netbeans.modules.tasklist.usertasks.UTUtils;
34.12 +import org.netbeans.modules.tasklist.usertasks.UserTaskViewRegistry;
34.13 import org.netbeans.modules.tasklist.usertasks.model.UserTask;
34.14 import org.netbeans.modules.tasklist.usertasks.UserTaskNode;
34.15 import org.netbeans.modules.tasklist.usertasks.model.UserTaskObjectList;
34.16 @@ -31,12 +34,14 @@
34.17 * Creates a new instance
34.18 */
34.19 public MoveDownAction() {
34.20 + putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_DOWN,
34.21 + InputEvent.CTRL_MASK));
34.22 }
34.23
34.24 protected void performAction(org.openide.nodes.Node[] activatedNodes) {
34.25 UserTaskNode n = (UserTaskNode) activatedNodes[0];
34.26 UserTask ut = n.getTask();
34.27 - UserTaskView utv = UserTaskView.getCurrent();
34.28 + UserTaskView utv = UserTaskViewRegistry.getInstance().getCurrent();
34.29 Object es = utv.getTreeTable().getExpandedNodesAndSelection();
34.30 ut.moveDown();
34.31 utv.getTreeTable().setExpandedNodesAndSelection(es);
35.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/MoveUpAction.java Tue Dec 13 10:52:35 2005 +0000
35.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/MoveUpAction.java Wed Dec 14 00:34:40 2005 +0000
35.3 @@ -13,8 +13,11 @@
35.4
35.5 package org.netbeans.modules.tasklist.usertasks.actions;
35.6
35.7 -import java.io.Serializable;
35.8 +import java.awt.event.InputEvent;
35.9 +import java.awt.event.KeyEvent;
35.10 +import javax.swing.KeyStroke;
35.11 import org.netbeans.modules.tasklist.usertasks.UTUtils;
35.12 +import org.netbeans.modules.tasklist.usertasks.UserTaskViewRegistry;
35.13 import org.netbeans.modules.tasklist.usertasks.model.UserTask;
35.14 import org.netbeans.modules.tasklist.usertasks.UserTaskNode;
35.15 import org.netbeans.modules.tasklist.usertasks.model.UserTaskObjectList;
35.16 @@ -31,12 +34,14 @@
35.17 * Creates a new instance of MoveUpAction
35.18 */
35.19 public MoveUpAction() {
35.20 + putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_UP,
35.21 + InputEvent.CTRL_MASK));
35.22 }
35.23
35.24 protected void performAction(org.openide.nodes.Node[] activatedNodes) {
35.25 UserTaskNode n = (UserTaskNode) activatedNodes[0];
35.26 UserTask ut = n.getTask();
35.27 - UserTaskView utv = UserTaskView.getCurrent();
35.28 + UserTaskView utv = UserTaskViewRegistry.getInstance().getCurrent();
35.29 Object es = utv.getTreeTable().getExpandedNodesAndSelection();
35.30 ut.moveUp();
35.31 utv.getTreeTable().setExpandedNodesAndSelection(es);
36.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/NewTaskAction.java Tue Dec 13 10:52:35 2005 +0000
36.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/NewTaskAction.java Wed Dec 14 00:34:40 2005 +0000
36.3 @@ -22,6 +22,7 @@
36.4
36.5 import org.netbeans.modules.tasklist.usertasks.EditTaskPanel;
36.6 import org.netbeans.modules.tasklist.usertasks.UTUtils;
36.7 +import org.netbeans.modules.tasklist.usertasks.UserTaskViewRegistry;
36.8 import org.netbeans.modules.tasklist.usertasks.model.UserTask;
36.9 import org.netbeans.modules.tasklist.usertasks.model.UserTaskList;
36.10 import org.netbeans.modules.tasklist.usertasks.UserTaskListNode;
36.11 @@ -206,7 +207,7 @@
36.12 associate = false;
36.13
36.14 // After the add - view the todo list as well!
36.15 - utv = UserTaskView.getCurrent();
36.16 + utv = UserTaskViewRegistry.getInstance().getCurrent();
36.17
36.18 performTheAction();
36.19 }
36.20 @@ -233,9 +234,9 @@
36.21 nta.lineNumber = line.getLineNumber();
36.22
36.23 // After the add - view the todo list as well!
36.24 - nta.utv = UserTaskView.getLastActivated();
36.25 + nta.utv = UserTaskViewRegistry.getInstance().getLastActivated();
36.26 if (nta.utv == null) {
36.27 - nta.utv = UserTaskView.getDefault();
36.28 + nta.utv = UserTaskViewRegistry.getInstance().getDefault();
36.29 nta.utv.showInMode();
36.30 }
36.31 nta.utl = nta.utv.getUserTaskList();
37.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/ShowScheduleViewAction.java Tue Dec 13 10:52:35 2005 +0000
37.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/ShowScheduleViewAction.java Wed Dec 14 00:34:40 2005 +0000
37.3 @@ -13,6 +13,7 @@
37.4
37.5 package org.netbeans.modules.tasklist.usertasks.actions;
37.6
37.7 +import org.netbeans.modules.tasklist.usertasks.UserTaskViewRegistry;
37.8 import org.netbeans.modules.tasklist.usertasks.schedule.ScheduleTopComponent;
37.9 import org.netbeans.modules.tasklist.usertasks.UserTaskView;
37.10 import org.openide.util.HelpCtx;
37.11 @@ -26,7 +27,7 @@
37.12 private static final long serialVersionUID = 1;
37.13
37.14 public void performAction() {
37.15 - UserTaskView v = UserTaskView.getCurrent();
37.16 + UserTaskView v = UserTaskViewRegistry.getInstance().getCurrent();
37.17 ScheduleTopComponent tc = new ScheduleTopComponent(
37.18 v.getName(), v.getUserTaskList());
37.19 tc.open();
38.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/ViewTasksAction.java Tue Dec 13 10:52:35 2005 +0000
38.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/ViewTasksAction.java Wed Dec 14 00:34:40 2005 +0000
38.3 @@ -14,6 +14,7 @@
38.4 package org.netbeans.modules.tasklist.usertasks.actions;
38.5
38.6 import org.netbeans.modules.tasklist.usertasks.UserTaskView;
38.7 +import org.netbeans.modules.tasklist.usertasks.UserTaskViewRegistry;
38.8 import org.openide.util.HelpCtx;
38.9 import org.openide.util.NbBundle;
38.10 import org.openide.util.actions.CallableSystemAction;
38.11 @@ -37,7 +38,7 @@
38.12 }
38.13
38.14 static void show() {
38.15 - UserTaskView view = UserTaskView.getDefault();
38.16 + UserTaskView view = UserTaskViewRegistry.getInstance().getDefault();
38.17 if (view != null) {
38.18 view.showInMode();
38.19 }
39.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/editors/Bundle.properties Tue Dec 13 10:52:35 2005 +0000
39.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/editors/Bundle.properties Wed Dec 14 00:34:40 2005 +0000
39.3 @@ -15,3 +15,20 @@
39.4 ## PercentsPropertyEditor
39.5 NotANumber=Not a number
39.6
39.7 +## DurationTableCellEditor
39.8 +Duration5Min=5 min
39.9 +Duration10Min=10 min
39.10 +Duration15Min=15 min
39.11 +Duration20Min=20 min
39.12 +Duration30Min=30 min
39.13 +Duration45Min=45 min
39.14 +Duration1Hour=1 hour
39.15 +Duration1_5Hour=1.5 hours
39.16 +Duration2Hours=2 hours
39.17 +Duration2_5Hours=2.5 hours
39.18 +Duration3Hours=3 hours
39.19 +Duration4Hours=4 hours
39.20 +Duration5Hours=5 hours
39.21 +Duration6Hours=6 hours
39.22 +Duration7Hours=7 hours
39.23 +Duration8Hours=8 hours
40.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
40.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/editors/EffortTableCellEditor.java Wed Dec 14 00:34:40 2005 +0000
40.3 @@ -0,0 +1,107 @@
40.4 +/*
40.5 + * Sun Public License Notice
40.6 + *
40.7 + * The contents of this file are subject to the Sun Public License
40.8 + * Version 1.0 (the "License"). You may not use this file except in
40.9 + * compliance with the License. A copy of the License is available at
40.10 + * http://www.sun.com/
40.11 + *
40.12 + * The Original Code is NetBeans. The Initial Developer of the Original
40.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
40.14 + * Microsystems, Inc. All Rights Reserved.
40.15 + */
40.16 +
40.17 +package org.netbeans.modules.tasklist.usertasks.editors;
40.18 +
40.19 +import java.awt.Component;
40.20 +import java.util.Arrays;
40.21 +import java.util.ResourceBundle;
40.22 +
40.23 +import javax.swing.DefaultCellEditor;
40.24 +import javax.swing.JComboBox;
40.25 +import javax.swing.JTable;
40.26 +import org.netbeans.modules.tasklist.usertasks.Settings;
40.27 +import org.netbeans.modules.tasklist.usertasks.model.Duration;
40.28 +import org.netbeans.modules.tasklist.usertasks.model.UserTask;
40.29 +import org.openide.util.NbBundle;
40.30 +
40.31 +/**
40.32 + * TableCellEditor for duration values.
40.33 + *
40.34 + * @author tl
40.35 + */
40.36 +public class EffortTableCellEditor extends DefaultCellEditor {
40.37 + private static String[] TEXTS = {
40.38 + "Duration5Min", // NOI18N
40.39 + "Duration10Min", // NOI18N
40.40 + "Duration15Min", // NOI18N
40.41 + "Duration20Min", // NOI18N
40.42 + "Duration30Min", // NOI18N
40.43 + "Duration45Min", // NOI18N
40.44 + "Duration1Hour", // NOI18N
40.45 + "Duration1_5Hour", // NOI18N
40.46 + "Duration2Hours", // NOI18N
40.47 + "Duration2_5Hours", // NOI18N
40.48 + "Duration3Hours", // NOI18N
40.49 + "Duration4Hours", // NOI18N
40.50 + "Duration5Hours", // NOI18N
40.51 + "Duration6Hours", // NOI18N
40.52 + "Duration7Hours", // NOI18N
40.53 + "Duration8Hours" // NOI18N
40.54 + };
40.55 +
40.56 + /**
40.57 + * Corresponds to duration values in TAGS.
40.58 + * This array must be sorted.
40.59 + */
40.60 + private static final int[] DURATIONS = new int[] {
40.61 + 5,
40.62 + 10,
40.63 + 15,
40.64 + 20,
40.65 + 30,
40.66 + 45,
40.67 + 60,
40.68 + 90,
40.69 + 120,
40.70 + 150,
40.71 + 180,
40.72 + 240,
40.73 + 300,
40.74 + 360,
40.75 + 420,
40.76 + 480
40.77 + };
40.78 +
40.79 + static {
40.80 + assert DURATIONS.length == TEXTS.length;
40.81 +
40.82 + ResourceBundle rb = NbBundle.getBundle(EffortTableCellEditor.class);
40.83 + for (int i = 0; i < TEXTS.length; i++) {
40.84 + TEXTS[i] = rb.getString(TEXTS[i]);
40.85 + }
40.86 + }
40.87 +
40.88 + /**
40.89 + * Creates a new instance of PriorityTableCellRenderer
40.90 + */
40.91 + public EffortTableCellEditor() {
40.92 + super(new JComboBox(TEXTS));
40.93 + }
40.94 +
40.95 + public Component getTableCellEditorComponent(JTable table, Object value,
40.96 + boolean isSelected, int row, int column) {
40.97 + if (value instanceof UserTask) {
40.98 + int d = ((UserTask) value).getEffort();
40.99 + int index = Arrays.binarySearch(DURATIONS, d);
40.100 + if (index >= 0)
40.101 + ((JComboBox) editorComponent).setSelectedIndex(index);
40.102 + }
40.103 + return editorComponent;
40.104 + }
40.105 +
40.106 + public Object getCellEditorValue() {
40.107 + int index = ((JComboBox) editorComponent).getSelectedIndex();
40.108 + return new Integer(DURATIONS[index]);
40.109 + }
40.110 +}
41.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/model/StartedUserTask.java Tue Dec 13 10:52:35 2005 +0000
41.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/model/StartedUserTask.java Wed Dec 14 00:34:40 2005 +0000
41.3 @@ -1,6 +1,9 @@
41.4 package org.netbeans.modules.tasklist.usertasks.model;
41.5
41.6 import java.util.TimerTask;
41.7 +import javax.swing.event.ChangeEvent;
41.8 +import javax.swing.event.ChangeListener;
41.9 +import javax.swing.event.EventListenerList;
41.10 import org.netbeans.modules.tasklist.core.util.ActivityListener;
41.11 import org.netbeans.modules.tasklist.usertasks.Settings;
41.12
41.13 @@ -44,10 +47,9 @@
41.14 private long startedAt;
41.15
41.16 private int initialSpentTime;
41.17 -
41.18 private int state = STATE_NOTASK;
41.19 -
41.20 private UserTask.WorkPeriod workPeriod;
41.21 + private EventListenerList list = new EventListenerList();
41.22
41.23 static {
41.24 TIMER.scheduleAtFixedRate(new TimerTask() {
41.25 @@ -63,6 +65,40 @@
41.26 */
41.27 private StartedUserTask() {
41.28 }
41.29 +
41.30 + /**
41.31 + * Fires a change event.
41.32 + */
41.33 + private void fireChange() {
41.34 + ChangeEvent event = null;
41.35 + Object[] listeners = list.getListenerList();
41.36 + for (int i = listeners.length - 2; i >= 0; i -= 2) {
41.37 + if (listeners[i] == ChangeListener.class) {
41.38 + if (event == null)
41.39 + event = new ChangeEvent(this);
41.40 + ((ChangeListener) listeners[i + 1]).stateChanged(event);
41.41 + }
41.42 + }
41.43 + }
41.44 +
41.45 + /**
41.46 + * Adds a listener that will be notified when the started task was
41.47 + * changed.
41.48 + *
41.49 + * @param l a listener
41.50 + */
41.51 + public void addChangeListener(ChangeListener l) {
41.52 + list.add(ChangeListener.class, l);
41.53 + }
41.54 +
41.55 + /**
41.56 + * Removes a listener registered with addChangeListener.
41.57 + *
41.58 + * @param l a listener
41.59 + */
41.60 + public void removeChangeListener(ChangeListener l) {
41.61 + list.remove(ChangeListener.class, l);
41.62 + }
41.63
41.64 /**
41.65 * Executed once per minute
41.66 @@ -121,7 +157,8 @@
41.67 }
41.68
41.69 /**
41.70 - * Starts another task
41.71 + * Starts another task. If a task is currently running it should be
41.72 + * stopped first.
41.73 *
41.74 * @param task currently working on this task. May be null.
41.75 */
41.76 @@ -141,6 +178,7 @@
41.77 ut.clearEmptyWorkPeriods();
41.78 ut.firePropertyChange("started", Boolean.TRUE,
41.79 Boolean.FALSE); // NOI18N
41.80 + fireChange();
41.81 }
41.82 break;
41.83 }
41.84 @@ -160,6 +198,7 @@
41.85 ut.clearEmptyWorkPeriods();
41.86 ut.firePropertyChange("started", Boolean.TRUE,
41.87 Boolean.FALSE); // NOI18N
41.88 + fireChange();
41.89 }
41.90 break;
41.91 }
41.92 @@ -175,6 +214,7 @@
41.93 updateSpentTime(0);
41.94 started.firePropertyChange("started", Boolean.FALSE,
41.95 Boolean.TRUE); // NOI18N
41.96 + fireChange();
41.97 }
41.98 break;
41.99 }
42.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/model/UserTask.java Tue Dec 13 10:52:35 2005 +0000
42.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/model/UserTask.java Wed Dec 14 00:34:40 2005 +0000
42.3 @@ -397,6 +397,11 @@
42.4 public void listChanged(ObjectList.Event ev) {
42.5 switch (ev.getType()) {
42.6 case ObjectList.Event.EVENT_ADDED:
42.7 + if (Settings.getDefault().getAutoSwitchToComputed()) {
42.8 + setProgressComputed(true);
42.9 + setEffortComputed(true);
42.10 + setSpentTimeComputed(true);
42.11 + }
42.12 structureChanged();
42.13 break;
42.14 case ObjectList.Event.EVENT_REMOVED: {
42.15 @@ -680,6 +685,16 @@
42.16 }
42.17
42.18 /**
42.19 + * Checks whether this task could be started. This method als could
42.20 + * return true for a task that is currently running.
42.21 + *
42.22 + * @return true = this task could be started
42.23 + */
42.24 + public boolean isStartable() {
42.25 + return !isSpentTimeComputed() && !isDone();
42.26 + }
42.27 +
42.28 + /**
42.29 * Was the due alarm for this task already sent?
42.30 *
42.31 * @return true = yes
42.32 @@ -819,6 +834,15 @@
42.33 }
42.34
42.35 /**
42.36 + * Computes the "expected" (based on the spent time) progress for this task.
42.37 + *
42.38 + * @return "expected" progress 0..100 - value in percents
42.39 + */
42.40 + public float getExpectedProgress() {
42.41 + return ((float) getSpentTime()) / getEffort() * 100.0f;
42.42 + }
42.43 +
42.44 + /**
42.45 * Computes "percent complete" property as an average of the subtasks
42.46 * This method should only be called if percentComputed == true
42.47 *
43.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/options/Bundle.properties Tue Dec 13 10:52:35 2005 +0000
43.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/options/Bundle.properties Wed Dec 14 00:34:40 2005 +0000
43.3 @@ -21,3 +21,4 @@
43.4 DaysPerWeek=Days per &Week\:
43.5 DefaultUserTasksFile=Default User Tasks &File\:
43.6 DetectInactivity=Detect &Inactivity
43.7 +AutoSwithToComputed=Automatically &Switch "Spent Time", "Effort" and "Percent Complete" to "Computed" if a subtask is added
44.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/options/UTOptionsPanel.form Tue Dec 13 10:52:35 2005 +0000
44.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/options/UTOptionsPanel.form Wed Dec 14 00:34:40 2005 +0000
44.3 @@ -6,7 +6,7 @@
44.4 <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
44.5 <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
44.6 <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="1"/>
44.7 - <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,-32,0,0,1,-18"/>
44.8 + <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,-9,0,0,2,-104"/>
44.9 </AuxValues>
44.10
44.11 <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
44.12 @@ -97,7 +97,7 @@
44.13 </Properties>
44.14 <Constraints>
44.15 <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
44.16 - <GridBagConstraints gridX="0" gridY="4" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="11" insetsRight="12" anchor="18" weightX="0.0" weightY="0.0"/>
44.17 + <GridBagConstraints gridX="0" gridY="5" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="11" insetsRight="12" anchor="18" weightX="0.0" weightY="0.0"/>
44.18 </Constraint>
44.19 </Constraints>
44.20 </Component>
44.21 @@ -115,7 +115,7 @@
44.22 </Events>
44.23 <Constraints>
44.24 <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
44.25 - <GridBagConstraints gridX="1" gridY="4" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="11" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
44.26 + <GridBagConstraints gridX="1" gridY="5" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="11" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
44.27 </Constraint>
44.28 </Constraints>
44.29 </Component>
44.30 @@ -130,7 +130,7 @@
44.31 </Properties>
44.32 <Constraints>
44.33 <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
44.34 - <GridBagConstraints gridX="0" gridY="5" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="11" insetsRight="12" anchor="18" weightX="0.0" weightY="0.0"/>
44.35 + <GridBagConstraints gridX="0" gridY="6" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="11" insetsRight="12" anchor="18" weightX="0.0" weightY="0.0"/>
44.36 </Constraint>
44.37 </Constraints>
44.38 </Component>
44.39 @@ -148,7 +148,7 @@
44.40 </Events>
44.41 <Constraints>
44.42 <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
44.43 - <GridBagConstraints gridX="1" gridY="5" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="11" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
44.44 + <GridBagConstraints gridX="1" gridY="6" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="11" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
44.45 </Constraint>
44.46 </Constraints>
44.47 </Component>
44.48 @@ -163,14 +163,14 @@
44.49 </Properties>
44.50 <Constraints>
44.51 <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
44.52 - <GridBagConstraints gridX="0" gridY="6" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="12" anchor="17" weightX="0.0" weightY="0.0"/>
44.53 + <GridBagConstraints gridX="0" gridY="7" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="12" anchor="17" weightX="0.0" weightY="0.0"/>
44.54 </Constraint>
44.55 </Constraints>
44.56 </Component>
44.57 <Component class="javax.swing.JTextField" name="jTextFieldFile">
44.58 <Constraints>
44.59 <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
44.60 - <GridBagConstraints gridX="1" gridY="6" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
44.61 + <GridBagConstraints gridX="1" gridY="7" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
44.62 </Constraint>
44.63 </Constraints>
44.64 </Component>
44.65 @@ -180,7 +180,7 @@
44.66 </Properties>
44.67 <Constraints>
44.68 <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
44.69 - <GridBagConstraints gridX="1" gridY="7" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
44.70 + <GridBagConstraints gridX="1" gridY="8" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
44.71 </Constraint>
44.72 </Constraints>
44.73
44.74 @@ -201,12 +201,39 @@
44.75 </Property>
44.76 <Property name="opaque" type="boolean" value="false"/>
44.77 </Properties>
44.78 + <Events>
44.79 + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jCheckBoxDetectInactivityActionPerformed"/>
44.80 + </Events>
44.81 <AuxValues>
44.82 <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
44.83 </AuxValues>
44.84 <Constraints>
44.85 <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
44.86 - <GridBagConstraints gridX="0" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="11" insetsRight="12" anchor="18" weightX="0.0" weightY="0.0"/>
44.87 + <GridBagConstraints gridX="0" gridY="3" gridWidth="2" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="11" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
44.88 + </Constraint>
44.89 + </Constraints>
44.90 + </Component>
44.91 + <Component class="javax.swing.JCheckBox" name="jCheckBoxAutoSwitchToComputed">
44.92 + <Properties>
44.93 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
44.94 + <ResourceString bundle="org/netbeans/modules/tasklist/usertasks/options/Bundle.properties" key="AutoSwithToComputed" replaceFormat="org.openide.util.NbBundle.getBundle({sourceFileName}.class).getString("{key}")"/>
44.95 + </Property>
44.96 + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
44.97 + <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
44.98 + <EmptyBorder bottom="0" left="0" right="0" top="0"/>
44.99 + </Border>
44.100 + </Property>
44.101 + <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
44.102 + <Insets value="[0, 0, 0, 0]"/>
44.103 + </Property>
44.104 + <Property name="opaque" type="boolean" value="false"/>
44.105 + </Properties>
44.106 + <Events>
44.107 + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jCheckBoxAutoSwitchToComputedActionPerformed"/>
44.108 + </Events>
44.109 + <Constraints>
44.110 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
44.111 + <GridBagConstraints gridX="0" gridY="4" gridWidth="2" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="11" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
44.112 </Constraint>
44.113 </Constraints>
44.114 </Component>
45.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/options/UTOptionsPanel.java Tue Dec 13 10:52:35 2005 +0000
45.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/options/UTOptionsPanel.java Wed Dec 14 00:34:40 2005 +0000
45.3 @@ -60,6 +60,7 @@
45.4 jSpinnerDays.setValue(new Integer(s.getDaysPerWeek()));
45.5 jTextFieldFile.setText(s.getFilename());
45.6 jCheckBoxDetectInactivity.setSelected(s.getDetectInactivity());
45.7 + jCheckBoxAutoSwitchToComputed.setSelected(s.getAutoSwitchToComputed());
45.8 changed = false;
45.9 }
45.10
45.11 @@ -78,6 +79,7 @@
45.12 s.setDaysPerWeek(((Integer) jSpinnerDays.getValue()).intValue());
45.13 s.setFilename(jTextFieldFile.getText());
45.14 s.setDetectInactivity(jCheckBoxDetectInactivity.isSelected());
45.15 + s.setAutoSwitchToComputed(jCheckBoxAutoSwitchToComputed.isSelected());
45.16 }
45.17
45.18 /**
45.19 @@ -124,6 +126,7 @@
45.20 jTextFieldFile = new javax.swing.JTextField();
45.21 jPanel1 = new javax.swing.JPanel();
45.22 jCheckBoxDetectInactivity = new javax.swing.JCheckBox();
45.23 + jCheckBoxAutoSwitchToComputed = new javax.swing.JCheckBox();
45.24
45.25 setLayout(new java.awt.GridBagLayout());
45.26
45.27 @@ -183,7 +186,7 @@
45.28 org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(UTOptionsPanel.class, "HoursPerDay"));
45.29 gridBagConstraints = new java.awt.GridBagConstraints();
45.30 gridBagConstraints.gridx = 0;
45.31 - gridBagConstraints.gridy = 4;
45.32 + gridBagConstraints.gridy = 5;
45.33 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
45.34 gridBagConstraints.insets = new java.awt.Insets(0, 0, 11, 12);
45.35 add(jLabel1, gridBagConstraints);
45.36 @@ -198,7 +201,7 @@
45.37
45.38 gridBagConstraints = new java.awt.GridBagConstraints();
45.39 gridBagConstraints.gridx = 1;
45.40 - gridBagConstraints.gridy = 4;
45.41 + gridBagConstraints.gridy = 5;
45.42 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
45.43 gridBagConstraints.insets = new java.awt.Insets(0, 0, 11, 0);
45.44 add(jSpinnerHours, gridBagConstraints);
45.45 @@ -207,7 +210,7 @@
45.46 org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(UTOptionsPanel.class, "DaysPerWeek"));
45.47 gridBagConstraints = new java.awt.GridBagConstraints();
45.48 gridBagConstraints.gridx = 0;
45.49 - gridBagConstraints.gridy = 5;
45.50 + gridBagConstraints.gridy = 6;
45.51 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
45.52 gridBagConstraints.insets = new java.awt.Insets(0, 0, 11, 12);
45.53 add(jLabel2, gridBagConstraints);
45.54 @@ -222,7 +225,7 @@
45.55
45.56 gridBagConstraints = new java.awt.GridBagConstraints();
45.57 gridBagConstraints.gridx = 1;
45.58 - gridBagConstraints.gridy = 5;
45.59 + gridBagConstraints.gridy = 6;
45.60 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
45.61 gridBagConstraints.insets = new java.awt.Insets(0, 0, 11, 0);
45.62 add(jSpinnerDays, gridBagConstraints);
45.63 @@ -231,14 +234,14 @@
45.64 org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(UTOptionsPanel.class, "DefaultUserTasksFile"));
45.65 gridBagConstraints = new java.awt.GridBagConstraints();
45.66 gridBagConstraints.gridx = 0;
45.67 - gridBagConstraints.gridy = 6;
45.68 + gridBagConstraints.gridy = 7;
45.69 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
45.70 gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
45.71 add(jLabel3, gridBagConstraints);
45.72
45.73 gridBagConstraints = new java.awt.GridBagConstraints();
45.74 gridBagConstraints.gridx = 1;
45.75 - gridBagConstraints.gridy = 6;
45.76 + gridBagConstraints.gridy = 7;
45.77 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
45.78 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
45.79 add(jTextFieldFile, gridBagConstraints);
45.80 @@ -246,7 +249,7 @@
45.81 jPanel1.setOpaque(false);
45.82 gridBagConstraints = new java.awt.GridBagConstraints();
45.83 gridBagConstraints.gridx = 1;
45.84 - gridBagConstraints.gridy = 7;
45.85 + gridBagConstraints.gridy = 8;
45.86 gridBagConstraints.weightx = 1.0;
45.87 gridBagConstraints.weighty = 1.0;
45.88 add(jPanel1, gridBagConstraints);
45.89 @@ -255,15 +258,48 @@
45.90 jCheckBoxDetectInactivity.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
45.91 jCheckBoxDetectInactivity.setMargin(new java.awt.Insets(0, 0, 0, 0));
45.92 jCheckBoxDetectInactivity.setOpaque(false);
45.93 + jCheckBoxDetectInactivity.addActionListener(new java.awt.event.ActionListener() {
45.94 + public void actionPerformed(java.awt.event.ActionEvent evt) {
45.95 + jCheckBoxDetectInactivityActionPerformed(evt);
45.96 + }
45.97 + });
45.98 +
45.99 gridBagConstraints = new java.awt.GridBagConstraints();
45.100 gridBagConstraints.gridx = 0;
45.101 gridBagConstraints.gridy = 3;
45.102 + gridBagConstraints.gridwidth = 2;
45.103 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
45.104 - gridBagConstraints.insets = new java.awt.Insets(0, 0, 11, 12);
45.105 + gridBagConstraints.insets = new java.awt.Insets(0, 0, 11, 0);
45.106 add(jCheckBoxDetectInactivity, gridBagConstraints);
45.107
45.108 + org.openide.awt.Mnemonics.setLocalizedText(jCheckBoxAutoSwitchToComputed, org.openide.util.NbBundle.getBundle(UTOptionsPanel.class).getString("AutoSwithToComputed"));
45.109 + jCheckBoxAutoSwitchToComputed.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
45.110 + jCheckBoxAutoSwitchToComputed.setMargin(new java.awt.Insets(0, 0, 0, 0));
45.111 + jCheckBoxAutoSwitchToComputed.setOpaque(false);
45.112 + jCheckBoxAutoSwitchToComputed.addActionListener(new java.awt.event.ActionListener() {
45.113 + public void actionPerformed(java.awt.event.ActionEvent evt) {
45.114 + jCheckBoxAutoSwitchToComputedActionPerformed(evt);
45.115 + }
45.116 + });
45.117 +
45.118 + gridBagConstraints = new java.awt.GridBagConstraints();
45.119 + gridBagConstraints.gridx = 0;
45.120 + gridBagConstraints.gridy = 4;
45.121 + gridBagConstraints.gridwidth = 2;
45.122 + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
45.123 + gridBagConstraints.insets = new java.awt.Insets(0, 0, 11, 0);
45.124 + add(jCheckBoxAutoSwitchToComputed, gridBagConstraints);
45.125 +
45.126 }// </editor-fold>//GEN-END:initComponents
45.127
45.128 + private void jCheckBoxAutoSwitchToComputedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxAutoSwitchToComputedActionPerformed
45.129 + changed = true;
45.130 + }//GEN-LAST:event_jCheckBoxAutoSwitchToComputedActionPerformed
45.131 +
45.132 + private void jCheckBoxDetectInactivityActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxDetectInactivityActionPerformed
45.133 + changed = true;
45.134 + }//GEN-LAST:event_jCheckBoxDetectInactivityActionPerformed
45.135 +
45.136 private void jSpinnerDaysStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSpinnerDaysStateChanged
45.137 changed = true;
45.138 }//GEN-LAST:event_jSpinnerDaysStateChanged
45.139 @@ -286,6 +322,7 @@
45.140
45.141 // Variables declaration - do not modify//GEN-BEGIN:variables
45.142 public javax.swing.JCheckBox jCheckBoxAppend;
45.143 + public javax.swing.JCheckBox jCheckBoxAutoSwitchToComputed;
45.144 public javax.swing.JCheckBox jCheckBoxCollectWorkPeriods;
45.145 public javax.swing.JCheckBox jCheckBoxDetectInactivity;
45.146 public javax.swing.JCheckBox jCheckBoxSaveBackups;
46.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
46.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/renderers/DoneTreeTableCellRenderer.java Wed Dec 14 00:34:40 2005 +0000
46.3 @@ -0,0 +1,52 @@
46.4 +/*
46.5 + * Sun Public License Notice
46.6 + *
46.7 + * The contents of this file are subject to the Sun Public License
46.8 + * Version 1.0 (the "License"). You may not use this file except in
46.9 + * compliance with the License. A copy of the License is available at
46.10 + * http://www.sun.com/
46.11 + *
46.12 + * The Original Code is NetBeans. The Initial Developer of the Original
46.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
46.14 + * Microsystems, Inc. All Rights Reserved.
46.15 + */
46.16 +
46.17 +package org.netbeans.modules.tasklist.usertasks.renderers;
46.18 +
46.19 +import java.awt.Component;
46.20 +import org.netbeans.modules.tasklist.usertasks.UTUtils;
46.21 +import org.netbeans.modules.tasklist.usertasks.UserTaskTreeTableNode;
46.22 +import org.netbeans.modules.tasklist.usertasks.treetable.BooleanTableCellRenderer;
46.23 +import org.netbeans.modules.tasklist.usertasks.treetable.TreeTableRenderer;
46.24 +
46.25 +/**
46.26 + * Cell renderer for the "done" property.
46.27 + *
46.28 + * @author tl
46.29 + */
46.30 +public class DoneTreeTableCellRenderer extends BooleanTableCellRenderer
46.31 +implements TreeTableRenderer {
46.32 + /**
46.33 + * Creates a new instance of DoneTreeTableCellRenderer
46.34 + */
46.35 + public DoneTreeTableCellRenderer() {
46.36 + }
46.37 +
46.38 + public java.awt.Component getTreeTableCellRendererComponent(
46.39 + org.netbeans.modules.tasklist.usertasks.treetable.TreeTable table,
46.40 + Object node, Object value, boolean isSelected, boolean hasFocus,
46.41 + int row, int column) {
46.42 + Component cmp = super.getTableCellRendererComponent(
46.43 + table, value, isSelected, hasFocus,
46.44 + row, column);
46.45 + if (value == null)
46.46 + return cmp;
46.47 +
46.48 + if (node instanceof UserTaskTreeTableNode) {
46.49 + boolean b = ((UserTaskTreeTableNode) node).getUserTask().
46.50 + isProgressComputed();
46.51 + setEnabled(!b);
46.52 + }
46.53 + return this;
46.54 + }
46.55 +}
47.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/renderers/DueDateTableCellRenderer.java Tue Dec 13 10:52:35 2005 +0000
47.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/renderers/DueDateTableCellRenderer.java Wed Dec 14 00:34:40 2005 +0000
47.3 @@ -1,3 +1,16 @@
47.4 +/*
47.5 + * Sun Public License Notice
47.6 + *
47.7 + * The contents of this file are subject to the Sun Public License
47.8 + * Version 1.0 (the "License"). You may not use this file except in
47.9 + * compliance with the License. A copy of the License is available at
47.10 + * http://www.sun.com/
47.11 + *
47.12 + * The Original Code is NetBeans. The Initial Developer of the Original
47.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
47.14 + * Microsystems, Inc. All Rights Reserved.
47.15 + */
47.16 +
47.17 package org.netbeans.modules.tasklist.usertasks.renderers;
47.18
47.19 import java.awt.Color;
48.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/renderers/SummaryTreeCellRenderer.java Tue Dec 13 10:52:35 2005 +0000
48.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/renderers/SummaryTreeCellRenderer.java Wed Dec 14 00:34:40 2005 +0000
48.3 @@ -33,27 +33,10 @@
48.4
48.5 private static final long serialVersionUID = 1;
48.6
48.7 - private static final Image IMAGE =
48.8 - Utilities.loadImage("org/netbeans/modules/tasklist/core/task.gif"); // NOI18N
48.9 - private static final Image DONE =
48.10 - Utilities.loadImage("org/netbeans/modules/tasklist/core/doneItem.gif"); // NOI18N
48.11 - private static final Image UNMATCHED =
48.12 - Utilities.loadImage("org/netbeans/modules/tasklist/core/unmatched.gif"); // NOI18N
48.13 -
48.14 - private static final Image STARTED_BADGE =
48.15 - Utilities.loadImage("org/netbeans/modules/tasklist/usertasks/startedBadge.gif"); // NOI18N
48.16 -
48.17 - private static final Image IMAGE_STARTED =
48.18 - Utilities.mergeImages(IMAGE, STARTED_BADGE, 8, 8);
48.19 - private static final Image DONE_STARTED =
48.20 - Utilities.mergeImages(DONE, STARTED_BADGE, 8, 8);
48.21 - private static final Image UNMATCHED_STARTED =
48.22 - Utilities.mergeImages(UNMATCHED, STARTED_BADGE, 8, 8);
48.23 -
48.24 private ImageIcon icon = new ImageIcon();
48.25
48.26 public SummaryTreeCellRenderer() {
48.27 - ImageIcon icon = new ImageIcon(IMAGE);
48.28 + ImageIcon icon = new ImageIcon();
48.29
48.30 // see TreeTable.TreeTableCellEditor.getTableCellEditorComponent
48.31 setLeafIcon(icon);
48.32 @@ -67,28 +50,14 @@
48.33 super.getTreeCellRendererComponent(tree, value, selected, expanded,
48.34 leaf, row, hasFocus);
48.35 if (value instanceof UserTaskListTreeTableNode) {
48.36 - icon.setImage(IMAGE);
48.37 + icon.setImage(UserTaskIconProvider.getUserTaskListImage());
48.38 setText(NbBundle.getMessage(SummaryTreeCellRenderer.class,
48.39 "TaskList")); // NOI18N
48.40 } else {
48.41 UserTaskTreeTableNode utl = (UserTaskTreeTableNode) value;
48.42 UserTask ut = utl.getUserTask();
48.43 setText(ut.getSummary());
48.44 - if (ut.isStarted()) {
48.45 - if (utl.isUnmatched())
48.46 - icon.setImage(UNMATCHED_STARTED);
48.47 - else if (ut.isDone())
48.48 - icon.setImage(DONE_STARTED);
48.49 - else
48.50 - icon.setImage(IMAGE_STARTED);
48.51 - } else {
48.52 - if (utl.isUnmatched())
48.53 - icon.setImage(UNMATCHED);
48.54 - else if (ut.isDone())
48.55 - icon.setImage(DONE);
48.56 - else
48.57 - icon.setImage(IMAGE);
48.58 - }
48.59 + icon.setImage(UserTaskIconProvider.getUserTaskImage(ut, utl.isUnmatched()));
48.60 }
48.61 setIcon(icon);
48.62 return this;
49.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
49.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/renderers/UserTaskIconProvider.java Wed Dec 14 00:34:40 2005 +0000
49.3 @@ -0,0 +1,77 @@
49.4 +package org.netbeans.modules.tasklist.usertasks.renderers;
49.5 +
49.6 +import java.awt.Image;
49.7 +import org.netbeans.modules.tasklist.usertasks.model.UserTask;
49.8 +import org.openide.util.Utilities;
49.9 +
49.10 +/**
49.11 + * Returns an icon for a given UT.
49.12 + *
49.13 + * @author tl
49.14 + */
49.15 +public class UserTaskIconProvider {
49.16 + private static final Image LIST_IMAGE =
49.17 + Utilities.loadImage(
49.18 + "org/netbeans/modules/tasklist/usertasks/tasklistfile.gif"); // NOI18N
49.19 + private static final Image IMAGE =
49.20 + Utilities.loadImage(
49.21 + "org/netbeans/modules/tasklist/core/task.gif"); // NOI18N
49.22 + private static final Image DONE =
49.23 + Utilities.loadImage(
49.24 + "org/netbeans/modules/tasklist/core/doneItem.gif"); // NOI18N
49.25 + private static final Image UNMATCHED =
49.26 + Utilities.loadImage(
49.27 + "org/netbeans/modules/tasklist/core/unmatched.gif"); // NOI18N
49.28 +
49.29 + private static final Image STARTED_BADGE =
49.30 + Utilities.loadImage(
49.31 + "org/netbeans/modules/tasklist/usertasks/startedBadge.gif"); // NOI18N
49.32 +
49.33 + private static final Image IMAGE_STARTED =
49.34 + Utilities.mergeImages(IMAGE, STARTED_BADGE, 8, 8);
49.35 + private static final Image DONE_STARTED =
49.36 + Utilities.mergeImages(DONE, STARTED_BADGE, 8, 8);
49.37 + private static final Image UNMATCHED_STARTED =
49.38 + Utilities.mergeImages(UNMATCHED, STARTED_BADGE, 8, 8);
49.39 +
49.40 + /**
49.41 + * Returns the icon for a task list.
49.42 + *
49.43 + * @return the icon
49.44 + */
49.45 + public static Image getUserTaskListImage() {
49.46 + return LIST_IMAGE;
49.47 + }
49.48 +
49.49 + /**
49.50 + * Returns a 16x16 icon.
49.51 + *
49.52 + * @param ut a task
49.53 + * @param unmatched true for tasks that do not pass through the filter
49.54 + * but have children that do
49.55 + * @return icon
49.56 + */
49.57 + public static Image getUserTaskImage(UserTask ut, boolean unmatched) {
49.58 + if (ut.isStarted()) {
49.59 + if (unmatched)
49.60 + return UNMATCHED_STARTED;
49.61 + else if (ut.isDone())
49.62 + return DONE_STARTED;
49.63 + else
49.64 + return IMAGE_STARTED;
49.65 + } else {
49.66 + if (unmatched)
49.67 + return UNMATCHED;
49.68 + else if (ut.isDone())
49.69 + return DONE;
49.70 + else
49.71 + return IMAGE;
49.72 + }
49.73 + }
49.74 +
49.75 + /**
49.76 + * Creates a new instance of UserTaskIconProvider
49.77 + */
49.78 + private UserTaskIconProvider() {
49.79 + }
49.80 +}
50.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/translators/ICalExportFormat.java Tue Dec 13 10:52:35 2005 +0000
50.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/translators/ICalExportFormat.java Wed Dec 14 00:34:40 2005 +0000
50.3 @@ -60,6 +60,7 @@
50.4 import org.netbeans.modules.tasklist.core.util.ExtensionFileFilter;
50.5 import org.netbeans.modules.tasklist.core.util.ObjectList;
50.6 import org.netbeans.modules.tasklist.core.util.SimpleWizardPanel;
50.7 +import org.netbeans.modules.tasklist.usertasks.UserTaskViewRegistry;
50.8 import org.netbeans.modules.tasklist.usertasks.model.UserTask;
50.9 import org.netbeans.modules.tasklist.usertasks.model.UserTaskList;
50.10 import org.netbeans.modules.tasklist.usertasks.UserTaskView;
50.11 @@ -106,7 +107,8 @@
50.12 SaveFilePanel panel =
50.13 (SaveFilePanel) wd.getProperty(CHOOSE_FILE_PANEL_PROP);
50.14 try {
50.15 - UserTaskList list = (UserTaskList) UserTaskView.getCurrent().getUserTaskList();
50.16 + UserTaskList list = UserTaskViewRegistry.getInstance().
50.17 + getCurrent().getUserTaskList();
50.18 FileOutputStream fos = new FileOutputStream(panel.getFile());
50.19 try {
50.20 writeList(list, fos);
50.21 @@ -196,9 +198,10 @@
50.22 cal.getProperties().add(Version.VERSION_2_0);
50.23
50.24 Iterator it = list.getSubtasks().iterator();
50.25 + int[] p = new int[1];
50.26 while (it.hasNext()) {
50.27 UserTask item = (UserTask) it.next();
50.28 - writeTask(cal, item);
50.29 + writeTask(cal, item, p);
50.30 }
50.31
50.32 final List uids = new ArrayList();
50.33 @@ -267,15 +270,21 @@
50.34 *
50.35 * @param cal calendar object
50.36 * @param task The task/todo item to use
50.37 + * @param position position of the VTODO-element in cal.getComponents()
50.38 + * Length of the array should be 1 (in/out argument).
50.39 */
50.40 - private void writeTask(Calendar cal, UserTask task)
50.41 + private void writeTask(Calendar cal, UserTask task, int[] position)
50.42 throws IOException, URISyntaxException, ParseException, ValidationException {
50.43 VToDo vtodo = find(cal, task.getUID());
50.44 if (vtodo == null) {
50.45 vtodo = new VToDo();
50.46 vtodo.getProperties().add(new Uid(task.getUID()));
50.47 - cal.getComponents().add(vtodo);
50.48 + cal.getComponents().add(position[0], vtodo);
50.49 + } else {
50.50 + cal.getComponents().remove(vtodo);
50.51 + cal.getComponents().add(position[0], vtodo);
50.52 }
50.53 + position[0]++;
50.54
50.55 PropertyList pl = vtodo.getProperties();
50.56 Property prop = pl.getProperty(Property.CREATED);
50.57 @@ -559,7 +568,7 @@
50.58 Iterator it = task.getSubtasks().iterator();
50.59 while (it.hasNext()) {
50.60 UserTask subtask = (UserTask)it.next();
50.61 - writeTask(cal, subtask);
50.62 + writeTask(cal, subtask, position);
50.63 }
50.64 }
50.65
51.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/translators/XmlExportFormat.java Tue Dec 13 10:52:35 2005 +0000
51.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/translators/XmlExportFormat.java Wed Dec 14 00:34:40 2005 +0000
51.3 @@ -39,6 +39,7 @@
51.4 import org.netbeans.modules.tasklist.core.util.ExtensionFileFilter;
51.5 import org.netbeans.modules.tasklist.core.util.ObjectList;
51.6 import org.netbeans.modules.tasklist.core.util.SimpleWizardPanel;
51.7 +import org.netbeans.modules.tasklist.usertasks.UserTaskViewRegistry;
51.8 import org.netbeans.modules.tasklist.usertasks.model.UserTask;
51.9 import org.netbeans.modules.tasklist.usertasks.model.UserTaskList;
51.10 import org.netbeans.modules.tasklist.usertasks.UserTaskView;
51.11 @@ -133,7 +134,8 @@
51.12 SaveFilePanel panel =
51.13 (SaveFilePanel) wd.getProperty(CHOOSE_FILE_PANEL_PROP);
51.14 try {
51.15 - UserTaskList list = (UserTaskList) UserTaskView.getCurrent().getUserTaskList();
51.16 + UserTaskList list = UserTaskViewRegistry.getInstance().
51.17 + getCurrent().getUserTaskList();
51.18 Document doc = createXml(list);
51.19 Transformer t = createTransformer();
51.20 Source source = new DOMSource(doc);
52.1 --- a/tasklist.usertasks/test/unit/src/org/netbeans/modules/tasklist/usertasks/model/UserTaskListTest.java Tue Dec 13 10:52:35 2005 +0000
52.2 +++ b/tasklist.usertasks/test/unit/src/org/netbeans/modules/tasklist/usertasks/model/UserTaskListTest.java Wed Dec 14 00:34:40 2005 +0000
52.3 @@ -16,14 +16,15 @@
52.4 import java.io.ByteArrayInputStream;
52.5 import java.io.ByteArrayOutputStream;
52.6 import java.io.File;
52.7 -import java.util.Calendar;
52.8 -import java.util.Date;
52.9 -import java.util.GregorianCalendar;
52.10 +import java.io.IOException;
52.11 +import java.net.URISyntaxException;
52.12 +import java.text.ParseException;
52.13 import java.util.List;
52.14 import java.util.ListIterator;
52.15 -import java.util.TimeZone;
52.16
52.17 import junit.framework.Test;
52.18 +import net.fortuna.ical4j.data.ParserException;
52.19 +import net.fortuna.ical4j.model.ValidationException;
52.20
52.21 import org.netbeans.junit.NbTestCase;
52.22 import org.netbeans.junit.NbTestSuite;
52.23 @@ -33,8 +34,6 @@
52.24 import org.openide.filesystems.LocalFileSystem;
52.25 import org.openide.filesystems.Repository;
52.26 import org.openide.loaders.DataObject;
52.27 -import org.netbeans.modules.tasklist.usertasks.model.UserTask;
52.28 -import org.netbeans.modules.tasklist.usertasks.model.UserTaskList;
52.29
52.30 /**
52.31 * Test the usertask list functionality
52.32 @@ -63,6 +62,76 @@
52.33 }
52.34
52.35 /**
52.36 + * Save to/restore from .ics.
52.37 + *
52.38 + * @param utl this task list will be saved
52.39 + * @return restored from .ics task list
52.40 + */
52.41 + private UserTaskList saveAndLoad(UserTaskList utl) throws Exception {
52.42 + ByteArrayOutputStream out = new ByteArrayOutputStream();
52.43 + ICalExportFormat exp = new ICalExportFormat();
52.44 + exp.writeList(utl, out);
52.45 + ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
52.46 + ICalImportFormat imp = new ICalImportFormat();
52.47 +
52.48 + utl = new UserTaskList();
52.49 + imp.read(utl, in);
52.50 + return utl;
52.51 + }
52.52 +
52.53 + /**
52.54 + * Task list should preserve order of tasks.
52.55 + */
52.56 + public void testPreserveOrder() throws Exception {
52.57 + UserTaskList utl = new UserTaskList();
52.58 + UserTask ut = new UserTask("1", utl);
52.59 + UserTask ut2 = new UserTask("2", utl);
52.60 + UserTask ut3 = new UserTask("3", utl);
52.61 + utl.getSubtasks().add(ut);
52.62 + utl.getSubtasks().add(ut2);
52.63 + utl.getSubtasks().add(ut3);
52.64 +
52.65 + utl = saveAndLoad(utl);
52.66 +
52.67 + assertEquals("1", utl.getSubtasks().getUserTask(0).getSummary());
52.68 + assertEquals("2", utl.getSubtasks().getUserTask(1).getSummary());
52.69 + assertEquals("3", utl.getSubtasks().getUserTask(2).getSummary());
52.70 +
52.71 + utl.getSubtasks().getUserTask(1).moveUp();
52.72 +
52.73 + utl = saveAndLoad(utl);
52.74 +
52.75 + assertEquals("2", utl.getSubtasks().getUserTask(0).getSummary());
52.76 + assertEquals("1", utl.getSubtasks().getUserTask(1).getSummary());
52.77 + assertEquals("3", utl.getSubtasks().getUserTask(2).getSummary());
52.78 + }
52.79 +
52.80 + /**
52.81 + * Changing one task should not trigger the "last-modified" value of
52.82 + * other tasks in a list.
52.83 + */
52.84 + public void testLastModified() {
52.85 + UserTaskList utl = new UserTaskList();
52.86 + UserTask ut = new UserTask("test", utl);
52.87 + UserTask ut2 = new UserTask("test2", utl);
52.88 + UserTask ut3 = new UserTask("test2", utl);
52.89 + utl.getSubtasks().add(ut);
52.90 + utl.getSubtasks().add(ut2);
52.91 + ut.getSubtasks().add(ut3);
52.92 +
52.93 + ut2.setLastEditedDate(15);
52.94 +
52.95 + ut.setDone(true);
52.96 + assertEquals(15, ut2.getLastEditedDate());
52.97 +
52.98 + ut.setProgressComputed(true);
52.99 + ut.setEffortComputed(true);
52.100 + ut.setSpentTimeComputed(true);
52.101 + ut3.setDone(true);
52.102 + assertEquals(15, ut2.getLastEditedDate());
52.103 + }
52.104 +
52.105 + /**
52.106 * Deleting completed tasks.
52.107 */
52.108 public void testPurge() {