cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgen...@apache.org
Subject [45/50] cayenne-modeler git commit: Initial work on including Remote Change Notification UI in Data Domain.
Date Thu, 05 Jan 2017 22:09:53 GMT
Initial work on including Remote Change Notification UI in Data Domain.


Project: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/commit/830a7d13
Tree: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/tree/830a7d13
Diff: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/diff/830a7d13

Branch: refs/heads/master
Commit: 830a7d13d6ad67f1c9657def153007afb56e9fd8
Parents: aa09fc5
Author: mrg <blacknext@gmail.com>
Authored: Sat Oct 15 13:48:40 2016 -0400
Committer: mrg <blacknext@gmail.com>
Committed: Sat Oct 15 13:48:40 2016 -0400

----------------------------------------------------------------------
 .../modeler/layout/DataDomainLayout.java        |  69 +++++++++--
 .../modeler/layout/MainWindowLayout.java        |  10 +-
 .../resources/layouts/DataDomainLayout.fxml     | 114 +++++++++++++++++--
 3 files changed, 166 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/830a7d13/src/main/java/org/apache/cayenne/modeler/layout/DataDomainLayout.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/layout/DataDomainLayout.java b/src/main/java/org/apache/cayenne/modeler/layout/DataDomainLayout.java
index 1eed531..83c368b 100644
--- a/src/main/java/org/apache/cayenne/modeler/layout/DataDomainLayout.java
+++ b/src/main/java/org/apache/cayenne/modeler/layout/DataDomainLayout.java
@@ -30,11 +30,12 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import javafx.fxml.FXML;
-import javafx.scene.control.Button;
 import javafx.scene.control.CheckBox;
+import javafx.scene.control.ChoiceBox;
 import javafx.scene.control.Spinner;
 import javafx.scene.control.SpinnerValueFactory;
 import javafx.scene.control.TextField;
+import javafx.scene.layout.VBox;
 
 // org.apache.cayenne.modeler.controller.DataDomainViewController
 public class DataDomainLayout
@@ -58,13 +59,32 @@ public class DataDomainLayout
     private Spinner<Integer> objectCacheSizeSpinner;
 
     @FXML
-    private CheckBox useSharedCacheCheckBox, remoteChangeNotificationsCheckBox;
+    private CheckBox useSharedCacheCheckBox; // , remoteChangeNotificationsCheckBox;
+
+//    @FXML
+//    private Button remoteChangeConfigurationButton;
+
+    @FXML
+    private VBox javaGroupsConfiguration, jmsConfiguration, customConfiguration;
 
     @FXML
-    private Button remoteChangeConfigurationButton;
+    private ChoiceBox<String> remoteChangeNotificationsChoiceBox;
 
     private DataDomainAdapter dataDomainAdapter;
 
+    private static final String RCN_NONE        = "None";
+    private static final String RCN_JAVA_GROUPS = "JavaGroups Multicast";
+    private static final String RCN_JMS         = "JMS Transport";
+    private static final String RCN_CUSTOM      = "Custom Transport";
+
+    private static final String[] remoteChangeNotificationOptions =
+        {
+            RCN_NONE,
+            RCN_JAVA_GROUPS,
+            RCN_JMS,
+            RCN_CUSTOM
+        };
+
     public DataDomainLayout(final MainWindowSupport parentComponent) throws IOException
     {
         super(parentComponent, "/layouts/DataDomainLayout.fxml");
@@ -86,6 +106,33 @@ public class DataDomainLayout
             {
                 configureRemoteNotifications(newValue);
             });
+
+        hide(javaGroupsConfiguration, jmsConfiguration, customConfiguration);
+
+        remoteChangeNotificationsChoiceBox.getItems().addAll(remoteChangeNotificationOptions);
+        remoteChangeNotificationsChoiceBox.getSelectionModel().select(0);
+        remoteChangeNotificationsChoiceBox.valueProperty().addListener((observable, oldValue,
newValue) ->
+            {
+                if (newValue == RCN_NONE)
+                {
+                    hide(javaGroupsConfiguration, jmsConfiguration, customConfiguration);
+                }
+                else if (newValue == RCN_JAVA_GROUPS)
+                {
+                    hide(jmsConfiguration, customConfiguration);
+                    show(javaGroupsConfiguration);
+                }
+                else if (newValue == RCN_JMS)
+                {
+                    hide(javaGroupsConfiguration, customConfiguration);
+                    show(jmsConfiguration);
+                }
+                else if (newValue == RCN_CUSTOM)
+                {
+                    hide(javaGroupsConfiguration, jmsConfiguration);
+                    show(customConfiguration);
+                }
+            });
     }
 
     @Override
