Search in sources :

Example 6 with BindingBuilder

use of org.apache.cayenne.swing.BindingBuilder in project cayenne by apache.

the class EncodingSelector method initBindings.

protected void initBindings() {
    // init static models...
    this.systemEncoding = detectPlatformEncoding();
    Vector allEncodings = supportedEncodings(systemEncoding);
    view.getEncodingChoices().setModel(new DefaultComboBoxModel(allEncodings));
    view.getDefaultEncodingLabel().setText("Default (" + systemEncoding + ")");
    view.getDefaultEncoding().setSelected(true);
    // create bindings...
    BindingBuilder builder = new BindingBuilder(getApplication().getBindingFactory(), this);
    this.defaultEncodingBinding = builder.bindToStateChange(view.getDefaultEncoding(), "defaultEncoding");
    this.otherEncodingBinding = builder.bindToStateChange(view.getOtherEncoding(), "otherEncoding");
    this.selectedEncodingBinding = builder.bindToComboSelection(view.getEncodingChoices(), "encoding");
}
Also used : BindingBuilder(org.apache.cayenne.swing.BindingBuilder) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) Vector(java.util.Vector)

Example 7 with BindingBuilder

use of org.apache.cayenne.swing.BindingBuilder in project cayenne by apache.

the class GeneralPreferences method initBindings.

protected void initBindings() {
    // init model objects
    preferences = application.getPreferencesNode(GeneralPreferences.class, "");
    this.encoding = preferences.get(ENCODING_PREFERENCE, null);
    this.autoLoadProjectPreference = preferences.getBoolean(AUTO_LOAD_PROJECT_PREFERENCE, false);
    this.deletePromptPreference = preferences.getBoolean(DELETE_PROMPT_PREFERENCE, false);
    // build child controllers...
    EncodingSelector encodingSelector = new EncodingSelector(this, view.getEncodingSelector());
    // create bindings...
    BindingBuilder builder = new BindingBuilder(getApplication().getBindingFactory(), this);
    this.encodingBinding = builder.bindToProperty(encodingSelector, "encoding", EncodingSelector.ENCODING_PROPERTY_BINDING);
    this.autoLoadProjectBinding = builder.bindToCheckBox(view.getAutoLoadProject(), "autoLoadProject");
    this.deletePromptBinding = builder.bindToCheckBox(view.getDeletePrompt(), "deletePrompt");
}
Also used : BindingBuilder(org.apache.cayenne.swing.BindingBuilder)

Example 8 with BindingBuilder

use of org.apache.cayenne.swing.BindingBuilder in project cayenne by apache.

the class TemplateCreator method initBindings.

protected void initBindings() {
    BindingBuilder builder = new BindingBuilder(getApplication().getBindingFactory(), this);
    builder.bindToAction(view.getCancelButton(), "cancelAction()");
    builder.bindToAction(view.getOkButton(), "okAction()");
    final FSPath path = getLastTemplateDirectory();
    view.getTemplateChooser().setCurrentDirectory(path.getExistingDirectory(false));
    view.getTemplateChooser().addPropertyChangeListener(FileChooser.CURRENT_DIRECTORY_PROPERTY, new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {
            File directory = view.getTemplateChooser().getCurrentDirectory();
            path.setDirectory(directory);
        }
    });
}
Also used : PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) BindingBuilder(org.apache.cayenne.swing.BindingBuilder) FSPath(org.apache.cayenne.modeler.pref.FSPath) File(java.io.File)

Example 9 with BindingBuilder

use of org.apache.cayenne.swing.BindingBuilder in project cayenne by apache.

the class InferRelationshipsController method initBindings.

protected void initBindings() {
    BindingBuilder builder = new BindingBuilder(getApplication().getBindingFactory(), this);
    builder.bindToAction(view.getCancelButton(), "cancelAction()");
    builder.bindToAction(view.getGenerateButton(), "generateAction()");
    builder.bindToAction(this, "entitySelectedAction()", SELECTED_PROPERTY);
    builder.bindToAction(view.getStrategyCombo(), "strategyComboAction()");
}
Also used : BindingBuilder(org.apache.cayenne.swing.BindingBuilder)

Example 10 with BindingBuilder

use of org.apache.cayenne.swing.BindingBuilder in project cayenne by apache.

the class GeneratorTabController method initBindings.

protected void initBindings() {
    // bind actions
    BindingBuilder builder = new BindingBuilder(getApplication().getBindingFactory(), this);
    builder.bindToAction(view.getGenerationMode(), "updateModeAction()");
    CayenneProjectPreferences cayPrPref = application.getCayenneProjectPreferences();
    this.preferences = (PreferenceDetail) cayPrPref.getProjectDetailObject(PreferenceDetail.class, getViewPreferences().node("controller"));
    if (Util.isEmptyString(preferences.getProperty("mode"))) {
        preferences.setProperty("mode", STANDARD_OBJECTS_MODE);
    }
    builder.bindToComboSelection(view.getGenerationMode(), "preferences.property['mode']").updateView();
    updateModeAction();
}
Also used : BindingBuilder(org.apache.cayenne.swing.BindingBuilder) CayenneProjectPreferences(org.apache.cayenne.pref.CayenneProjectPreferences)

Aggregations

BindingBuilder (org.apache.cayenne.swing.BindingBuilder)29 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)5 TableBindingBuilder (org.apache.cayenne.swing.TableBindingBuilder)4 ComponentAdapter (java.awt.event.ComponentAdapter)3 ComponentEvent (java.awt.event.ComponentEvent)3 Entry (java.util.Map.Entry)3 DataMap (org.apache.cayenne.map.DataMap)3 ProjectController (org.apache.cayenne.modeler.ProjectController)3 DataNodeDisplayEvent (org.apache.cayenne.modeler.event.DataNodeDisplayEvent)3 DataNodeDisplayListener (org.apache.cayenne.modeler.event.DataNodeDisplayListener)3 DataMapDefaults (org.apache.cayenne.modeler.pref.DataMapDefaults)3 ChangeEvent (javax.swing.event.ChangeEvent)2 ChangeListener (javax.swing.event.ChangeListener)2 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 KeyEvent (java.awt.event.KeyEvent)1 KeyListener (java.awt.event.KeyListener)1 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 File (java.io.File)1