/** * Constructor taking the parent frame, the customizer component * and the target bean as arguments. */ public CustomizerDialog(Frame frame, Customizer customizer, Object target) { super(frame, customizer.getClass().getName(), true); setLayout(null); body = (Component) customizer; add(body); doneButton = new Button("Done"); doneButton.addActionListener(this); add(doneButton); int x = frame.getLocation().x + 30; int y = frame.getLocation().y + 100; setLocation(x, y); setVisible(true); }
/** * Get values from element to fill propertyMap and setup customizer * @param element TestElement */ private void setValues(TestElement element) { // Copy all property values into the map: for (PropertyIterator jprops = element.propertyIterator(); jprops.hasNext();) { JMeterProperty jprop = jprops.next(); propertyMap.put(jprop.getName(), jprop.getObjectValue()); } if (customizer != null) { customizer.setObject(propertyMap); } else { if (initialized){ remove(customizerIndexInPanel); } Customizer c = customizers.get(element); if (c == null) { c = createCustomizer(); c.setObject(propertyMap); customizers.put(element, c); } add((Component) c, BorderLayout.CENTER); } }
@Override public Customizer getCustomizer(String volumeType) { if (VOLUME_TYPES[0].equals(volumeType)|| VOLUME_TYPES[1].equals(volumeType)|| VOLUME_TYPES[2].equals(volumeType)) { return new J2SEVolumeCustomizer (volumeType); } else { return null; } }
private void initComponents () { this.getAccessibleContext().setAccessibleName (NbBundle.getMessage(J2SEPlatformCustomizer.class,"AN_J2SEPlatformCustomizer")); this.getAccessibleContext().setAccessibleDescription (NbBundle.getMessage(J2SEPlatformCustomizer.class,"AD_J2SEPlatformCustomizer")); this.addTab(NbBundle.getMessage(J2SEPlatformCustomizer.class,"TXT_Classes"), createPathTab(CLASSPATH)); this.addTab(NbBundle.getMessage(J2SEPlatformCustomizer.class,"TXT_Sources"), createPathTab(SOURCES)); this.addTab(NbBundle.getMessage(J2SEPlatformCustomizer.class,"TXT_Javadoc"), createPathTab(JAVADOC)); final Lookup lkp = Lookups.forPath(CUSTOMIZERS_PATH); final boolean isDefaultPlatform = platform instanceof DefaultPlatformImpl; for (Lookup.Item<? extends Customizer> li : lkp.lookupResult(Customizer.class).allItems()) { final Customizer c = li.getInstance(); if (!(c instanceof Component)) { continue; } String name = li.getId(); final FileObject fo = FileUtil.getConfigFile(String.format("%s.instance",name)); //NOI18N if (fo != null) { try { name = fo.getFileSystem().getDecorator().annotateName(fo.getName(), Collections.<FileObject>singleton(fo)); } catch (FileStateInvalidException ex) { name = fo.getName(); } if (isDefaultPlatform && fo.getAttribute(SUPPORTS_DEFAULT_PLATFORM) == Boolean.FALSE) { continue; } } c.setObject(platform); this.addTab(name, (Component)c); } }
private void remove(JPDAThread t) { ((Customizer) t).removePropertyChangeListener(this); //System.err.println("AllThreadsAnnotator("+Integer.toHexString(debugger.hashCode())+").remove("+t+")"); synchronized (this) { Object annotation = threadAnnotations.remove(t); if (annotation != null) { threadsToAnnotate.remove(t); annotationsToRemove.add(annotation); task.schedule(ANNOTATION_SCHEDULE_TIME); } } }
@Override public void propertyChange(PropertyChangeEvent evt) { synchronized (this) { if (!active) { ((Customizer) evt.getSource()).removePropertyChangeListener(this); return ; } } JPDAThread t = (JPDAThread) evt.getSource(); annotate(t); }
private void destroyThreadStateListeners() { synchronized (threadStateListeners) { for (Map.Entry<JPDAThread, ThreadStateListener> entry : threadStateListeners.entrySet()) { PropertyChangeListener pcl = entry.getValue().getThreadPropertyChangeListener(); ((Customizer) entry.getKey()).removePropertyChangeListener(pcl); } threadStateListeners.clear(); } }
public Object[] getChildren (Object o, int from, int to) throws UnknownTypeException { Object[] ch = getChildrenImpl(o, from, to); for (int i = 0; i < ch.length; i++) { if (ch[i] instanceof Customizer) { ((Customizer) ch[i]).addPropertyChangeListener(this); } } return ch; }
private Customizer getCustomizer(Breakpoint b) { Class cc = getCustomizerClass(b); if (cc == null) return null; try { Customizer c = (Customizer) cc.newInstance(); c.setObject(b); return c; } catch (Exception ex) { Exceptions.printStackTrace(ex); return null; } }
DeadlockDetectorImpl(JPDADebugger debugger) { debugger.addPropertyChangeListener(this); List<JPDAThread> threads = debugger.getThreadsCollector().getAllThreads(); for (JPDAThread thread : threads) { ((Customizer) thread).addPropertyChangeListener(WeakListeners.propertyChange(this, thread)); if (thread.isSuspended()) { synchronized (suspendedThreads) { suspendedThreads.add(thread); } } } }
/** * Popup the customizer for this bean * * @param custClass the class of the customizer * @param bc the bean to be customized */ private void popupCustomizer(Class custClass, JComponent bc) { try { // instantiate final Object customizer = custClass.newInstance(); // set environment **before** setting object!! if (customizer instanceof EnvironmentHandler) { ((EnvironmentHandler) customizer).setEnvironment(m_flowEnvironment); } ((Customizer) customizer).setObject(bc); final javax.swing.JFrame jf = new javax.swing.JFrame(); jf.getContentPane().setLayout(new BorderLayout()); jf.getContentPane().add((JComponent) customizer, BorderLayout.CENTER); if (customizer instanceof CustomizerCloseRequester) { ((CustomizerCloseRequester) customizer).setParentFrame(jf); } jf.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent e) { if (customizer instanceof CustomizerClosingListener) { ((CustomizerClosingListener) customizer).customizerClosing(); } jf.dispose(); } }); jf.pack(); jf.setVisible(true); } catch (Exception ex) { ex.printStackTrace(); } }
private void add(JPDAThread t) { ((Customizer) t).addPropertyChangeListener(this); //System.err.println("AllThreadsAnnotator("+Integer.toHexString(debugger.hashCode())+").add("+t+")"); annotate(t); }
public ThreadStateUpdater(JPDAThread t) { this.tr = new WeakReference(t); ((Customizer) t).addPropertyChangeListener(WeakListeners.propertyChange(this, t)); }
public ThreadStateListener(JPDAThread t) { this.tr = new WeakReference(t); this.propertyChangeListener = WeakListeners.propertyChange(this, t); ((Customizer) t).addPropertyChangeListener(propertyChangeListener); }
private void selectLibrary (Node[] nodes) { int tabCount = this.properties.getTabCount(); for (int i=0; i<tabCount; i++) { this.properties.removeTabAt(0); } this.libraryName.setEnabled(false); this.libraryName.setText(""); //NOI18N this.jLabel1.setVisible(false); this.libraryName.setVisible(false); this.properties.setVisible(false); this.deleteButton.setEnabled(false); if (nodes.length != 1) { return; } LibraryImplementation impl = nodes[0].getLookup().lookup(LibraryImplementation.class); if (impl == null) { return; } this.jLabel1.setVisible(true); this.libraryName.setVisible(true); this.properties.setVisible(true); boolean editable = model.isLibraryEditable (impl); this.libraryName.setEnabled(editable && LibrariesSupport.supportsDisplayName(impl)); this.deleteButton.setEnabled(editable); this.libraryName.setText (LibrariesSupport.getLocalizedName(impl)); LibraryTypeProvider provider = nodes[0].getLookup().lookup(LibraryTypeProvider.class); if (provider == null) { return; } LibraryCustomizerContextWrapper customizerContext; LibraryStorageArea area = nodes[0].getLookup().lookup(LibraryStorageArea.class); if (area != LibraryStorageArea.GLOBAL) { customizerContext = new LibraryCustomizerContextWrapper(impl, area); File f = Utilities.toFile(URI.create(area.getLocation().toExternalForm())); this.libraryLocation.setText(f.getPath()); } else { customizerContext = new LibraryCustomizerContextWrapper(impl, null); this.libraryLocation.setText(LABEL_Global_Libraries()); } String[] volumeTypes = provider.getSupportedVolumeTypes(); for (int i=0; i< volumeTypes.length; i++) { Customizer c = provider.getCustomizer (volumeTypes[i]); if (c instanceof JComponent) { c.setObject (customizerContext); JComponent component = (JComponent) c; component.setEnabled (editable); String tabName = component.getName(); if (tabName == null) { tabName = volumeTypes[i]; } this.properties.addTab(tabName, component); } } }
public @Override Customizer getCustomizer(String volumeType) { return null; }
JSWatchVar(JPDADebugger debugger, JPDAWatch watch) { this.debugger = debugger; this.watch = watch; //((Refreshable) watch).isCurrent(); ((Customizer) watch).addPropertyChangeListener(this); }
@Override public Customizer getCustomizer(String volumeType) { return null; }
private static void addAsCustomizers(List<Customizer> modelListCustomizerLists, Object[] modelLists) { for (int i = 0; i < modelLists.length; i++) { modelListCustomizerLists.add((Customizer) modelLists[i]); } }
private synchronized void setUp() { clear(); List<? extends T> list1 = l1.lookup(folder, service); List<? extends T> list2 = l2.lookup(folder, service); if (list1 instanceof PositionedList || list2 instanceof PositionedList) { List<PositionedElement> positioned = new ArrayList<PositionedElement>(); List<T> others = new ArrayList<T>(); boolean hp1 = false; if (list1 instanceof PositionedList) { PositionedList<? extends T> ml1 = (PositionedList<? extends T>) list1; if (ml1.hasPositions()) { fillElements(ml1, positioned, others); hp1 = true; } } boolean hp2 = false; if (list2 instanceof PositionedList) { PositionedList<? extends T> ml2 = (PositionedList<? extends T>) list2; if (ml2.hasPositions()) { fillElements(ml2, positioned, others); hp2 = true; } } if (hp1 && hp2) { // merge if (!positioned.isEmpty()) { Collections.sort(positioned); Set<String> hiddenClassNames = new HashSet<String>(); addHiddenClassNames(list1, hiddenClassNames); addHiddenClassNames(list2, hiddenClassNames); List<T> sorted = new LookupList<T>(hiddenClassNames); for (PositionedElement<T> pe : positioned) { sorted.add(pe.element); } positionedElements = positioned; list1 = sorted; } else { list1 = Collections.emptyList(); } list2 = others; } else if (hp1) { positionedElements = positioned; } else if (hp2) { positionedElements = positioned; List<? extends T> switchList = list1; list1 = list2; list2 = switchList; } } addAll (list1); addAll (list2); sublist1 = (list1 instanceof Customizer) ? (Customizer) list1 : null; sublist2 = (list2 instanceof Customizer) ? (Customizer) list2 : null; }
/** * Popup the customizer for this bean * * @param custClass the class of the customizer * @param bc the bean to be customized */ private void popupCustomizer(Class<?> custClass, JComponent bc) { try { // instantiate final Object customizer = custClass.newInstance(); // set environment **before** setting object!! if (customizer instanceof EnvironmentHandler) { ((EnvironmentHandler) customizer).setEnvironment(m_flowEnvironment); } if (customizer instanceof BeanCustomizer) { ((BeanCustomizer) customizer).setModifiedListener(this); } ((Customizer) customizer).setObject(bc); // final javax.swing.JFrame jf = new javax.swing.JFrame(); final JDialog d = new JDialog( (java.awt.Frame) KnowledgeFlowApp.this.getTopLevelAncestor(), ModalityType.DOCUMENT_MODAL); d.setLayout(new BorderLayout()); d.getContentPane().add((JComponent) customizer, BorderLayout.CENTER); // jf.getContentPane().setLayout(new BorderLayout()); // jf.getContentPane().add((JComponent)customizer, BorderLayout.CENTER); if (customizer instanceof CustomizerCloseRequester) { ((CustomizerCloseRequester) customizer).setParentWindow(d); } d.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent e) { if (customizer instanceof CustomizerClosingListener) { ((CustomizerClosingListener) customizer).customizerClosing(); } d.dispose(); } }); // jf.pack(); // jf.setVisible(true); d.pack(); d.setLocationRelativeTo(KnowledgeFlowApp.this); d.setVisible(true); } catch (Exception ex) { ex.printStackTrace(); } }
/** * Popup the customizer for this bean * * @param custClass the class of the customizer * @param bc the bean to be customized */ private void popupCustomizer(Class custClass, JComponent bc) { try { // instantiate final Object customizer = custClass.newInstance(); // set environment **before** setting object!! if (customizer instanceof EnvironmentHandler) { ((EnvironmentHandler)customizer).setEnvironment(m_flowEnvironment); } if (customizer instanceof BeanCustomizer) { ((BeanCustomizer)customizer).setModifiedListener(this); } ((Customizer)customizer).setObject(bc); // final javax.swing.JFrame jf = new javax.swing.JFrame(); final JDialog d = new JDialog((java.awt.Frame)KnowledgeFlowApp.this.getTopLevelAncestor(), ModalityType.DOCUMENT_MODAL); d.setLayout(new BorderLayout()); d.getContentPane().add((JComponent)customizer, BorderLayout.CENTER); // jf.getContentPane().setLayout(new BorderLayout()); // jf.getContentPane().add((JComponent)customizer, BorderLayout.CENTER); if (customizer instanceof CustomizerCloseRequester) { ((CustomizerCloseRequester)customizer).setParentWindow(d); } d.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent e) { if (customizer instanceof CustomizerClosingListener) { ((CustomizerClosingListener)customizer).customizerClosing(); } d.dispose(); } }); // jf.pack(); // jf.setVisible(true); d.pack(); d.setLocationRelativeTo(KnowledgeFlowApp.this); d.setVisible(true); } catch (Exception ex) { ex.printStackTrace(); } }
synchronized void setCustomizer(Customizer c) { if (c != null) c.addPropertyChangeListener(_frame); }
/** * Returns customizer for given volume's type, or null if the volume is not customizable. * The <code>LibraryCustomizerContext</code> instance is passed * to the customizer's setObject method. * The customized object describes the library created by this * provider, but the customizer cannot assume that the customized * object is of the same type as the object created by {@link #createLibrary}. * @param volumeType a type of volume listed in {@link #getSupportedVolumeTypes} * @return a customizer (must extend {@link javax.swing.JComponent}) or null if such * customizer doesn't exist. */ public Customizer getCustomizer (String volumeType);