@@ -99,12 +146,14 @@ public class DataDomainLayout
     {
         LOGGER.debug("begin editing " + this);
 
+//        show(javaGroupsConfiguration, jmsConfiguration, customConfiguration);
+
         dataDomainNameTextField.textProperty().bindBidirectional(dataDomainAdapter.nameProperty());
         objectValidationCheckBox.selectedProperty().bindBidirectional(dataDomainAdapter.validatingObjectsProperty());
 
         objectCacheSizeSpinner.getValueFactory().valueProperty().bindBidirectional(dataDomainAdapter.sizeOfObjectCacheProperty().asObject());
         useSharedCacheCheckBox.selectedProperty().bindBidirectional(dataDomainAdapter.useSharedCacheProperty());
-        remoteChangeNotificationsCheckBox.selectedProperty().bindBidirectional(dataDomainAdapter.remoteChangeNotificationsProperty());
+//        remoteChangeNotificationsCheckBox.selectedProperty().bindBidirectional(dataDomainAdapter.remoteChangeNotificationsProperty());
 
         configureRemoteNotifications(dataDomainAdapter.getUseSharedCache());
     }
@@ -164,7 +213,7 @@ public class DataDomainLayout
 
         objectCacheSizeSpinner.getValueFactory().valueProperty().unbindBidirectional(dataDomainAdapter.sizeOfObjectCacheProperty().asObject());
         useSharedCacheCheckBox.selectedProperty().unbindBidirectional(dataDomainAdapter.useSharedCacheProperty());
-        remoteChangeNotificationsCheckBox.selectedProperty().unbindBidirectional(dataDomainAdapter.remoteChangeNotificationsProperty());
+//        remoteChangeNotificationsCheckBox.selectedProperty().unbindBidirectional(dataDomainAdapter.remoteChangeNotificationsProperty());
 
 //        NotificationCenter.removeProjectListener(getMainWindow().getCayenneProject(), this);
 ////        BeanPathAdapter<CayenneModel> dataDomainAdapter = getDataDomainPropertyAdapterMap(getMainWindow().getCayenneModel());
@@ -212,17 +261,17 @@ public class DataDomainLayout
         // TODO Auto-generated method stub
     }
 
-    private void configureRemoteNotifications(boolean enabled)
+    private void configureRemoteNotifications(final boolean enabled)
     {
         if (enabled)
         {
-            enable(remoteChangeNotificationsCheckBox);
-            enable(remoteChangeConfigurationButton);
+//            enable(remoteChangeNotificationsCheckBox);
+//            enable(remoteChangeConfigurationButton);
         }
         else
         {
-            disable(remoteChangeNotificationsCheckBox);
-            disable(remoteChangeConfigurationButton);
+//            disable(remoteChangeNotificationsCheckBox);
+//            disable(remoteChangeConfigurationButton);
             dataDomainAdapter.setRemoteChangeNotifications(false);
         }
     }

http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/830a7d13/src/main/java/org/apache/cayenne/modeler/layout/MainWindowLayout.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/layout/MainWindowLayout.java b/src/main/java/org/apache/cayenne/modeler/layout/MainWindowLayout.java
index f2d2f74..b818cb3 100644
--- a/src/main/java/org/apache/cayenne/modeler/layout/MainWindowLayout.java
+++ b/src/main/java/org/apache/cayenne/modeler/layout/MainWindowLayout.java
@@ -81,7 +81,7 @@ public class MainWindowLayout
 
     private CayenneProject cayenneProject;
 
