Example usage for com.jgoodies.binding.adapter RadioButtonAdapter RadioButtonAdapter

List of usage examples for com.jgoodies.binding.adapter RadioButtonAdapter RadioButtonAdapter

Introduction

In this page you can find the example usage for com.jgoodies.binding.adapter RadioButtonAdapter RadioButtonAdapter.

Prototype

public RadioButtonAdapter(ValueModel subject, Object choice) 

Source Link

Document

Constructs a RadioButtonAdapter on the given subject ValueModel for the specified choice.

Usage

From source file:com.salas.bb.dialogs.AdvancedPreferencesPanel.java

License:Open Source License

/**
 * Creates mode radio-button.//from  w w  w.  j av  a 2 s. c  o  m
 *
 * @param model     GSM model.
 * @param mode      mode value.
 * @param caption   caption.
 *
 * @return button.
 */
private JRadioButton createRadioButton(ValueModel model, int mode, String caption) {
    return ComponentsFactory.createRadioButton(caption, new RadioButtonAdapter(model, mode));
}

From source file:com.salas.bb.dialogs.ReadingListsPanel.java

License:Open Source License

/** Initializes components. */
private void initComponents() {
    // Updating//from  w  w  w  .j  av a  2 s  . com
    rbUpdateManually = ComponentsFactory
            .createRadioButton(Strings.message("userprefs.tab.readinglists.updates.manual"));
    rbUpdatePeriodically = ComponentsFactory
            .createRadioButton(Strings.message("userprefs.tab.readinglists.updates.periodical"));
    cbUpdatePeriod = new JComboBox(new Object[] { PERIOD_ONCE_PER_RUN, PERIOD_DAILY, PERIOD_HOURLY });

    ButtonGroup g1 = new ButtonGroup();
    g1.add(rbUpdateManually);
    g1.add(rbUpdatePeriodically);

    setUpdatePeriodState();

    PeriodMonitor monitor = new PeriodMonitor(new BufferedValueModel(
            new PropertyAdapter(prefs, UserPreferences.PROP_READING_LIST_UPDATE_PERIOD), triggerChannel));

    rbUpdateManually.addChangeListener(monitor);
    rbUpdatePeriodically.addChangeListener(monitor);
    cbUpdatePeriod.addItemListener(monitor);

    ValueModel updatesModel = new BufferedValueModel(
            new PropertyAdapter(prefs, UserPreferences.PROP_ON_READING_LIST_UPDATE_ACTIONS), triggerChannel);

    // Applying changes
    rbChangeSilently = ComponentsFactory.createRadioButton(
            Strings.message("userprefs.tab.readinglists.action.accept.silently"),
            new RadioButtonAdapter(updatesModel, new Integer(UserPreferences.RL_UPDATE_NONE)));
    rbChangeWithNotification = ComponentsFactory.createRadioButton(
            Strings.message("userprefs.tab.readinglists.action.notify"),
            new RadioButtonAdapter(updatesModel, new Integer(UserPreferences.RL_UPDATE_NOTIFY)));
    rbChangeWithConfirmation = ComponentsFactory.createRadioButton(
            Strings.message("userprefs.tab.readinglists.action.confirm"),
            new RadioButtonAdapter(updatesModel, new Integer(UserPreferences.RL_UPDATE_CONFIRM)));

    // Get Latest command actions
    chUpdateFeeds = ComponentsFactory.createCheckBox(
            Strings.message("userprefs.tab.readinglists.command.latest.articles"),
            new ToggleButtonAdapter(new BufferedValueModel(
                    new PropertyAdapter(prefs, UserPreferences.PROP_UPDATE_FEEDS), triggerChannel)));
    chUpdateReadingLists = ComponentsFactory
            .createCheckBox(Strings.message("userprefs.tab.readinglists.command.lists.changes"),
                    new ToggleButtonAdapter(new BufferedValueModel(
                            new PropertyAdapter(prefs, UserPreferences.PROP_UPDATE_READING_LISTS),
                            triggerChannel)));

    new MandatoryCheckBoxController(chUpdateFeeds, chUpdateReadingLists);
}

From source file:com.salas.bb.dialogs.TagsPreferencesPanel.java

License:Open Source License

/**
 * Initializes radio-buttons./*from w w w  .  j a v  a 2  s . c  o  m*/
 *
 * @param bbsAllowed        <code>TRUE</code> if BB Service selection is allowed.
 * @param triggerChannel    changes commit trigger channel.
 */
private void initRadioButtons(boolean bbsAllowed, ValueModel triggerChannel) {
    ValueModel storageModel = new BufferedValueModel(
            new PropertyAdapter(userPrefs, UserPreferences.PROP_TAGS_STORAGE), triggerChannel);
    storageModel.addValueChangeListener(new StorageTypeListener());

    rbStorageNone = ComponentsFactory.createRadioButton(Strings.message("userprefs.tab.tags.dont.share"));
    rbStorageNone.setModel(new RadioButtonAdapter(storageModel, UserPreferences.TAGS_STORAGE_NONE));

    rbStorageBBS = ComponentsFactory.createRadioButton(Strings.message("userprefs.tab.tags.bbservice"));
    rbStorageBBS.setModel(new RadioButtonAdapter(storageModel, UserPreferences.TAGS_STORAGE_BB_SERVICE));

    rbStorageDelicious = ComponentsFactory.createRadioButton(Strings.message("userprefs.tab.tags.delicious"));
    rbStorageDelicious.setModel(new RadioButtonAdapter(storageModel, UserPreferences.TAGS_STORAGE_DELICIOUS));

    rbStorageBBS.setEnabled(bbsAllowed);
}

