< prev index next >

src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Slot.java

Print this page


   1 /*
   2  * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 package com.sun.hotspot.igv.graph;
  25 
  26 import com.sun.hotspot.igv.data.InputNode;
  27 import com.sun.hotspot.igv.data.Properties;
  28 import com.sun.hotspot.igv.data.Source;
  29 import com.sun.hotspot.igv.layout.Port;
  30 import com.sun.hotspot.igv.layout.Vertex;

  31 import java.awt.Color;
  32 import java.awt.Font;
  33 import java.awt.FontMetrics;
  34 import java.awt.Graphics;
  35 import java.awt.image.BufferedImage;
  36 import java.util.ArrayList;
  37 import java.util.Collections;
  38 import java.util.Comparator;
  39 import java.util.List;
  40 
  41 /**
  42  *
  43  * @author Thomas Wuerthinger
  44  */
  45 public abstract class Slot implements Port, Source.Provider, Properties.Provider {
  46 
  47     private int wantedIndex;
  48     private Source source;
  49     protected List<Connection> connections;
  50     private InputNode associatedNode;


 124     public String getText() {
 125         return text;
 126     }
 127 
 128     public void setShortName(String s) {
 129         assert s != null;
 130 //        assert s.length() <= 2;
 131         this.shortName = s;
 132 
 133     }
 134 
 135     public String getShortName() {
 136         return shortName;
 137     }
 138 
 139     public String getToolTipText() {
 140         StringBuilder sb = new StringBuilder();
 141         sb.append(text);
 142 
 143         for (InputNode n : getSource().getSourceNodes()) {
 144             sb.append("Node (ID=" + n.getId() + "): " + n.getProperties().get("name"));
 145             sb.append("<br>");
 146         }
 147 
 148         return sb.toString();
 149     }
 150 
 151     public boolean shouldShowName() {
 152         return getShortName() != null && getShortName().length() > 0;
 153     }
 154 
 155     public void setText(String s) {
 156         if (s == null) {
 157             s = "";
 158         }
 159         this.text = s;
 160     }
 161 
 162     public Figure getFigure() {
 163         assert figure != null;
 164         return figure;


   1 /*
   2  * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 package com.sun.hotspot.igv.graph;
  25 
  26 import com.sun.hotspot.igv.data.InputNode;
  27 import com.sun.hotspot.igv.data.Properties;
  28 import com.sun.hotspot.igv.data.Source;
  29 import com.sun.hotspot.igv.layout.Port;
  30 import com.sun.hotspot.igv.layout.Vertex;
  31 import com.sun.hotspot.igv.util.StringUtils;
  32 import java.awt.Color;
  33 import java.awt.Font;
  34 import java.awt.FontMetrics;
  35 import java.awt.Graphics;
  36 import java.awt.image.BufferedImage;
  37 import java.util.ArrayList;
  38 import java.util.Collections;
  39 import java.util.Comparator;
  40 import java.util.List;
  41 
  42 /**
  43  *
  44  * @author Thomas Wuerthinger
  45  */
  46 public abstract class Slot implements Port, Source.Provider, Properties.Provider {
  47 
  48     private int wantedIndex;
  49     private Source source;
  50     protected List<Connection> connections;
  51     private InputNode associatedNode;


 125     public String getText() {
 126         return text;
 127     }
 128 
 129     public void setShortName(String s) {
 130         assert s != null;
 131 //        assert s.length() <= 2;
 132         this.shortName = s;
 133 
 134     }
 135 
 136     public String getShortName() {
 137         return shortName;
 138     }
 139 
 140     public String getToolTipText() {
 141         StringBuilder sb = new StringBuilder();
 142         sb.append(text);
 143 
 144         for (InputNode n : getSource().getSourceNodes()) {
 145             sb.append(StringUtils.escapeHTML("Node (ID=" + n.getId() + "): " + n.getProperties().get("name")));
 146             sb.append("<br>");
 147         }
 148 
 149         return sb.toString();
 150     }
 151 
 152     public boolean shouldShowName() {
 153         return getShortName() != null && getShortName().length() > 0;
 154     }
 155 
 156     public void setText(String s) {
 157         if (s == null) {
 158             s = "";
 159         }
 160         this.text = s;
 161     }
 162 
 163     public Figure getFigure() {
 164         assert figure != null;
 165         return figure;


< prev index next >