alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

package org.netbeans.modules.tasklist.usertasks;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Action;

import org.netbeans.modules.tasklist.core.ExpandAllAction;
import org.netbeans.modules.tasklist.core.ExportAction;
import org.netbeans.modules.tasklist.core.ImportAction;
import org.netbeans.modules.tasklist.core.TLUtils;
import org.netbeans.modules.tasklist.core.TaskListNode;
import org.netbeans.modules.tasklist.core.filter.FilterAction;
import org.netbeans.modules.tasklist.usertasks.treetable.DefaultMutableTreeTableNode;
import org.openide.actions.PasteAction;
import org.openide.util.NbBundle;
import org.openide.util.actions.SystemAction;

/**
 * Node for a user task list
 */
public class UserTaskListNode extends TaskListNode {
    private UserTaskList tasklist;
    private UserTasksTreeTable utt;
    
    /**
     * Creates plain tasklist node. Properties that cannot
     * be derrived from passed tasklist should be provided by
     * client. It covers displayName etc.
     *
     * @param tasklist to be visualized never null
     * @param utt TT with user tasks
     * @param node TT node representing this node
     */
    public UserTaskListNode(UserTaskList tasklist, UserTasksTreeTable utt) {
        super(tasklist);
        this.tasklist = tasklist;
        this.utt = utt;
        updateIcon();
        setDisplayName(NbBundle.getMessage(UserTaskListNode.class, 
            "RootTaskSummary")); // NOI18N
    }

    /**
     * Returns the tasklist associated with this node
     *
     * @return user task list
     */
    public UserTaskList getUserTaskList() {
        return tasklist;
    }
    
    /**
     * Adds a task
     *
     * @param task the task to be added
     */
    public void addTask(UserTask ut) {
        /* TODO((UserTaskList) getUserObject()).addTasks(
            Collections.singletonList(ut), true);*/
        
    }
    
    public Action[] getActions(boolean empty) {
        return new SystemAction[] {
            SystemAction.get(NewTaskAction.class),
            SystemAction.get(NewTaskListAction.class),
            null,
            SystemAction.get(PasteAction.class),
            null,
            SystemAction.get(FilterAction.class),
            SystemAction.get(PurgeTasksAction.class),
            SystemAction.get(ExpandAllAction.class),
            null,
            SystemAction.get(ImportAction.class),
            SystemAction.get(ExportAction.class),
        };
    }

    protected void updateIcon() {
        UTUtils.LOGGER.fine("updating icon");  // NOI18N
        setIconBase("org/netbeans/modules/tasklist/core/task"); // NOI18N
    }
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.