cleanup
authorAndreas Müller <a.mueller@bgbm.org>
Tue, 9 Jun 2020 16:22:57 +0000 (18:22 +0200)
committerAndreas Müller <a.mueller@bgbm.org>
Tue, 9 Jun 2020 17:33:12 +0000 (19:33 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java

index 4738b2f7618515f12584042a37515ea4780b96a5..0d824d0a45db7af002ca38341e7aa0e8908c4e53 100644 (file)
@@ -93,16 +93,6 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
     private static final String DEFAULT_PASS = "00000"; //$NON-NLS-1$
     private static final String DEFAULT_USER = "admin"; //$NON-NLS-1$
 
-       protected Object result;
-    protected Shell shlConnect;
-    private Text txtCdmServerStatus;
-    private Text txtCdmInstanceStatus;
-    private Combo comboCdmServer;
-    private Combo comboCdmInstance;
-    private Button btnConnect;
-
-    private final Map<String, CdmServerInfo> csiiMap = new HashMap<>();
-
     private final static String STATUS_AVAILABLE = Messages.RemotingLoginDialog_STATUS_AVAILABLE;
     private final static String STATUS_NOT_AVAILABLE = Messages.RemotingLoginDialog_STATUS_NOT_AVAILABLE;
     private final static String STATUS_STARTED = Messages.RemotingLoginDialog_STATUS_STARTED;
@@ -132,9 +122,14 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
     private final static String LAST_SERVER_KEY = "lastServerKey"; //$NON-NLS-1$
     private final static String LAST_INSTANCE_KEY = "lastInstanceKey"; //$NON-NLS-1$
 
+    protected Shell shlConnect;
+    private Text txtCdmServerStatus;
+    private Text txtCdmInstanceStatus;
+    private Combo comboCdmServer;
+    private Combo comboCdmInstance;
+    private Button btnConnect;
+
     private Composite remotingComposite;
-    private CdmServerInfo selectedServerInfo;
-    private CdmInstanceInfo selectedCdmInstance;
     private Button btnCdmServerRefresh;
     private Button btnCdmInstanceRefresh;
     private Button btnStopServer;
@@ -153,11 +148,6 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
     private ExpandableComposite expandableCompositeAdvanced;
     private StyledText styledTxtMessage;
 
-//    private final int MIN_WIDTH = 530;
-//    private final int MIN_HEIGHT = 220;
-//    private final int MIN_EXP_HEIGHT = 380;
-
-    private final int MESSAGE_HEIGHT = 50;
     private Label lblEditorCdmlibVersion;
     private Text txtEditorCdmlibVersion;
     private Label lblServerSchemaVersion;
@@ -165,11 +155,24 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
     private Label lblEditorCdmVersion;
     private Text txtEditorCdmVersion;
 
-    private String serverName, instanceName;
+    private final int MESSAGE_HEIGHT = 50;
+//  private final int MIN_WIDTH = 530;
+//  private final int MIN_HEIGHT = 220;
+//  private final int MIN_EXP_HEIGHT = 380;
+
     private boolean autoConnect = false;
     private boolean loadLoginPrefs = true;
     private boolean isDevRemoteSource = false;
+
     private Job serverJob;
+    protected Object result;
+
+    private final Map<String, CdmServerInfo> serverInfoMap = new HashMap<>();
+
+    private String serverName;
+    private String instanceName;
+    private CdmServerInfo selectedServerInfo;
+    private CdmInstanceInfo selectedCdmInstance;
 
     /**
      * Create the dialog.
@@ -211,16 +214,14 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
         if(serverName == null && instanceName == null) {
             readPrefLastServerInstance();
         }
+        expandableCompositeAdvanced.setExpanded(false);
 
         setEditorInfo();
         populateCdmServerCombo();
         shlConnect.pack(true);
         shlConnect.open();
 
-        expandableCompositeAdvanced.setExpanded(false);
-
         Display display = getParent().getDisplay();
-
         while (!shlConnect.isDisposed()) {
             if (!display.isDisposed()){
                 if (!display.readAndDispatch()) {
@@ -228,7 +229,6 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
                 }
             }
         }
-
         return result;
     }
 
@@ -268,7 +268,6 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
         txtCdmServerStatus.setBackground(SWTResourceManager.getColor(SWT.COLOR_INFO_BACKGROUND));
         txtCdmServerStatus.setEditable(false);
         GridData gd_txtCdmServerStatus = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
-
         txtCdmServerStatus.setLayoutData(gd_txtCdmServerStatus);
 
         btnCdmServerRefresh = new Button(cdmServerComposite, SWT.NONE);
@@ -316,7 +315,7 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
         btnCdmInstanceRefresh.setLayoutData(gd_btnCdmInstanceRefresh);
         btnCdmInstanceRefresh.setText(Messages.RemotingLoginDialog_LABEL_REFRESH);
 
-        //login
+        //login + connect
         loginComposite = new Composite(remotingComposite, SWT.NONE);
         GridData gd_loginComposite = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
         loginComposite.setLayoutData(gd_loginComposite);
@@ -363,6 +362,7 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
                });
         btnConnect.setText(LABEL_CONNECT);
 
+        //rememberMe + default values
         btnRememberMe = new Button(loginComposite, SWT.CHECK);
         btnRememberMe.setSelection(true);
         GridData gd_btnRememberMe = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
@@ -490,7 +490,7 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
                     public void run() {
                         //TODO performance
                         for(CdmServerInfo csii : CdmServerInfo.getCdmServers()) {
-                            csiiMap.put(csii.getName(), csii);
+                            serverInfoMap.put(csii.getName(), csii);
                             comboCdmServer.add(csii.getName());
                         }
                         int serverIndex = -1;
@@ -538,7 +538,7 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
             });
         }
         catch(SWTException e){
-            //catch widget is disposed exception which may occurr if
+            //catch widget is disposed exception which may occur if
             //dialog is closed but the runnable tries to update
         }
     }
@@ -546,7 +546,7 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
     private void updateSelectedCdmServer() {
         int selIndex = comboCdmServer.getSelectionIndex();
         if(selIndex != -1) {
-            selectedServerInfo = csiiMap.get(comboCdmServer.getItem(selIndex));
+            selectedServerInfo = serverInfoMap.get(comboCdmServer.getItem(selIndex));
         }
     }
 
@@ -1252,4 +1252,38 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
         setMessage(""); //$NON-NLS-1$
         txtServerSchemaVersion.setText(""); //$NON-NLS-1$
     }
+
+    private void updateControls(){
+
+        //server
+//        comboCdmServer; //nothing TODO
+//        txtCdmServerStatus;
+//        btnCdmServerRefresh.setEnabled(true);
+
+        //database
+//        comboCdmInstance
+//        txtCdmInstanceStatus
+//        btnCdmInstanceRefresh;
+
+        //login + connect
+//        txtLogin;
+//        txtPassword;
+//        btnConnect;
+
+        //rememberMe + defaultValues
+//        btnRememberMe;
+//        lblDefaultLogin;
+
+        //message
+//        styledTxtMessage;
+
+        //Advanced
+//        txtPort
+//        btnStopServer;
+
+//        txtServerCdmlibVersion;
+//        txtEditorCdmlibVersion;
+//        txtServerSchemaVersion;
+//        txtEditorCdmVersion;
+    }
 }