AttributeInfo.java
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
3  * All rights reserved. This program is made available under the terms of the
4  * Eclipse Public License v1.0 which accompanies this distribution, and is
5  * available at http://www.eclipse.org/legal/epl-v10.html
6  * Contributors:
7  * General Robotix Inc.
8  * National Institute of Advanced Industrial Science and Technology (AIST)
9  */
10 package com.generalrobotix.ui.view.graph;
11 
12 import java.awt.datatransfer.*;
13 import java.io.*;
14 
15 public class AttributeInfo implements Transferable, Serializable {
16  public static final DataFlavor dataFlavor
17  = new DataFlavor(AttributeInfo.class, null);
18 
19  public final String nodeType;
20  public final String objectName;
21  public final String nodeName;
22  public final String attribute;
23  public final int length;
24  public final String fullAttributeName;
25 
26  public AttributeInfo(
27  String nodeType,
28  String objectName,
29  String nodeName,
30  String attribute,
31  int length
32  ) {
33  this.nodeType = nodeType;
34  this.objectName = objectName;
35  this.nodeName = nodeName;
36  this.attribute = attribute;
37  this.length = length;
38  fullAttributeName = nodeType + "." + attribute;
39  }
40 
45  public DataFlavor[] getTransferDataFlavors() {
46  return new DataFlavor[]{dataFlavor};
47  }
48 
54  public boolean isDataFlavorSupported(DataFlavor flavor) {
55  return (flavor.equals(dataFlavor));
56  }
57 
63  public Object getTransferData(DataFlavor flavor)
64  throws UnsupportedFlavorException, IOException
65  {
66  if (flavor.equals(dataFlavor)) {
67  return this;
68  } else {
69  throw new UnsupportedFlavorException(flavor);
70  }
71  }
72 
78  public String toString() {
79  StringBuffer sb;
80  if (objectName == null) {
81  sb = new StringBuffer();
82  } else {
83  sb = new StringBuffer(objectName);
84  sb.append(".");
85  }
86  sb.append(nodeName);
87  sb.append(".");
88  sb.append(attribute);
89  sb.append(" (");
90  sb.append(nodeType);
91  sb.append(".");
92  sb.append(attribute);
93  if (length > 0) {
94  sb.append("[");
95  sb.append(length);
96  sb.append("]");
97  }
98  sb.append(")");
99 
100  return sb.toString();
101  }
102 }
boolean isDataFlavorSupported(DataFlavor flavor)
#define null
our own NULL pointer
Definition: IceTypes.h:57
AttributeInfo(String nodeType, String objectName, String nodeName, String attribute, int length)


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Sep 8 2022 02:24:02