1 23 24 package org.objectweb.fractal.gui; 25 26 import org.objectweb.fractal.swing.JTabbedPaneImpl; 27 import org.objectweb.fractal.gui.model.ConfigurationListener; 28 import org.objectweb.fractal.gui.model.Component; 29 import org.objectweb.fractal.gui.model.Interface; 30 import org.objectweb.fractal.gui.model.ClientInterface; 31 import org.objectweb.fractal.gui.model.ServerInterface; 32 33 public class TitlePane extends JTabbedPaneImpl 34 implements ConfigurationListener 35 { 36 37 41 public void changeCountChanged (Component component, long changeCount) { 42 updateTitle(component); 43 } 44 45 public void rootComponentChanged (final Component oldValue) { 46 } 48 49 public void nameChanged (final Component component, final String oldValue) { 50 updateTitle(component); 51 } 52 53 public void typeChanged (final Component component, final String oldValue) { 54 updateTitle(component); 55 } 56 57 public void implementationChanged ( 58 final Component component, 59 final String oldValue) 60 { 61 updateTitle(component); 62 } 63 64 public void interfaceNameChanged (final Interface i, final String oldValue) { 65 updateTitle(i.getOwner()); 66 } 67 68 public void interfaceSignatureChanged ( 69 final Interface i, 70 final String oldValue) 71 { 72 updateTitle(i.getOwner()); 73 } 74 75 public void interfaceContingencyChanged ( 76 final Interface i, 77 final boolean oldValue) 78 { 79 updateTitle(i.getOwner()); 80 } 81 82 public void interfaceCardinalityChanged ( 83 final Interface i, 84 final boolean oldValue) 85 { 86 updateTitle(i.getOwner()); 87 } 88 89 public void clientInterfaceAdded ( 90 final Component component, 91 final ClientInterface i, 92 final int index) 93 { 94 updateTitle(component); 95 } 96 97 public void clientInterfaceRemoved ( 98 final Component component, 99 final ClientInterface i, 100 final int index) 101 { 102 updateTitle(component); 103 } 104 105 public void serverInterfaceAdded ( 106 final Component component, 107 final ServerInterface i, 108 final int index) 109 { 110 updateTitle(component); 111 } 112 113 public void serverInterfaceRemoved ( 114 final Component component, 115 final ServerInterface i, 116 final int index) 117 { 118 updateTitle(component); 119 } 120 121 public void interfaceBound ( 122 final ClientInterface citf, final ServerInterface sitf) 123 { 124 updateTitle(citf.getOwner()); 125 } 126 127 public void interfaceRebound ( 128 final ClientInterface citf, 129 final ServerInterface oldSitf) 130 { 131 updateTitle(citf.getOwner()); 132 } 133 134 public void interfaceUnbound ( 135 final ClientInterface citf, 136 final ServerInterface sitf) 137 { 138 updateTitle(citf.getOwner()); 139 } 140 141 public void attributeControllerChanged ( 142 final Component component, 143 final String oldValue) 144 { 145 updateTitle(component); 146 } 147 148 public void attributeChanged ( 149 final Component component, 150 final String attributeName, 151 final String oldValue) 152 { 153 updateTitle(component); 154 } 155 156 public void templateControllerDescriptorChanged ( 157 final Component component, 158 final String oldValue) 159 { 160 updateTitle(component); 161 } 162 163 public void componentControllerDescriptorChanged ( 164 final Component component, 165 final String oldValue) 166 { 167 updateTitle(component); 168 } 169 170 public void subComponentAdded ( 171 final Component parent, 172 final Component child, 173 final int index) 174 { 175 updateTitle(parent); 176 } 177 178 public void subComponentRemoved ( 179 final Component parent, 180 final Component child, 181 final int index) 182 { 183 updateTitle(parent); 184 } 185 186 190 private void updateTitle (final Component c) { 191 String title = c.getRootComponent().getName(); 192 if (c.getConfiguration().getChangeCount() != 0) { 193 title += "*"; } 195 if (!getTitleAt(0).equals(title)) { 196 setTitleAt(0, title); 197 } 198 } 199 } 200 | Popular Tags |