📄 tvvirtualentity.java
字号:
/* * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. * * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is * described in this document. In particular, and without limitation, these intellectual property rights may * include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents * or pending patent applications in the U.S. and in other countries. * * U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. * standard license agreement and applicable provisions of the FAR and its supplements. * * Use is subject to license terms. * * This distribution may include materials developed by third parties. Sun, Sun Microsystems, the Sun logo and * Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. * * Copyright (c) 2006 Sun Microsystems, Inc. Tous droits r?serv?s. * * Sun Microsystems, Inc. d?tient les droits de propri?t? intellectuels relatifs ? la technologie incorpor?e dans * le produit qui est d?crit dans ce document. En particulier, et ce sans limitation, ces droits de propri?t? * intellectuelle peuvent inclure un ou plus des brevets am?ricains list?s ? l'adresse http://www.sun.com/patents * et un ou les brevets suppl?mentaires ou les applications de brevet en attente aux Etats - Unis et dans les * autres pays. * * L'utilisation est soumise aux termes du contrat de licence. * * Cette distribution peut comprendre des composants d?velopp?s par des tierces parties. * Sun, Sun Microsystems, le logo Sun et Java sont des marques de fabrique ou des marques d?pos?es de Sun * Microsystems, Inc. aux Etats-Unis et dans d'autres pays. */package com.sun.spot.spotworld.treeview;import com.sun.spot.spotworld.gui.ISpotWorldViewer;import com.sun.spot.spotworld.gui.IUIObject;import com.sun.spot.spotworld.gui.InfoPanel;import com.sun.spot.spotworld.virtualobjects.IVirtualObject;import java.io.File;import java.util.Enumeration;import java.util.Map;import javax.swing.JFileChooser;import javax.swing.JFrame;import javax.swing.JOptionPane;import javax.swing.tree.DefaultMutableTreeNode;import javax.swing.tree.MutableTreeNode;import javax.swing.tree.TreePath;/** * Repreenting a generic proxy. Currently used as a suerclass only. * @author taylorr */public class TVVirtualEntity extends TVObject implements IUIObject { IVirtualObject vObject = null; ISpotWorldViewer view; public void setVirtualObject(IVirtualObject obj) { vObject = obj; } public IVirtualObject getVirtualObject() { return vObject; } public void addObject(IUIObject obj) {} public void removeObject(IUIObject obj) {} public void select() { vObject.select(); } public void deselect() { vObject.deselect(); } public boolean isSelected(){ return vObject.isSelected(); } public void noteState(Object obj) { notifyListeners(); } public void add(IUIObject obj) { super.add((MutableTreeNode)obj); } public void remove(IUIObject obj) { super.remove((MutableTreeNode)obj); } /* remove from the tree strcuture. Try to be robust in the face of incoherent datastrauctures. */ public void delete() { TreePath path = new TreePath(getPath()); if(path.getParentPath() == null) return; DefaultMutableTreeNode parent = (DefaultMutableTreeNode) path.getParentPath().getLastPathComponent(); Enumeration e = parent.children(); boolean found = false; while(e.hasMoreElements()){ if(this == e.nextElement()) found = true; } if(found) parent.remove(this); notifyListeners(); } // Leave these here for now -- Robert public void displaySPOTTextOutput() { } public String getNewNameFromUser() { String name = JOptionPane.showInputDialog("New name", getName()); if (name == null) name = getName(); return name; } public void displaySPOTInfo(Map<String, String> dictionary) { final JFrame frame = new JFrame(); frame.setTitle("Info for " + dictionary.get("name") + " (" + dictionary.get("IEEE Address") + ")"); frame.setResizable(false); InfoPanel infP = InfoPanel.newPanel(dictionary); frame.add(infP); frame.pack(); frame.setVisible(true); } public File getAppDirFromUser() { JFileChooser fc = new JFileChooser("/Users/randy/projects/SVN-checkout/SPOTWorld-G"); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = fc.showOpenDialog(getView()); if (returnVal == JFileChooser.APPROVE_OPTION) { return fc.getSelectedFile(); } else return null; } public void doDeployment(){ }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -