cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dkazimirc...@apache.org
Subject svn commit: r1142590 - /cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/
Date Mon, 04 Jul 2011 09:02:43 GMT
Author: dkazimirchyk
Date: Mon Jul  4 09:02:43 2011
New Revision: 1142590

URL: http://svn.apache.org/viewvc?rev=1142590&view=rev
Log:
CAY-1461 CayenneModeler: remove ScopeMVC dependencies

removed scopemvc dependencies from CacheSyncConfig dialog

Added:
    cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CacheSyncConfigView.java
Removed:
    cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CacheSyncConfigDialog.java
    cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CacheSyncConfigModel.java
    cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CacheSyncTypesModel.java
    cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/JGroupsConfigModel.java
    cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/JMSConfigModel.java
Modified:
    cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CacheSyncConfigController.java
    cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CustomRemoteEventsConfigPanel.java
    cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/JGroupsConfigPanel.java
    cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/JMSConfigPanel.java

Modified: cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CacheSyncConfigController.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CacheSyncConfigController.java?rev=1142590&r1=1142589&r2=1142590&view=diff
==============================================================================
--- cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CacheSyncConfigController.java
(original)
+++ cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CacheSyncConfigController.java
Mon Jul  4 09:02:43 2011
@@ -19,22 +19,23 @@
 
 package org.apache.cayenne.modeler.dialog.datadomain;
 
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.swing.WindowConstants;
+
 import org.apache.cayenne.access.DataRowStore;
-import org.apache.cayenne.configuration.event.DomainEvent;
 import org.apache.cayenne.configuration.DataChannelDescriptor;
+import org.apache.cayenne.configuration.event.DomainEvent;
+import org.apache.cayenne.event.JMSBridgeFactory;
+import org.apache.cayenne.event.JavaGroupsBridgeFactory;
 import org.apache.cayenne.modeler.ProjectController;
+import org.apache.cayenne.modeler.util.CayenneController;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.scopemvc.controller.basic.BasicController;
-import org.scopemvc.core.Control;
-import org.scopemvc.core.ControlException;
-import org.scopemvc.core.ModelChangeEvent;
-import org.scopemvc.core.ModelChangeListener;
-import org.scopemvc.core.Selector;
-import org.scopemvc.view.swing.SPanel;
 
 /**
  * A controller for CacheSyncConfigDialog and its subviews. Builds a model out of a
@@ -44,8 +45,7 @@ import org.scopemvc.view.swing.SPanel;
  * own independent models.
  * 
  */
