AttributeInfo.java
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
00003  * All rights reserved. This program is made available under the terms of the
00004  * Eclipse Public License v1.0 which accompanies this distribution, and is
00005  * available at http://www.eclipse.org/legal/epl-v10.html
00006  * Contributors:
00007  * General Robotix Inc.
00008  * National Institute of Advanced Industrial Science and Technology (AIST) 
00009  */
00010 package com.generalrobotix.ui.view.graph;
00011 
00012 import java.awt.datatransfer.*;
00013 import java.io.*;
00014 
00015 public class AttributeInfo implements Transferable, Serializable {
00016     public static final DataFlavor dataFlavor
00017         = new DataFlavor(AttributeInfo.class, null);
00018 
00019     public final String nodeType;
00020     public final String objectName;
00021     public final String nodeName;
00022     public final String attribute;
00023     public final int length;
00024     public final String fullAttributeName;
00025 
00026     public AttributeInfo(
00027         String nodeType,
00028         String objectName,
00029         String nodeName,
00030         String attribute,
00031         int length
00032     ) {
00033         this.nodeType   = nodeType;
00034         this.objectName = objectName;
00035         this.nodeName   = nodeName;
00036         this.attribute  = attribute;
00037         this.length     = length;
00038         fullAttributeName = nodeType + "." + attribute;
00039     }
00040 
00045     public DataFlavor[] getTransferDataFlavors() {
00046         return new DataFlavor[]{dataFlavor};
00047     }
00048 
00054     public boolean isDataFlavorSupported(DataFlavor flavor) {
00055         return (flavor.equals(dataFlavor));
00056     }
00057 
00063     public Object getTransferData(DataFlavor flavor)
00064         throws UnsupportedFlavorException, IOException
00065     {
00066         if (flavor.equals(dataFlavor)) {
00067             return this;
00068         } else {
00069             throw new UnsupportedFlavorException(flavor);
00070         }
00071     }
00072 
00078     public String toString() {
00079         StringBuffer sb;
00080         if (objectName == null) {
00081             sb = new StringBuffer();
00082         } else {
00083             sb = new StringBuffer(objectName);
00084             sb.append(".");
00085         }
00086         sb.append(nodeName);
00087         sb.append(".");
00088         sb.append(attribute);
00089         sb.append(" (");
00090         sb.append(nodeType);
00091         sb.append(".");
00092         sb.append(attribute);
00093         if (length > 0) {
00094             sb.append("[");
00095             sb.append(length);
00096             sb.append("]");
00097         }
00098         sb.append(")");
00099 
00100         return sb.toString();
00101     }
00102 }


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Apr 11 2019 03:30:15