From source file:com.salas.bb.remixfeeds.prefs.BlogDetailsPreferencesPanel.java

License:Open Source License

/**
 * Binds components to the properties of the preferences proxy.
 *
 * @param parent parent dialog./*  ww w.j a  va2 s.c  o  m*/
 */
private void initComponents(JDialog parent) {
    vmURL = new BufferedValueModel(new PropertyAdapter(proxy, TargetBlog.PROP_API_URL, true), trigger);
    vmUser = new BufferedValueModel(new PropertyAdapter(proxy, TargetBlog.PROP_USER, true), trigger);
    vmPass = new BufferedValueModel(new PropertyAdapter(proxy, TargetBlog.PROP_PASSWORD, true), trigger);

    tfTitle.setDocument(new DocumentAdapter(new PropertyAdapter(proxy, TargetBlog.PROP_TITLE, true)));
    tfURL.setDocument(new DocumentAdapter(vmURL));
    tfURLSummary.setDocument(new DocumentAdapter(
            new URLSummaryConverter(new PropertyAdapter(proxy, TargetBlog.PROP_API_URL, true))));
    tfURLSummary.setEditable(false);
    tfUser.setDocument(new DocumentAdapter(vmUser));
    tfPassword.setDocument(new DocumentAdapter(vmPass));

    taDescription = ComponentsFactory.createInstructionsArea("");

    loadCategoriesLookup();

    ValueModel mdlDefaultCategory = new PropertyAdapter(proxy, TargetBlog.PROP_DEFAULT_CATEGORY, true);
    ComboBoxAdapter adapter = new ComboBoxAdapter((ListModel) lmdlCategories, mdlDefaultCategory);
    cbDefaultCategory = new JComboBox(adapter);

    ValueModel mdlBlog = new PropertyAdapter(proxy, TargetBlog.PROP_BLOG, true);
    adapter = new ComboBoxAdapter((ListModel) lmdlBlogs, mdlBlog);
    cbBlog = new JComboBox(adapter);

    ValueModel mdlDraft = new PropertyAdapter(proxy, TargetBlog.PROP_DRAFT, true);
    rbPublic.setModel(new RadioButtonAdapter(mdlDraft, Boolean.FALSE));
    rbDraft.setModel(new RadioButtonAdapter(mdlDraft, Boolean.TRUE));

    Collection apis = WeblogAPIs.getWeblogAPIs();
    ValueModel mdlAPIs = new PropertyAdapter(proxy, TargetBlog.PROP_API_TYPE, true);
    vmAPI = new BufferedValueModel(mdlAPIs, trigger);
    adapter = new ComboBoxAdapter(apis.toArray(), vmAPI);
    cbWeblogAPIType = new JComboBox(adapter);
    vmAPI.addPropertyChangeListener(new WeblogTypeChangeListener());

    btnSetup = new JButton(new SetupAction(parent));
    btnFetchCategories = new JButton();
    actFetchCategories = new FetchCategoriesAction(); // It uses btnFetchCategories (hence the order)
    btnFetchCategories.setAction(actFetchCategories);
    btnFetchBlogs = new JButton();
    actFetchBlogs = new FetchBlogsAction(); // It uses btnFetchBlogs (hence the order)
    btnFetchBlogs.setAction(actFetchBlogs);

    // Templates
    Set<String> templateNames = Templates.getUserTemplates().keySet();
    lmTemplateNames = new ArrayListModel(templateNames);

    ValueModel mdlTemplates = new PropertyAdapter(proxy, TargetBlog.PROP_TEMPLATE_NAME, true);
    cbTemplate = new JComboBox(new ComboBoxAdapter((ListModel) lmTemplateNames, mdlTemplates));
    btnTemplateEditor = new JButton(new TemplateEditorAction());

    proxy.addPropertyChangeListener(TargetBlogProxy.PROP_BLOG_PREFERENCES, this);
    updateViewState();
}

From source file:eu.europa.ec.markt.dss.applet.util.ComponentFactory.java

License:Open Source License

/**
 * //w  w  w. ja v  a  2s.  com
 * @param text
 * @param valueModel
 * @param value
 * @return
 */
public static JRadioButton createRadioButton(final String text, final ValueModel valueModel,
        final Object value) {
    final JRadioButton button = new JRadioButton(text);
    final ButtonModel model = new RadioButtonAdapter(valueModel, value);
    button.setModel(model);
    return button;
}

From source file:org.drugis.mtc.gui.CodeGenerationDialog.java

License:Open Source License

private JRadioButton createRadioButton(ValueHolder valueModel, Enum<?> choice, boolean enabled) {
    JRadioButton button = new JRadioButton(choice.name());
    button.setModel(new RadioButtonAdapter(valueModel, choice));
    button.setEnabled(enabled);/*  w  w  w . j a  va  2  s. c  om*/
    return button;
}