summaryrefslogtreecommitdiffstats
path: root/src/com.gluster.storage.management.gui
diff options
context:
space:
mode:
authorselvam <selvam@selvam-Studio-XPS-1340.(none)>2011-05-26 18:42:42 +0530
committerselvam <selvam@selvam-Studio-XPS-1340.(none)>2011-05-26 18:42:42 +0530
commitcec3ee3bba0a26e72c77ab02be1ddd86bdfb6f29 (patch)
tree4a1ceb006ca770fef1e38f8856e18f5415868e50 /src/com.gluster.storage.management.gui
parent438a338f415038222a91bc6a4abcd93ea82bac02 (diff)
Mounting information section Gluster FS download link added in volume summary view
Diffstat (limited to 'src/com.gluster.storage.management.gui')
-rw-r--r--src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/BrickTableLabelProvider.java12
-rw-r--r--src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/utils/GUIHelper.java2
-rw-r--r--src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/VolumeSummaryView.java47
3 files changed, 48 insertions, 13 deletions
diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/BrickTableLabelProvider.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/BrickTableLabelProvider.java
index deaea17c..b444bbee 100644
--- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/BrickTableLabelProvider.java
+++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/BrickTableLabelProvider.java
@@ -48,7 +48,11 @@ public class BrickTableLabelProvider extends TableLabelProviderAdapter {
switch (status) {
case READY:
return guiHelper.getImage(IImageKeys.STATUS_ONLINE);
- case OFFLINE:
+ case IO_ERROR:
+ return guiHelper.getImage(IImageKeys.STATUS_OFFLINE);
+ case UNINITIALIZED:
+ return guiHelper.getImage(IImageKeys.STATUS_OFFLINE);
+ case INITIALIZING:
return guiHelper.getImage(IImageKeys.STATUS_OFFLINE);
default:
throw new GlusterRuntimeException("Invalid brick status [" + status + "]");
@@ -67,10 +71,10 @@ public class BrickTableLabelProvider extends TableLabelProviderAdapter {
}
private String getDiskSpace(Disk disk) {
- if (disk.isOffline()) {
- return "NA";
- } else {
+ if (disk.isReady()) {
return NumberUtil.formatNumber(disk.getSpace());
+ } else {
+ return "NA";
}
}
diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/utils/GUIHelper.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/utils/GUIHelper.java
index 89c5a78e..90b5d587 100644
--- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/utils/GUIHelper.java
+++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/utils/GUIHelper.java
@@ -134,7 +134,7 @@ public class GUIHelper {
layout.verticalSpacing = 15;
layout.marginBottom = 20;
layout.marginTop = 5;
-
+
client.setLayout(layout);
section.setClient(client);
diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/VolumeSummaryView.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/VolumeSummaryView.java
index c1597bae..6871c683 100644
--- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/VolumeSummaryView.java
+++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/VolumeSummaryView.java
@@ -1,5 +1,7 @@
package com.gluster.storage.management.gui.views;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
@@ -20,8 +22,11 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.widgets.FormText;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Hyperlink;
import org.eclipse.ui.forms.widgets.ScrolledForm;
@@ -136,10 +141,10 @@ public class VolumeSummaryView extends ViewPart {
lblAlert.redraw();
}
- private Label setLabelStyle(Label label, String fontName, int size, int style) {
+ private FormText setFormTextStyle(FormText formText, String fontName, int size, int style ) {
Font font = new Font(Display.getCurrent(), new FontData(fontName, size, style));
- label.setFont(font);
- return label;
+ formText.setFont(font);
+ return formText;
}
private void createVolumeMountingInfoSection() {
@@ -151,17 +156,43 @@ public class VolumeSummaryView extends ViewPart {
String nfsMountInfo = "mount -t nfs " + firstOnlineServer + ":/" + volume.getName() + " <mount-point>";
String info = "Server can be any server name in the storage cloud eg. <" + onlineServers + ">"; //TODO: if more than 10 servers...
- Composite section = guiHelper.createSection(form, toolkit, "Mounting Information", null, 2, false);
-
+ Composite section = guiHelper.createSection(form, toolkit, "Mounting Information", null, 3, false);
+
toolkit.createLabel(section, glusterFs, SWT.NORMAL);
- setLabelStyle(toolkit.createLabel(section, glusterFsMountInfo, SWT.NONE), COURIER_FONT, 10, SWT.NONE);
+ FormText glusterfsMountText = setFormTextStyle(toolkit.createFormText(section, true), COURIER_FONT, 10, SWT.NONE);
+ glusterfsMountText.setText(glusterFsMountInfo, false, false);
+ glusterfsMountText.setLayoutData(new GridData(GridData.BEGINNING, GridData.VERTICAL_ALIGN_CENTER, false, false, 2, 0)); // Label spanned two column
// TODO: Check required if nfs is optional
toolkit.createLabel(section, nfs, SWT.NORMAL);
- setLabelStyle(toolkit.createLabel(section, nfsMountInfo, SWT.NONE), COURIER_FONT, 10, SWT.NONE);
+ FormText glusterNfsMountText = setFormTextStyle(toolkit.createFormText(section, true), COURIER_FONT, 10, SWT.NONE);
+ glusterNfsMountText.setText(nfsMountInfo, false, false);
+ glusterNfsMountText.setLayoutData(new GridData(GridData.BEGINNING, GridData.VERTICAL_ALIGN_CENTER, false, false, 2, 0));
+
+ toolkit.createLabel(section, "");
+ Label infoLabel = toolkit.createLabel(section, info, SWT.NONE);
+ infoLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.VERTICAL_ALIGN_CENTER, false, false, 2, 0));
+
+ //TODO: implement a logic to identify the corresponding glusterfs client download link
+ String message = "You can download gluster FS client from";
+ String glusterClientDownloadlinkText = "here.";
+ final String glusterClientDownloadlink = "http://www.gluster.com";
toolkit.createLabel(section, "");
- toolkit.createLabel(section, info, SWT.NONE);
+ toolkit.createLabel(section, message );
+ Hyperlink link = toolkit.createHyperlink(section, glusterClientDownloadlinkText, SWT.NORMAL);
+ link.addHyperlinkListener(new HyperlinkAdapter() {
+ public void linkActivated(HyperlinkEvent e) {
+ try {
+ System.out.println(e.getLabel() + " [" + e.getHref() + "]");
+ PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL( glusterClientDownloadlink ));
+ } catch (PartInitException e1) {
+ e1.printStackTrace();
+ } catch (MalformedURLException e1) {
+ e1.printStackTrace();
+ }
+ }
+ });
}
private String getOnlineServers(int maxServers) {