missed files for config publishing
authorVictor Kirhenshtein <victor@netxms.org>
Thu, 12 May 2016 19:20:11 +0000 (22:20 +0300)
committerVictor Kirhenshtein <victor@netxms.org>
Thu, 12 May 2016 19:20:11 +0000 (22:20 +0300)
src/java/netxms-eclipse/ServerConfig/icons/publish.gif [new file with mode: 0644]
src/java/netxms-eclipse/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/dialogs/RepositorySelectionDialog.java [new file with mode: 0644]
webui/webapp/ServerConfig/icons/publish.gif [new file with mode: 0644]
webui/webapp/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/dialogs/RepositorySelectionDialog.java [new file with mode: 0644]

diff --git a/src/java/netxms-eclipse/ServerConfig/icons/publish.gif b/src/java/netxms-eclipse/ServerConfig/icons/publish.gif
new file mode 100644 (file)
index 0000000..17ad1e6
Binary files /dev/null and b/src/java/netxms-eclipse/ServerConfig/icons/publish.gif differ
diff --git a/src/java/netxms-eclipse/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/dialogs/RepositorySelectionDialog.java b/src/java/netxms-eclipse/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/dialogs/RepositorySelectionDialog.java
new file mode 100644 (file)
index 0000000..0d829e9
--- /dev/null
@@ -0,0 +1,151 @@
+/**
+ * NetXMS - open source network management system
+ * Copyright (C) 2003-2016 Victor Kirhenshtein
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.netxms.ui.eclipse.serverconfig.dialogs;
+
+import java.util.List;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.netxms.client.market.Repository;
+import org.netxms.ui.eclipse.tools.MessageDialogHelper;
+import org.netxms.ui.eclipse.tools.WidgetHelper;
+
+/**
+ * Repository selection dialog
+ */
+public class RepositorySelectionDialog extends Dialog
+{
+   private List<Repository> repositories;
+   private Repository selection = null;
+   private TableViewer viewer;
+   
+   /**
+    * @param parentShell
+    * @param repositories
+    */
+   public RepositorySelectionDialog(Shell parentShell, List<Repository> repositories)
+   {
+      super(parentShell);
+      this.repositories = repositories;
+   }
+
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+    */
+   @Override
+   protected void configureShell(Shell newShell)
+   {
+      super.configureShell(newShell);
+      newShell.setText("Select Repository");
+   }
+
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+    */
+   @Override
+   protected Control createDialogArea(Composite parent)
+   {
+      Composite dialogArea = (Composite)super.createDialogArea(parent);
+      
+      GridLayout layout = new GridLayout();
+      layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
+      layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
+      layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
+      dialogArea.setLayout(layout);
+      
+      Label label = new Label(dialogArea, SWT.LEFT);
+      label.setText("Available repositories");
+      
+      viewer = new TableViewer(dialogArea, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
+      viewer.setContentProvider(new ArrayContentProvider());
+      viewer.setLabelProvider(new LabelProvider() {
+         @Override
+         public String getText(Object element)
+         {
+            return ((Repository)element).getDescription();
+         }
+      });
+      viewer.setComparator(new ViewerComparator() {
+         @Override
+         public int compare(Viewer viewer, Object e1, Object e2)
+         {
+            return ((Repository)e1).getDescription().compareToIgnoreCase(((Repository)e2).getDescription());
+         }
+      });
+      viewer.setInput(repositories);
+      
+      viewer.addDoubleClickListener(new IDoubleClickListener() {
+         @Override
+         public void doubleClick(DoubleClickEvent event)
+         {
+            okPressed();
+         }
+      });
+      
+      GridData gd = new GridData();
+      gd.horizontalAlignment = SWT.FILL;
+      gd.verticalAlignment = SWT.FILL;
+      gd.grabExcessHorizontalSpace = true;
+      gd.grabExcessVerticalSpace = true;
+      gd.widthHint = 500;
+      gd.heightHint = 300;
+      viewer.getControl().setLayoutData(gd);
+      
+      return dialogArea;
+   }
+
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+    */
+   @Override
+   protected void okPressed()
+   {
+      IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
+      if (selection.size() != 1)
+      {
+         MessageDialogHelper.openWarning(getShell(), "Warning", "Plese select repository from the list then press OK");
+         return;
+      }
+      
+      this.selection = (Repository)selection.getFirstElement();
+      
+      super.okPressed();
+   }
+
+   /**
+    * @return the selection
+    */
+   public Repository getSelection()
+   {
+      return selection;
+   }
+}
diff --git a/webui/webapp/ServerConfig/icons/publish.gif b/webui/webapp/ServerConfig/icons/publish.gif
new file mode 100644 (file)
index 0000000..17ad1e6
Binary files /dev/null and b/webui/webapp/ServerConfig/icons/publish.gif differ
diff --git a/webui/webapp/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/dialogs/RepositorySelectionDialog.java b/webui/webapp/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/dialogs/RepositorySelectionDialog.java
new file mode 100644 (file)
index 0000000..0d829e9
--- /dev/null
@@ -0,0 +1,151 @@
+/**
+ * NetXMS - open source network management system
+ * Copyright (C) 2003-2016 Victor Kirhenshtein
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.netxms.ui.eclipse.serverconfig.dialogs;
+
+import java.util.List;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.netxms.client.market.Repository;
+import org.netxms.ui.eclipse.tools.MessageDialogHelper;
+import org.netxms.ui.eclipse.tools.WidgetHelper;
+
+/**
+ * Repository selection dialog
+ */
+public class RepositorySelectionDialog extends Dialog
+{
+   private List<Repository> repositories;
+   private Repository selection = null;
+   private TableViewer viewer;
+   
+   /**
+    * @param parentShell
+    * @param repositories
+    */
+   public RepositorySelectionDialog(Shell parentShell, List<Repository> repositories)
+   {
+      super(parentShell);
+      this.repositories = repositories;
+   }
+
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+    */
+   @Override
+   protected void configureShell(Shell newShell)
+   {
+      super.configureShell(newShell);
+      newShell.setText("Select Repository");
+   }
+
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+    */
+   @Override
+   protected Control createDialogArea(Composite parent)
+   {
+      Composite dialogArea = (Composite)super.createDialogArea(parent);
+      
+      GridLayout layout = new GridLayout();
+      layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
+      layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
+      layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
+      dialogArea.setLayout(layout);
+      
+      Label label = new Label(dialogArea, SWT.LEFT);
+      label.setText("Available repositories");
+      
+      viewer = new TableViewer(dialogArea, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
+      viewer.setContentProvider(new ArrayContentProvider());
+      viewer.setLabelProvider(new LabelProvider() {
+         @Override
+         public String getText(Object element)
+         {
+            return ((Repository)element).getDescription();
+         }
+      });
+      viewer.setComparator(new ViewerComparator() {
+         @Override
+         public int compare(Viewer viewer, Object e1, Object e2)
+         {
+            return ((Repository)e1).getDescription().compareToIgnoreCase(((Repository)e2).getDescription());
+         }
+      });
+      viewer.setInput(repositories);
+      
+      viewer.addDoubleClickListener(new IDoubleClickListener() {
+         @Override
+         public void doubleClick(DoubleClickEvent event)
+         {
+            okPressed();
+         }
+      });
+      
+      GridData gd = new GridData();
+      gd.horizontalAlignment = SWT.FILL;
+      gd.verticalAlignment = SWT.FILL;
+      gd.grabExcessHorizontalSpace = true;
+      gd.grabExcessVerticalSpace = true;
+      gd.widthHint = 500;
+      gd.heightHint = 300;
+      viewer.getControl().setLayoutData(gd);
+      
+      return dialogArea;
+   }
+
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+    */
+   @Override
+   protected void okPressed()
+   {
+      IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
+      if (selection.size() != 1)
+      {
+         MessageDialogHelper.openWarning(getShell(), "Warning", "Plese select repository from the list then press OK");
+         return;
+      }
+      
+      this.selection = (Repository)selection.getFirstElement();
+      
+      super.okPressed();
+   }
+
+   /**
+    * @return the selection
+    */
+   public Repository getSelection()
+   {
+      return selection;
+   }
+}