-    private StringProperty titleProperty = new SimpleStringProperty();
+    private final StringProperty titleProperty = new SimpleStringProperty();
 
     public MainWindowLayout() throws IOException
     {
@@ -99,12 +99,12 @@ public class MainWindowLayout
 
                 if (cayenneProject.isDirty())
                 {
-                    Alert alert = new Alert(AlertType.CONFIRMATION);
+                    final Alert alert = new Alert(AlertType.CONFIRMATION);
                     alert.setTitle("Close Window");
                     alert.setHeaderText("Unsaved Changes");
                     alert.setContentText("Are you sure you want to close this window and
lose your changes?");
 
-                    Optional<ButtonType> result = alert.showAndWait();
+                    final Optional<ButtonType> result = alert.showAndWait();
 
                     if (result.get() == ButtonType.OK)
                     {
@@ -221,9 +221,9 @@ public class MainWindowLayout
                         treeView.getSelectionModel().select(0);
                     }
                 }
-                catch (IOException e)
+                catch (final IOException e)
                 {
-                    LOGGER.fatal("Cannot load UI.");
+                    LOGGER.fatal("Cannot load UI.", e);
                 }
             });
 

http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/830a7d13/src/main/resources/layouts/DataDomainLayout.fxml
----------------------------------------------------------------------
diff --git a/src/main/resources/layouts/DataDomainLayout.fxml b/src/main/resources/layouts/DataDomainLayout.fxml
index b2df3f0..2ce3388 100644
--- a/src/main/resources/layouts/DataDomainLayout.fxml
+++ b/src/main/resources/layouts/DataDomainLayout.fxml
@@ -27,18 +27,18 @@
 <?import java.lang.*?>
 <?import javafx.scene.layout.*?>
 
-<fx:root type="AnchorPane" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1">
+<fx:root minHeight="-Infinity" prefWidth="600.0" type="AnchorPane" xmlns="http://javafx.com/javafx/8.0.40"
xmlns:fx="http://javafx.com/fxml/1">
    <children>
-      <VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity"
prefHeight="400.0" prefWidth="600.0">
+      <VBox maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefWidth="600.0">
          <children>
-            <Label text="DataDomain Configuration">
+            <Label text="DataDomain Configuration" VBox.vgrow="ALWAYS">
                <font>
                   <Font name="System Bold" size="18.0" />
                </font>
             </Label>
             <GridPane>
               <columnConstraints>
-                <ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" maxWidth="-Infinity"
minWidth="-Infinity" prefWidth="150.0" />
+                <ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" maxWidth="-Infinity"
minWidth="-Infinity" prefWidth="200.0" />
                 <ColumnConstraints hgrow="SOMETIMES" minWidth="200.0" prefWidth="200.0"
/>
               </columnConstraints>
               <rowConstraints>
@@ -59,9 +59,9 @@
                   <Insets top="20.0" />
                </VBox.margin>
             </Label>
-            <GridPane>
+            <GridPane VBox.vgrow="ALWAYS">
                <columnConstraints>
-                  <ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" maxWidth="-Infinity"
minWidth="-Infinity" prefWidth="150.0" />
+                  <ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" maxWidth="-Infinity"
minWidth="-Infinity" prefWidth="200.0" />
                   <ColumnConstraints hgrow="SOMETIMES" minWidth="200.0" prefWidth="200.0"
/>
                </columnConstraints>
                <rowConstraints>
@@ -73,15 +73,105 @@
                   <Label alignment="CENTER_RIGHT" text="Size of Object Cache: " />
                   <Spinner fx:id="objectCacheSizeSpinner" editable="true" maxWidth="-Infinity"
minWidth="-Infinity" prefWidth="200.0" GridPane.columnIndex="1" />
                   <CheckBox fx:id="useSharedCacheCheckBox" mnemonicParsing="false" text="Use
Shared Cache" GridPane.columnIndex="1" GridPane.rowIndex="1" />
-                  <HBox alignment="CENTER_LEFT" GridPane.columnIndex="1" GridPane.rowIndex="2">
+                  <ChoiceBox fx:id="remoteChangeNotificationsChoiceBox" GridPane.columnIndex="1"
GridPane.rowIndex="2" />
+                  <Label alignment="CENTER_RIGHT" text="Remote Change Notifications: "
GridPane.rowIndex="2" />
+               </children>
+               <padding>
+                  <Insets bottom="10.0" />
+               </padding>
+            </GridPane>
+            <VBox fx:id="javaGroupsConfiguration" VBox.vgrow="ALWAYS">
+               <children>
+                  <Label text="JavaGroups Multicast Configuration">
+                     <font>
+                        <Font name="System Bold" size="18.0" />
+                     </font>
+                  </Label>
+                  <RadioButton mnemonicParsing="false" text="Standard Configuration">
+                     <padding>
+                        <Insets left="20.0" top="5.0" />
+                     </padding>
+                  </RadioButton>
+                  <GridPane VBox.vgrow="ALWAYS">
+                    <columnConstraints>
+                      <ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" maxWidth="-Infinity"
minWidth="-Infinity" prefWidth="200.0" />
+                      <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"
/>
+                    </columnConstraints>
+                    <rowConstraints>
+                      <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"
/>
+                      <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"
/>
+                    </rowConstraints>
                      <children>