-public class CacheSyncConfigController extends BasicController implements
-        ModelChangeListener {
+public class CacheSyncConfigController extends CayenneController {
 
     private static Log logObj = LogFactory.getLog(CacheSyncConfigController.class);
 
@@ -55,18 +55,26 @@ public class CacheSyncConfigController e
     private static final String JGROUPS_FACTORY_CLASS = "org.apache.cayenne.event.JavaGroupsBridgeFactory";
     private static final String JMS_FACTORY_CLASS = "org.apache.cayenne.event.JMSBridgeFactory";
 
-    public static final String SAVE_CONFIG_CONTROL = "cayenne.modeler.cacheSyncConfig.save.button";
-    public static final String CANCEL_CONFIG_CONTROL = "cayenne.modeler.cacheSyncConfig.cancel.button";
+    public static final String SAVE_CONFIG_CONTROL = "Done";
+    public static final String CANCEL_CONFIG_CONTROL = "Cancel";
 
-    public static final String JGROUPS_DEFAULT_CONTROL = "cayenne.modeler.jgroupConfig.radio1";
+    public static final String JGROUPS_DEFAULT_CONTROL = "Standard Configuration";
 
-    public static final String JGROUPS_URL_CONTROL = "cayenne.modeler.jgroupConfig.radio2";
+    public static final String JGROUPS_URL_CONTROL = "Use Configuration File";
+    
+    public static final String JGROUPS_FACTORY_LABEL = "JavaGroups Multicast (Default)";
+    public static final String JMS_FACTORY_LABEL = "JMS Transport";
+    public static final String CUSTOM_FACTORY_LABEL = "Custom Transport";
 
     protected Map existingCards;
+    protected Map properties;
     protected boolean modified;
     protected ProjectController eventController;
+    
+    protected CacheSyncConfigView view;
 
     public CacheSyncConfigController(ProjectController eventController) {
+        super(eventController);
         this.eventController = eventController;
     }
 
@@ -74,66 +82,62 @@ public class CacheSyncConfigController e
      * Creates and shows a new modal dialog window. Registers as a listener for its own
      * model to update subviews on model changes.
      */
-    public void startup() {
-        
+    public void startup() { 
         DataChannelDescriptor domain = (DataChannelDescriptor)eventController.getProject().getRootNode();
         
         String factory = (String) domain.getProperties().get(
                 DataRowStore.EVENT_BRIDGE_FACTORY_PROPERTY);
 
-        CacheSyncTypesModel topModel = buildTypesModel(factory);
-        setModel(topModel);
-        setView(new CacheSyncConfigDialog());
-
+        view = new CacheSyncConfigView();
+        initView();
+        
+        properties = new HashMap(((DataChannelDescriptor)eventController.getProject()
+                .getRootNode()).getProperties());
+        System.out.println(properties);
+        
         // build cards, showing the one corresponding to DataDomain state
         prepareChildren(factory);
-        super.startup();
-    }
-
-    /**
-     * ModelChangeListener implementation that updates "modified" status and changes
-     * dialog subview on model changes.
-     */
-    public void modelChanged(ModelChangeEvent inEvent) {
-        logObj.info("ModelChangeEvent: " + inEvent.getSelector());
-
-        Selector selector = inEvent.getSelector();
-
-        if (selector.startsWith(CacheSyncTypesModel.FACTORY_LABEL_SELECTOR)) {
-            changeConfigView();
-            modified = true;
-            logObj.info("** Factory selection modified..");
-        }
-        else {
-            modified = true;
-            logObj.info("** Property modified modified..");
-        }
-    }
-
-    /**
-     * Overrides super implementation to process controls from this controller's view and
-     * its subviews.
-     */
-    protected void doHandleControl(Control control) throws ControlException {
-        logObj.info("Control: " + control);
-
-        if (control.matchesID(CANCEL_CONFIG_CONTROL)) {
-            shutdown();
-        }
-        else if (control.matchesID(SAVE_CONFIG_CONTROL)) {
-            commitChanges();
-        }
-        else if (control.matchesID(JGROUPS_DEFAULT_CONTROL)) {
-            jgroupsDefaultConfig();
-        }
-        else if (control.matchesID(JGROUPS_URL_CONTROL)) {
-            jgroupsURLConfig();
-        }
+        
+        view.pack();
+        view.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+        view.setModal(true);
+        makeCloseableOnEscape();
+        centerView();
+        view.setVisible(true);
+    }
+    
+    public Component getView() {
+        return this.view;
+    }
+    
+    private void initView() {
+        view.getCancelButton().addActionListener(new ActionListener() {
+            
+            public void actionPerformed(ActionEvent e) {
+                view.dispose();
+            }
+        });
+        view.getSaveButton().addActionListener(new ActionListener() {
+            
+            public void actionPerformed(ActionEvent e) {
+                commitChanges();
+            }
+        });
+        view.getTypeSelector().addActionListener(new ActionListener() {
+            
+            public void actionPerformed(ActionEvent e) {
+                selectCard();
+            }
+        });
+    }
+    
+    protected void selectCard() {
+        view.showCard((String)view.getTypeSelector().getSelectedItem());
     }
 
     protected void jgroupsDefaultConfig() {
         JGroupsConfigPanel view = (JGroupsConfigPanel) existingCards
-                .get(CacheSyncTypesModel.JGROUPS_FACTORY_LABEL);
+                .get(JGROUPS_FACTORY_LABEL);
         if (view != null) {
             view.showDefaultConfig();
         }
@@ -141,7 +145,7 @@ public class CacheSyncConfigController e
 
     protected void jgroupsURLConfig() {
         JGroupsConfigPanel view = (JGroupsConfigPanel) existingCards
-                .get(CacheSyncTypesModel.JGROUPS_FACTORY_LABEL);
+                .get(JGROUPS_FACTORY_LABEL);
         if (view != null) {
             view.showCustomConfig();
         }
@@ -151,146 +155,188 @@ public class CacheSyncConfigController e
      * Stores configuration changes in the data domain properties.
      */
     protected void commitChanges() {
-        logObj.info("Has changes?: " + modified);
-
-        if (modified) {
-            // extract model from current card
-            CacheSyncTypesModel topModel = (CacheSyncTypesModel) getModel();
-            SPanel card = (SPanel) existingCards.get(topModel.getFactoryLabel());
-            CacheSyncConfigModel model = (CacheSyncConfigModel) card.getShownModel();
-
-            DataChannelDescriptor domain = (DataChannelDescriptor)eventController.getProject().getRootNode();
-
-            logObj.warn("domain properties BEFORE: " + domain.getProperties());
-            model.storeProperties(domain.getProperties());
-
-            logObj.warn("domain properties: " + domain.getProperties());
-
-            eventController.fireDomainEvent(new DomainEvent(this, domain));
+        DataChannelDescriptor domain = (DataChannelDescriptor)eventController.getProject().getRootNode();
+        logObj.warn("domain properties BEFORE: " + domain.getProperties());
+        
+        Map<String, String> props = domain.getProperties();
+        
+        String type = (String)view.getTypeSelector().getSelectedItem();
+        if (JGROUPS_FACTORY_LABEL.equals(type)) {
+            JGroupsConfigPanel jgroupsPanel = (JGroupsConfigPanel) existingCards
+                    .get(JGROUPS_FACTORY_LABEL);
+            props.put(DataRowStore.EVENT_BRIDGE_FACTORY_PROPERTY, JGROUPS_FACTORY_CLASS);
+            if (jgroupsPanel.useConfigFile.isSelected()) {
+                props.remove(JavaGroupsBridgeFactory.MCAST_ADDRESS_PROPERTY);
+                props.remove(JavaGroupsBridgeFactory.MCAST_PORT_PROPERTY);
+                if (!"".equals(jgroupsPanel.configURL.getText())) {
+                    props.put(JavaGroupsBridgeFactory.JGROUPS_CONFIG_URL_PROPERTY, 
+                            jgroupsPanel.configURL.getText());
+                }
+                else {
+                    props.put(JavaGroupsBridgeFactory.JGROUPS_CONFIG_URL_PROPERTY, null);
+                }
+            }
+            else {
+                props.remove(JavaGroupsBridgeFactory.JGROUPS_CONFIG_URL_PROPERTY);
+                if (!"".equals(jgroupsPanel.multicastAddress.getText())) {
+                    props.put(JavaGroupsBridgeFactory.MCAST_ADDRESS_PROPERTY, 
+                            jgroupsPanel.multicastAddress.getText());
+                }
+                else {
+                    props.put(JavaGroupsBridgeFactory.MCAST_ADDRESS_PROPERTY, null);
+                }
+                if (!"".equals(jgroupsPanel.multicastPort.getText())) { 
+                    props.put(JavaGroupsBridgeFactory.MCAST_PORT_PROPERTY, 
+                            jgroupsPanel.multicastPort.getText());
+                }
+                else {
+                    props.put(JavaGroupsBridgeFactory.MCAST_PORT_PROPERTY, null);
+                }
+            }
+        }
+        else if (JMS_FACTORY_LABEL.equals(type)) {
+            JMSConfigPanel jmsPanel = (JMSConfigPanel) existingCards
+                    .get(JMS_FACTORY_LABEL);
+            props.put(DataRowStore.EVENT_BRIDGE_FACTORY_PROPERTY, JMS_FACTORY_CLASS);
+            if (!"".equals(jmsPanel.topicFactory.getText())) {
+                props.put(JMSBridgeFactory.TOPIC_CONNECTION_FACTORY_PROPERTY, 
+                        jmsPanel.topicFactory.getText());
+            }
+            else {
+                props.put(JMSBridgeFactory.TOPIC_CONNECTION_FACTORY_PROPERTY, null);
+            }
+        }
+        else if (CUSTOM_FACTORY_LABEL.equals(type)) {
+            CustomRemoteEventsConfigPanel customPanel = (CustomRemoteEventsConfigPanel) existingCards
+                    .get(CUSTOM_FACTORY_LABEL);
+            if (!"".equals(customPanel.factoryClass.getText())) {
+                props.put(DataRowStore.EVENT_BRIDGE_FACTORY_PROPERTY, customPanel.factoryClass.getText());
+            }
+            else {
+                props.put(DataRowStore.EVENT_BRIDGE_FACTORY_PROPERTY, null);
+            }
         }
+        
+        logObj.warn("domain properties: " + domain.getProperties());
+        
+        eventController.fireDomainEvent(new DomainEvent(this, domain));
 
-        shutdown();
+        view.dispose();
     }
-
-    /**
-     * Changes a subview to a panel specific for the currently selected configuration
-     * type.
-     */
-    protected void changeConfigView() {
-        CacheSyncTypesModel topModel = (CacheSyncTypesModel) getModel();
-        CacheSyncConfigModel newModel = buildModel(topModel);
-
-        // NOTE: card doesn't have a controller, since it does not need it
-        String label = topModel.getFactoryLabel();
-        SPanel card = (SPanel) existingCards.get(label);
-        card.setBoundModel(newModel);
-        ((CacheSyncConfigDialog) getView()).showCard(label);
-    }
-
-    protected CacheSyncTypesModel buildTypesModel(String factory) {
-
-        if (factory == null) {
-            factory = DataRowStore.EVENT_BRIDGE_FACTORY_DEFAULT;
+    
+    protected void loadProperties(String factory) {
+        String configUrl = (String)properties.get(JavaGroupsBridgeFactory.JGROUPS_CONFIG_URL_PROPERTY);
+        String multicastAddress = (String)properties.get(JavaGroupsBridgeFactory.MCAST_ADDRESS_PROPERTY);
+        String multicastPort = (String)properties.get(JavaGroupsBridgeFactory.MCAST_PORT_PROPERTY);
+        String topicFactory = (String)properties.get(JMSBridgeFactory.TOPIC_CONNECTION_FACTORY_PROPERTY);
+        
+        JGroupsConfigPanel jgroupsPanel = (JGroupsConfigPanel) existingCards
+                .get(JGROUPS_FACTORY_LABEL);
+        
+        if (configUrl != null) {
+            jgroupsPanel.useConfigFile.setSelected(true);
+            jgroupsURLConfig();
+            jgroupsPanel.configURL.setText(configUrl);
         }
-
-        String label;
-
-        if (JGROUPS_FACTORY_CLASS.equals(factory)) {
-            label = CacheSyncTypesModel.JGROUPS_FACTORY_LABEL;
+        else {
+            jgroupsPanel.useDefaultConfig.setSelected(true);
+            jgroupsDefaultConfig();
         }
-        else if (JMS_FACTORY_CLASS.equals(factory)) {
-            label = CacheSyncTypesModel.JMS_FACTORY_LABEL;
+        
+        if (multicastAddress != null) {
+            jgroupsPanel.multicastAddress.setText(multicastAddress);
         }
         else {
-            label = CacheSyncTypesModel.CUSTOM_FACTORY_LABEL;
+            jgroupsPanel.multicastAddress.setText(JavaGroupsBridgeFactory.MCAST_ADDRESS_DEFAULT);
         }
-
-        CacheSyncTypesModel model = new CacheSyncTypesModel();
-        model.setFactoryLabel(label);
-        model.addModelChangeListener(this);
-        return model;
-    }
-
-    protected CacheSyncConfigModel buildModel(CacheSyncTypesModel topModel) {
-        String label = topModel.getFactoryLabel();
-        String factory;
-
-        if (label.equals(CacheSyncTypesModel.JGROUPS_FACTORY_LABEL)) {
-            factory = JGROUPS_FACTORY_CLASS;
+        
+        if (multicastPort != null) {
+            jgroupsPanel.multicastPort.setText(multicastPort);
         }
-        else if (label.equals(CacheSyncTypesModel.JMS_FACTORY_LABEL)) {
-            factory = JMS_FACTORY_CLASS;
+        else {
+            jgroupsPanel.multicastPort.setText(JavaGroupsBridgeFactory.MCAST_PORT_DEFAULT);
+        }
+        
+        JMSConfigPanel jmsPanel = (JMSConfigPanel) existingCards
+                .get(JMS_FACTORY_LABEL);
+     
+        if (topicFactory != null) {
+            jmsPanel.topicFactory.setText(topicFactory);
         }
         else {
-            // reset factory
-            factory = null;
+            jmsPanel.topicFactory.setText(JMSBridgeFactory.TOPIC_CONNECTION_FACTORY_DEFAULT);
         }
-
-        return buildModel(factory);
-    }
-
-    protected CacheSyncConfigModel buildModel(String factory) {
-
-        CacheSyncConfigModel model;
-
+        
+        CustomRemoteEventsConfigPanel customPanel = (CustomRemoteEventsConfigPanel) existingCards
+                .get(CUSTOM_FACTORY_LABEL);
+        String factoryClass = (String)properties.get(DataRowStore.EVENT_BRIDGE_FACTORY_PROPERTY);
+        if (factoryClass != null) {
+            customPanel.factoryClass.setText(factoryClass);
+        }
+        else {
+            customPanel.factoryClass.setText(DataRowStore.EVENT_BRIDGE_FACTORY_DEFAULT);
+        }
+        
         if (JGROUPS_FACTORY_CLASS.equals(factory)) {
-            model = new JGroupsConfigModel();
+            view.getTypeSelector().setSelectedItem(JGROUPS_FACTORY_LABEL);
         }
         else if (JMS_FACTORY_CLASS.equals(factory)) {
-            model = new JMSConfigModel();
+            view.getTypeSelector().setSelectedItem(JMS_FACTORY_LABEL);
         }
         else {
-            model = new CacheSyncConfigModel();
+            view.getTypeSelector().setSelectedItem(CUSTOM_FACTORY_LABEL);
         }
-
-        model.setMap(new HashMap(((DataChannelDescriptor)eventController.getProject().getRootNode()).getProperties()));
-        model.setFactoryClass(factory);
-        model.addModelChangeListener(this);
-
-        return model;
     }
 
     protected void prepareChildren(String factory) {
         existingCards = new HashMap();
-        CacheSyncConfigDialog topView = (CacheSyncConfigDialog) getView();
+        CacheSyncConfigView topView = (CacheSyncConfigView) getView();
 
         // note that none of the panels need a controller
         // if they issue controls, they will use this object taken from parent
 
         JGroupsConfigPanel jgroupsPanel = new JGroupsConfigPanel();
-        existingCards.put(CacheSyncTypesModel.JGROUPS_FACTORY_LABEL, jgroupsPanel);
-        topView.addCard(jgroupsPanel, CacheSyncTypesModel.JGROUPS_FACTORY_LABEL);
+        existingCards.put(JGROUPS_FACTORY_LABEL, jgroupsPanel);
+        topView.addCard(jgroupsPanel, JGROUPS_FACTORY_LABEL);
+        
+        jgroupsPanel.getUseDefaultConfig().addActionListener(new ActionListener() {
+            
+            public void actionPerformed(ActionEvent e) {
+                jgroupsDefaultConfig();
+            }
+        });
+        jgroupsPanel.getUseConfigFile().addActionListener(new ActionListener() {
+            
+            public void actionPerformed(ActionEvent e) {
+                jgroupsURLConfig();
+            }
+        });
 
         JMSConfigPanel jmsPanel = new JMSConfigPanel();
-        existingCards.put(CacheSyncTypesModel.JMS_FACTORY_LABEL, jmsPanel);
-        topView.addCard(jmsPanel, CacheSyncTypesModel.JMS_FACTORY_LABEL);
+        existingCards.put(JMS_FACTORY_LABEL, jmsPanel);
+        topView.addCard(jmsPanel, JMS_FACTORY_LABEL);
 
         CustomRemoteEventsConfigPanel customFactoryPanel = new CustomRemoteEventsConfigPanel();
-        existingCards.put(CacheSyncTypesModel.CUSTOM_FACTORY_LABEL, customFactoryPanel);
-        topView.addCard(customFactoryPanel, CacheSyncTypesModel.CUSTOM_FACTORY_LABEL);
+        existingCards.put(CUSTOM_FACTORY_LABEL, customFactoryPanel);
+        topView.addCard(customFactoryPanel, CUSTOM_FACTORY_LABEL);
 
         if (factory == null) {
             factory = DataRowStore.EVENT_BRIDGE_FACTORY_DEFAULT;
         }
 
-        // display the right initial card
-        // can't call "changeConfigView", since it will reset custom factories..
-        Object model = buildModel(factory);
-
         if (JGROUPS_FACTORY_CLASS.equals(factory)) {
-            jgroupsPanel.setBoundModel(model);
-            ((CacheSyncConfigDialog) getView())
-                    .showCard(CacheSyncTypesModel.JGROUPS_FACTORY_LABEL);
+            ((CacheSyncConfigView) getView())
+                    .showCard(JGROUPS_FACTORY_LABEL);
         }
         else if (JMS_FACTORY_CLASS.equals(factory)) {
-            jmsPanel.setBoundModel(model);
-            ((CacheSyncConfigDialog) getView())
-                    .showCard(CacheSyncTypesModel.JMS_FACTORY_LABEL);
+            ((CacheSyncConfigView) getView())
+                    .showCard(JMS_FACTORY_LABEL);
         }
         else {
-            customFactoryPanel.setBoundModel(model);
-            ((CacheSyncConfigDialog) getView())
-                    .showCard(CacheSyncTypesModel.CUSTOM_FACTORY_LABEL);
+            ((CacheSyncConfigView) getView())
+                    .showCard(CUSTOM_FACTORY_LABEL);
         }
+        
+        loadProperties(factory);
     }
 }

Added: cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CacheSyncConfigView.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CacheSyncConfigView.java?rev=1142590&view=auto
==============================================================================
--- cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CacheSyncConfigView.java
(added)
+++ cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CacheSyncConfigView.java
Mon Jul  4 09:02:43 2011
@@ -0,0 +1,103 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.modeler.dialog.datadomain;
+
+import java.awt.BorderLayout;
+import java.awt.CardLayout;
+import java.awt.Component;
+import java.awt.FlowLayout;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JDialog;
+import javax.swing.JPanel;
+
+import com.jgoodies.forms.builder.DefaultFormBuilder;
+import com.jgoodies.forms.layout.FormLayout;
+
+/**
+ */
+public class CacheSyncConfigView extends JDialog {
+    public static final String EMPTY_CARD_KEY = "Empty";
+
+    protected JPanel configPanel;
+    protected JComboBox typeSelector;
+    protected JButton saveButton;
+    protected JButton cancelButton;
+
+    public CacheSyncConfigView() {
+        initView();
+    }
+
+    protected void initView() {
+        this.setLayout(new BorderLayout());
+        this.setTitle("Configure Remote Cache Synchronization");
+
+        typeSelector = new JComboBox();
+        typeSelector.addItem("JavaGroups Multicast (Default)");
+        typeSelector.addItem("JMS Transport");
+        typeSelector.addItem("Custom Transport");
+
+        saveButton = new JButton(CacheSyncConfigController.SAVE_CONFIG_CONTROL);
+        cancelButton =
+            new JButton(CacheSyncConfigController.CANCEL_CONFIG_CONTROL);
+
+        // buttons panel
+        JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
+        buttonPanel.add(saveButton);
+        buttonPanel.add(cancelButton);
+
+        // type form
+        FormLayout layout = new FormLayout("right:150, 3dlu, left:200", "");
+        DefaultFormBuilder builder = new DefaultFormBuilder(layout);
+        builder.setDefaultDialogBorder();
+        builder.append("Notification Transport Type:", typeSelector);
+
+        // config panel
+        configPanel = new JPanel(new CardLayout());
+        addCard(new JPanel(), EMPTY_CARD_KEY);
+
+        this.add(builder.getPanel(), BorderLayout.NORTH);
+        this.add(configPanel, BorderLayout.CENTER);
+        this.add(buttonPanel, BorderLayout.SOUTH);
+
+        showCard(EMPTY_CARD_KEY);
+    }
+
+    public void addCard(Component card, String key) {
+        configPanel.add(card, key);
+    }
+
+    public void showCard(String key) {
+        ((CardLayout) configPanel.getLayout()).show(configPanel, key);
+    }
+
+    public JButton getSaveButton() {
+        return this.saveButton;
+    }
+
+    public JButton getCancelButton() {
+        return this.cancelButton;
+    }
+
+    public JComboBox getTypeSelector() {
+        return this.typeSelector;
+    }
+}

Modified: cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CustomRemoteEventsConfigPanel.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CustomRemoteEventsConfigPanel.java?rev=1142590&r1=1142589&r2=1142590&view=diff
==============================================================================
--- cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CustomRemoteEventsConfigPanel.java
(original)
+++ cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CustomRemoteEventsConfigPanel.java
Mon Jul  4 09:02:43 2011
@@ -21,16 +21,18 @@ package org.apache.cayenne.modeler.dialo
 
 import java.awt.BorderLayout;
 
-import org.scopemvc.view.swing.SPanel;
-import org.scopemvc.view.swing.STextField;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
 
 import com.jgoodies.forms.builder.DefaultFormBuilder;
 import com.jgoodies.forms.layout.FormLayout;
 
 /**
  */
-public class CustomRemoteEventsConfigPanel extends SPanel {
-
+public class CustomRemoteEventsConfigPanel extends JPanel {
+    
+    protected JTextField factoryClass;
+    
     public CustomRemoteEventsConfigPanel() {
         super();
         initView();
@@ -39,8 +41,7 @@ public class CustomRemoteEventsConfigPan
     protected void initView() {
         setLayout(new BorderLayout());
 
-        STextField factoryClass = new STextField(30);
-        factoryClass.setSelector(CacheSyncConfigModel.FACTORY_CLASS_SELECTOR);
+        factoryClass = new JTextField(30);
 
         // type form
         FormLayout layout = new FormLayout("right:150, 3dlu, left:200", "");

Modified: cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/JGroupsConfigPanel.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/JGroupsConfigPanel.java?rev=1142590&r1=1142589&r2=1142590&view=diff
==============================================================================
--- cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/JGroupsConfigPanel.java
(original)
+++ cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/JGroupsConfigPanel.java
Mon Jul  4 09:02:43 2011
@@ -22,22 +22,23 @@ package org.apache.cayenne.modeler.dialo
 import java.awt.BorderLayout;
 
 import javax.swing.ButtonGroup;
-
-import org.scopemvc.view.swing.SPanel;
-import org.scopemvc.view.swing.SRadioButton;
-import org.scopemvc.view.swing.STextField;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JTextField;
 
 import com.jgoodies.forms.builder.DefaultFormBuilder;
 import com.jgoodies.forms.layout.FormLayout;
 
 /**
  */
-public class JGroupsConfigPanel extends SPanel {
-
-    protected STextField multicastAddress;
-    protected STextField multicastPort;
-    protected STextField configURL;
+public class JGroupsConfigPanel extends JPanel {
 
+    protected JTextField multicastAddress;
+    protected JTextField multicastPort;
+    protected JTextField configURL;
+    protected JRadioButton useDefaultConfig;
+    protected JRadioButton useConfigFile;
+    
     public JGroupsConfigPanel() {
         initView();
     }
@@ -45,28 +46,17 @@ public class JGroupsConfigPanel extends 
     protected void initView() {
         setLayout(new BorderLayout());
 
-        SRadioButton useDefaultConfig =
-            new SRadioButton(
-                CacheSyncConfigController.JGROUPS_DEFAULT_CONTROL,
-                JGroupsConfigModel.USING_DEFAULT_CONFIG_SELECTOR);
-
-        SRadioButton useConfigFile =
-            new SRadioButton(
-                CacheSyncConfigController.JGROUPS_URL_CONTROL,
-                JGroupsConfigModel.USING_CONFIG_FILE_SELECTOR);
-
-        ButtonGroup group = new ButtonGroup();
-        group.add(useConfigFile);
-        group.add(useDefaultConfig);
-
-        multicastAddress = new STextField();
-        multicastAddress.setSelector(JGroupsConfigModel.MCAST_ADDRESS_SELECTOR);
-
-        multicastPort = new STextField(5);
-        multicastPort.setSelector(JGroupsConfigModel.MCAST_PORT_SELECTOR);
-
-        configURL = new STextField();
-        configURL.setSelector(JGroupsConfigModel.JGROUPS_CONFIG_URL_SELECTOR);
+        useDefaultConfig = new JRadioButton(CacheSyncConfigController.JGROUPS_DEFAULT_CONTROL);
+        useDefaultConfig.setSelected(true);
+        useConfigFile = new JRadioButton(CacheSyncConfigController.JGROUPS_URL_CONTROL);
+        
+        ButtonGroup radioGroup = new ButtonGroup();
+        radioGroup.add(useConfigFile);
+        radioGroup.add(useDefaultConfig);
+
+        multicastAddress = new JTextField(20);
+        multicastPort = new JTextField(5);
+        configURL = new JTextField(20);
 
         // type form
         FormLayout layout = new FormLayout("right:150, 3dlu, left:200", "");
@@ -101,4 +91,16 @@ public class JGroupsConfigPanel extends 
         multicastPort.setEditable(false);
         configURL.setEditable(true);
     }
+    
+    public JRadioButton getUseDefaultConfig() {
+        return this.useDefaultConfig;
+    }
+    
+    public void setUseDefaultConfig(JRadioButton button) {
+        this.useDefaultConfig = button;
+    }
+    
+    public JRadioButton getUseConfigFile() {
+        return this.useConfigFile;
+    }
 }

Modified: cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/JMSConfigPanel.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/JMSConfigPanel.java?rev=1142590&r1=1142589&r2=1142590&view=diff
==============================================================================
--- cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/JMSConfigPanel.java
(original)
+++ cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/JMSConfigPanel.java
Mon Jul  4 09:02:43 2011
@@ -21,15 +21,17 @@ package org.apache.cayenne.modeler.dialo
 
 import java.awt.BorderLayout;
 
-import org.scopemvc.view.swing.SPanel;
-import org.scopemvc.view.swing.STextField;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
 
 import com.jgoodies.forms.builder.DefaultFormBuilder;
 import com.jgoodies.forms.layout.FormLayout;
 
 /**
  */
-public class JMSConfigPanel extends SPanel {
+public class JMSConfigPanel extends JPanel {
+    
+    protected JTextField topicFactory;
 
     public JMSConfigPanel() {
         super();
@@ -39,8 +41,7 @@ public class JMSConfigPanel extends SPan
     protected void initView() {
         setLayout(new BorderLayout());
 
-        STextField topicFactory = new STextField(30);
-        topicFactory.setSelector(JMSConfigModel.TOPIC_FACTORY_SELECTOR);
+        topicFactory = new JTextField(30);
 
         // type form
         FormLayout layout = new FormLayout("right:150, 3dlu, left:200", "");
@@ -54,5 +55,4 @@ public class JMSConfigPanel extends SPan
 
         add(builder.getPanel(), BorderLayout.NORTH);
     }
-
 }



Mime
View raw message