类java.beans.Customizer源码实例Demo

下面列出了怎么用java.beans.Customizer的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: netbeans   文件: J2SELibraryTypeProvider.java
@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;
    }
}
 
源代码2 项目: netbeans   文件: J2SEPlatformCustomizer.java
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);
}
 
源代码5 项目: netbeans   文件: DebuggingTreeModel.java
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();
    }
}
 
源代码6 项目: netbeans   文件: LocalsTreeModel.java
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;
}
 
源代码7 项目: netbeans   文件: DeadlockDetectorImpl.java
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);
            }
        }
    }
}
 
源代码8 项目: netbeans   文件: ServerLibraryTypeProvider.java
public Customizer getCustomizer(String volumeType) {
    // avoid user confusion
    if (VOLUME_CLASSPATH.equals(volumeType) || VOLUME_JAVADOC.equals(volumeType)
            || VOLUME_SOURCE.equals(volumeType)) {
        return new ServerVolumeCustomizer(volumeType);
    }
    return null;
}
 
源代码9 项目: netbeans   文件: BreakpointCustomizeAction.java
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;
    }
}
 
源代码10 项目: netbeans   文件: CurrentThreadAnnotationListener.java
private void add(JPDAThread t) {
    ((Customizer) t).addPropertyChangeListener(this);
    //System.err.println("AllThreadsAnnotator("+Integer.toHexString(debugger.hashCode())+").add("+t+")");
    annotate(t);
}
 
源代码11 项目: netbeans   文件: DebuggingNodeModel.java
public ThreadStateUpdater(JPDAThread t) {
    this.tr = new WeakReference(t);
    ((Customizer) t).addPropertyChangeListener(WeakListeners.propertyChange(this, t));
}
 
源代码12 项目: netbeans   文件: DebuggingTreeModel.java
public ThreadStateListener(JPDAThread t) {
    this.tr = new WeakReference(t);
    this.propertyChangeListener = WeakListeners.propertyChange(this, t);
    ((Customizer) t).addPropertyChangeListener(propertyChangeListener);
}
 
源代码13 项目: netbeans   文件: CPExtenderTest.java
public @Override Customizer getCustomizer(String volumeType) {
    return null;
}
 
源代码14 项目: netbeans   文件: JSWatchVar.java
JSWatchVar(JPDADebugger debugger, JPDAWatch watch) {
    this.debugger = debugger;
    this.watch = watch;
    //((Refreshable) watch).isCurrent();
    ((Customizer) watch).addPropertyChangeListener(this);
}
 
源代码15 项目: netbeans   文件: J2SEProjectGeneratorTest.java
@Override
public Customizer getCustomizer(String volumeType) {
    return null;
}
 
源代码16 项目: netbeans   文件: J2eeLibraryTypeProvider.java
/**
 * Currently returns <code>null</code>.
 */
public Customizer getCustomizer(String volumeType) {
    return null;
}
 
源代码17 项目: netbeans   文件: LibrariesCustomizer.java
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);
        }
    }        
}
 
源代码18 项目: netbeans   文件: ViewModelListener.java
private static void addAsCustomizers(List<Customizer> modelListCustomizerLists, Object[] modelLists) {
    for (int i = 0; i < modelLists.length; i++) {
        modelListCustomizerLists.add((Customizer) modelLists[i]);
    }
}
 
源代码19 项目: netbeans   文件: Lookup.java
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;
}
 
源代码20 项目: netbeans   文件: LibraryTypeProvider.java
/**
 * 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);
 
 类所在包
 类方法
 同包方法