![JAR search and dependency download from the Maven repository](/logo.png)
nl.cloudfarming.client.spray.tree.SprayTaskNode Maven / Gradle / Ivy
/**
* Copyright (C) 2008-2012 AgroSense Foundation.
*
* AgroSense is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* There are special exceptions to the terms and conditions of the GPLv3 as it is applied to
* this software, see the FLOSS License Exception
* .
*
* AgroSense is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AgroSense. If not, see .
*/
package nl.cloudfarming.client.spray.tree;
import java.awt.Image;
import java.awt.datatransfer.Transferable;
import java.io.IOException;
import java.io.Serializable;
import javax.swing.Action;
import nl.cloudfarming.client.spray.SprayTask;
import org.openide.nodes.FilterNode;
import org.openide.nodes.Node;
import org.openide.nodes.NodeTransfer;
import org.openide.util.ImageUtilities;
/**
* Node for the {@link SprayTask}
* @author maciek
*/
public class SprayTaskNode extends FilterNode implements Serializable {
private static final String ICON_PATH = "nl/cloudfarming/client/spray/to_do_list_checked_1.png";
private SprayTask task;
private Node original;
public SprayTaskNode(Node original, SprayTask task) {
super(original, Children.LEAF);
this.task = task;
this.original = original;
disableDelegation(DELEGATE_SET_NAME);
disableDelegation(DELEGATE_GET_NAME);
}
@Override
public void setName(String name) {
task.setName(name);
original.setDisplayName(name);
}
@Override
public String getName() {
return task.getName();
}
@Override
public String getDisplayName() {
return task.getName();
}
@Override
public Image getIcon(int type) {
return ImageUtilities.loadImage(ICON_PATH);
}
@Override
public Image getOpenedIcon(int type) {
return getIcon(type);
}
@Override
public Action[] getActions(boolean context) {
// List actions = (List) Utilities.actionsForPath("Actions/TaskNode");
// actions.addAll(Arrays.asList(super.getActions(context)));
// return actions.toArray(new Action[0]);
return super.getActions(context);
}
@Override
public Transferable clipboardCopy() throws IOException {
return NodeTransfer.transferable(this, NodeTransfer.CLIPBOARD_COPY);
}
@Override
public Transferable clipboardCut() throws IOException {
return clipboardCopy();
}
@Override
public Transferable drag() throws IOException {
return clipboardCopy();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy