Java Code Examples for javax.swing.JCheckBox#getClientProperty()

The following examples show how to use javax.swing.JCheckBox#getClientProperty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultFoldingOptions.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private String updateCheckers(PreferenceChangeEvent evt) {
    String pk = evt.getKey();
    if (pk != null) {
        if (pk.equals(SimpleValueNames.CODE_FOLDING_ENABLE)) {
            updateEnabledState();
            return pk;
        }
        if (pk.equals(PREF_OVERRIDE_DEFAULTS)) {
            updateOverrideChanged();
        } else if (!pk.startsWith(COLLAPSE_PREFIX)) {
            return pk;
        }
    } else {
        updateEnabledState();
    }
    String c = pk == null ? null : pk.substring(COLLAPSE_PREFIX.length());
    for (JCheckBox cb : controls) {
        FoldType ft = (FoldType)cb.getClientProperty("type"); // NOI18N
        FoldType ftp = ft.parent();
        if (c == null || ft.code().equals(c) || (ftp != null && ftp.code().equals(c))) {
            updateChecker(pk, cb, ft);
            return pk;
        }
    }
    return pk;
}
 
Example 2
Source File: DefaultFoldingOptions.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void updatePref(ItemEvent e) {
    JCheckBox cb = (JCheckBox)e.getSource();
    FoldType ft = (FoldType)cb.getClientProperty("type"); // NOI18N
    
    String prefKey = COLLAPSE_PREFIX + ft.code();
    lastChangedCB = cb;
    LOG.log(Level.FINE, "Updating preference: " + prefKey + ", value = " + cb.isSelected()); // NOI18N
    preferences.putBoolean(prefKey, cb.isSelected());
    
    if (!"".equals(mimeType)) {
        return;
    }
    // legacy setting support in transient prefs:
    String propagate = FoldOptionsController.LEGACY_SETTINGS_MAP.get(ft.code());
    if (propagate != null) {
        prefKey = COLLAPSE_PREFIX + propagate;
        LOG.log(Level.FINE, "Updating LEGACY preference: " + prefKey + ", value = " + cb.isSelected()); // NOI18N
        preferences.putBoolean(prefKey, cb.isSelected());
    }
}
 
Example 3
Source File: CSSStylesSelectionPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Updates the panel used to force pseudo-classes.
 * 
 * @param pageModel inspected page.
 * @param node inspected/selected node.
 */
private void updatePseudoClassPanel(WebKitPageModel pageModel,
        org.netbeans.modules.web.webkit.debugging.api.dom.Node node) {
    CSS.PseudoClass[] pseudoClasses = pageModel.getPseudoClasses(node);
    EnumSet<CSS.PseudoClass> set = EnumSet.noneOf(CSS.PseudoClass.class);
    set.addAll(Arrays.asList(pseudoClasses));
    for (JCheckBox checkbox : pseudoClassCheckBoxes) {
        CSS.PseudoClass pseudoClass = (CSS.PseudoClass)checkbox.getClientProperty(PSEUDO_CLASS);
        boolean selected = set.contains(pseudoClass);
        checkbox.setSelected(selected);
    }
}
 
Example 4
Source File: DefaultFoldingOptions.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void updateValueState() {
    ignoreStateChange = true;
    for (JCheckBox cb : controls) {
        FoldType ft = (FoldType)cb.getClientProperty("type"); // NOI18N
        String k = COLLAPSE_PREFIX + ft.code();
        boolean val = isCollapseEnabled(ft);
        cb.setSelected(val);
    }
    ignoreStateChange = false;
}
 
Example 5
Source File: FileCheckList.java    From pumpernickel with MIT License 5 votes vote down vote up
public void itemStateChanged(ItemEvent e) {
	JCheckBox checkbox = (JCheckBox) e.getSource();
	File file = (File) checkbox.getClientProperty(KEY_FILE);
	if (checkbox.isSelected()) {
		if (selection.contains(file) == false)
			selection.add(file);
	} else {
		if (selection.contains(file))
			selection.remove(file);
	}
}