-                        <CheckBox fx:id="remoteChangeNotificationsCheckBox" mnemonicParsing="false"
text="Remote Change Notifications" />
-                        <Pane prefWidth="30.0" />
-                        <Button fx:id="remoteChangeConfigurationButton" mnemonicParsing="false"
text="Configure..." />
+                        <Label alignment="CENTER_RIGHT" text="Multicast Address: " />
+                        <TextField fx:id="dataDomainNameTextField1" maxWidth="-Infinity"
minWidth="-Infinity" prefWidth="200.0" GridPane.columnIndex="1" />
+                        <Label alignment="CENTER_RIGHT" text="Multicast Port: " GridPane.rowIndex="1"
/>
+                        <TextField fx:id="dataDomainNameTextField11" maxWidth="-Infinity"
minWidth="-Infinity" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1" />
                      </children>
-                  </HBox>
+                  </GridPane>
+                  <RadioButton mnemonicParsing="false" text="File Configuration">
+                     <padding>
+                        <Insets left="20.0" />
+                     </padding>
+                  </RadioButton>
+                  <GridPane VBox.vgrow="ALWAYS">
+                    <columnConstraints>
+                      <ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" maxWidth="-Infinity"
minWidth="-Infinity" prefWidth="200.0" />
+                      <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"
/>
+                    </columnConstraints>
+                    <rowConstraints>
+                      <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"
/>
+                    </rowConstraints>
+                     <children>
+                        <Label alignment="CENTER_RIGHT" text="JGroups File: " />
+                        <TextField fx:id="dataDomainNameTextField111" maxWidth="-Infinity"
minWidth="-Infinity" prefWidth="200.0" GridPane.columnIndex="1" />
+                     </children>
+                  </GridPane>
                </children>
-            </GridPane>
+            </VBox>
+            <VBox fx:id="jmsConfiguration" VBox.vgrow="ALWAYS">
+               <children>
+                  <Label text="JMS Transport Configuration">
+                     <font>
+                        <Font name="System Bold" size="18.0" />
+                     </font>
+                  </Label>
+                  <GridPane VBox.vgrow="ALWAYS">
+                    <columnConstraints>
+                      <ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" maxWidth="-Infinity"
minWidth="-Infinity" prefWidth="200.0" />
+                      <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"
/>
+                    </columnConstraints>
+                    <rowConstraints>
+                      <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"
/>
+                    </rowConstraints>
+                     <children>
+                        <Label alignment="CENTER_RIGHT" text="Connection Factory Name:
" />
+                        <TextField maxWidth="-Infinity" minWidth="-Infinity" prefWidth="300.0"
GridPane.columnIndex="1" />
+                     </children>
+                  </GridPane>
+               </children>
+            </VBox>
+            <VBox fx:id="customConfiguration">
+               <children>
+                  <Label text="Custom Transport Configuration" VBox.vgrow="ALWAYS">
+                     <font>
+                        <Font name="System Bold" size="18.0" />
+                     </font>
+                  </Label>
+                  <GridPane VBox.vgrow="ALWAYS">
+                    <columnConstraints>
+                      <ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" maxWidth="-Infinity"
minWidth="-Infinity" prefWidth="200.0" />
+                      <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"
/>
+                    </columnConstraints>
+                    <rowConstraints>
+                      <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"
/>
+                    </rowConstraints>
+                     <children>
+                        <Label text="Factory Class: " />
+                        <TextField maxWidth="-Infinity" minWidth="-Infinity" prefWidth="300.0"
GridPane.columnIndex="1" />
+                     </children>
+                  </GridPane>
+               </children>
+            </VBox>
          </children>
          <padding>
             <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />


Mime
View raw message