[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java | 37 ++++------
1 file changed, 17 insertions(+), 20 deletions(-)
New commits:
commit 7f51c8b8b62835bb0c7eaa68726de75bbbff9866
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 23 21:36:09 2011 -0400
BZ 689951 - message center window's list grid needed to be refreshed in order to have its rows be selectable
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
index f861a37..b5907fd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
@@ -90,31 +90,28 @@ public class MessageCenterView extends Table implements MessageCenter.MessageLis
*/
public void showMessageCenterWindow() {
try {
- createWindow().show();
+ if (window == null) {
+ window = new MessageCenterWindow("MessageCenterViewWindow");
+ window.addItem(this);
+ window.addCloseClickHandler(new CloseClickHandler() {
+ @Override
+ public void onCloseClick(CloseClientEvent event) {
+ try {
+ window.hide();
+ } catch (Throwable e) {
+ Log.warn("Cannot destroy message center", e);
+ }
+ }
+ });
+ }
+
+ window.show();
+ markForRedraw(); // need this to ensure the list grid rows are selectable
} catch (Throwable e) {
Log.error("Cannot show message center window", e);
}
}
- private Window createWindow() {
- if (window == null) {
- window = new MessageCenterWindow("MessageCenterViewWindow");
- window.addItem(this);
- window.addCloseClickHandler(new CloseClickHandler() {
- @Override
- public void onCloseClick(CloseClientEvent event) {
- try {
- window.hide();
- } catch (Throwable e) {
- Log.warn("Cannot destroy message center", e);
- }
- }
- });
- }
-
- return window;
- }
-
@Override
public void onMessage(final Message message) {
try {
13 years, 3 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 2f94b6e8de74e304c3044c404d3ce90b17332ada
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 23 19:25:44 2011 -0400
don't allow tags to be added/removed if you don't have permission
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
index a0e3949..1046f31 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
@@ -128,8 +128,8 @@ public class ResourceTitleBar extends LocatableVLayout {
badge = new Img(ImageManager.getResourceLargeIcon(ResourceCategory.SERVICE), 24, 24);
- TagEditorView tagEditorView = new TagEditorView(extendLocatorId("TagEdit"), resource.getTags(), false,
- new TagsChangedCallback() {
+ TagEditorView tagEditorView = new TagEditorView(extendLocatorId("TagEdit"), resource.getTags(),
+ !resourceComposite.getResourcePermission().isInventory(), new TagsChangedCallback() {
public void tagsChanged(final HashSet<Tag> tags) {
GWTServiceLookup.getTagService().updateResourceTags(resource.getId(), tags,
new AsyncCallback<Void>() {
13 years, 3 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java | 247 +++++-----
1 file changed, 142 insertions(+), 105 deletions(-)
New commits:
commit cd4b00e6a257ac66ba60b128679168bcee1cecde
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 23 19:24:54 2011 -0400
BZ 688915 refactor the tag editor so it doesn't disappear after adding a third tag.
make components reuseable, don't throw away and recreate components
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java
index 14f9a39..ac289a2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java
@@ -22,6 +22,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.components.tagging;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
@@ -30,6 +31,7 @@ import java.util.Set;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.TextMatchStyle;
+import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.events.ClickEvent;
@@ -41,7 +43,6 @@ import com.smartgwt.client.widgets.events.MouseOverHandler;
import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent;
import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler;
-import com.smartgwt.client.widgets.layout.Layout;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
import org.rhq.core.domain.criteria.TagCriteria;
@@ -51,34 +52,64 @@ import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.Locatable;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDialog;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableImg;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLayout;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
+ * A reusable component that shows a set of tags and, if not read only, allows the user
+ * to delete existing tags or add new tags.
+ *
* @author Greg Hinkle
+ * @author John Mazzitelli
*/
public class TagEditorView extends LocatableLayout {
private LinkedHashSet<Tag> tags = new LinkedHashSet<Tag>();
-
private boolean readOnly;
private TagsChangedCallback callback;
-
- private boolean vertical = false;
+ private HTMLFlow tagTitleLabel;
+ private ArrayList<LocatableHLayout> tagLayouts;
+ private Img addImg;
+ private TagInputDialog tagInputDialog;
public TagEditorView(String locatorId, Set<Tag> tags, boolean readOnly, TagsChangedCallback callback) {
+ this(locatorId, tags, readOnly, callback, false);
+ }
+
+ public TagEditorView(String locatorId, Set<Tag> tags, boolean readOnly, TagsChangedCallback callback,
+ boolean vertical) {
+
super(locatorId);
+ setVertical(vertical);
+ setAutoWidth();
+ if (!vertical) {
+ setMembersMargin(8);
+ }
+
if (tags != null) {
this.tags.addAll(tags);
}
this.readOnly = readOnly;
this.callback = callback;
+
+ tagTitleLabel = new HTMLFlow("<b>" + MSG.view_tags_tags() + ":</b>");
+ tagTitleLabel.setAutoWidth();
+
+ if (!this.readOnly) {
+ tagInputDialog = new TagInputDialog(extendLocatorId("tagInputDialog"));
+
+ addImg = new LocatableImg(extendLocatorId("addImg"), "[skin]/images/actions/add.png", 16, 16);
+ addImg.setTooltip(MSG.view_tags_tooltip_2());
+ addImg.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ showTagInput();
+ }
+ });
+ }
}
public LinkedHashSet<Tag> getTags() {
@@ -86,40 +117,57 @@ public class TagEditorView extends LocatableLayout {
}
public void setTags(LinkedHashSet<Tag> tags) {
- this.tags = tags;
+ this.tags.clear();
+ if (tags != null) {
+ this.tags.addAll(tags);
+ }
setup();
}
- public void setVertical(boolean vertical) {
- this.vertical = vertical;
- }
-
@Override
protected void onDraw() {
super.onDraw();
-
setup();
}
private void setup() {
- destroyMembers();
+ // remove old members
+ removeMember(tagTitleLabel);
+ if (tagLayouts != null) {
+ for (LocatableHLayout tagLayout : tagLayouts) {
+ removeMember(tagLayout);
+ tagLayout.destroy();
+ }
+ }
+ if (addImg != null) {
+ removeMember(addImg);
+ }
+
+ // add new members
+ addMember(tagTitleLabel);
+ tagLayouts = createTagLayouts();
+ for (LocatableHLayout tagLayout : tagLayouts) {
+ addMember(tagLayout);
+ }
+ if (!readOnly) {
+ addMember(addImg);
+ tagInputDialog.place(addImg);
+ }
- Layout layout = vertical ? new LocatableVLayout(getLocatorId()) : new LocatableHLayout(getLocatorId());
- if (!vertical)
- layout.setMembersMargin(8);
+ markForRedraw();
+ }
- HTMLFlow title = new HTMLFlow("<b>" + MSG.view_tags_tags() + ":</b>");
- title.setAutoWidth();
- layout.addMember(title);
+ private ArrayList<LocatableHLayout> createTagLayouts() {
+ ArrayList<LocatableHLayout> tagLayouts = new ArrayList<LocatableHLayout>(tags.size());
for (final Tag tag : tags) {
- LocatableHLayout tagLayout = new LocatableHLayout(((Locatable) layout).extendLocatorId(tag.getName()));
+ LocatableHLayout tagLayout = new LocatableHLayout(extendLocatorId(tag.getName()));
tagLayout.setHeight(18);
+ tagLayout.setHeight(16);
HTMLFlow tagString = new HTMLFlow("<a href=\"" + LinkManager.getTagLink(tag.toString()) + "\">"
+ tag.toString() + "</a>");
tagString.setAutoWidth();
-
tagLayout.addMember(tagString);
if (!readOnly) {
@@ -136,6 +184,7 @@ public class TagEditorView extends LocatableLayout {
save();
}
});
+
tagLayout.addMember(remove);
tagLayout.addMember(spacer);
remove.hide();
@@ -154,38 +203,13 @@ public class TagEditorView extends LocatableLayout {
});
}
- tagLayout.setHeight(16);
- layout.addMember(tagLayout);
- }
-
- if (!readOnly) {
- final Img modeImg = new LocatableImg(((Locatable) layout).getLocatorId(), "[skin]/images/actions/add.png",
- 16, 16);
-
- modeImg.setTooltip(MSG.view_tags_tooltip_2());
- modeImg.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
-
- showTagInput(modeImg.getAbsoluteLeft(), modeImg.getAbsoluteTop());
- }
- });
- layout.addMember(modeImg);
+ tagLayouts.add(tagLayout);
}
- layout.setAutoWidth();
- addMember(layout);
-
- markForRedraw();
+ return tagLayouts;
}
- private void showTagInput(int left, int top) {
- final LocatableDialog dialog = new LocatableDialog(getLocatorId());
- final LocatableDynamicForm form = new LocatableDynamicForm(dialog.getLocatorId());
- final ComboBoxItem tagInput = new ComboBoxItem("tag");
-
- tagInput.setShowTitle(false);
- tagInput.setHideEmptyPickList(true);
- // tagInput.setOptionDataSource(new TaggingDataSource());
+ private void showTagInput() {
TagCriteria criteria = new TagCriteria();
criteria.addSortNamespace(PageOrdering.ASC);
criteria.addSortSemantic(PageOrdering.ASC);
@@ -201,69 +225,82 @@ public class TagEditorView extends LocatableLayout {
for (Tag tag : result) {
values[i++] = tag.toString();
}
- tagInput.setValueMap(values);
+ tagInputDialog.setTagSuggestions(values);
}
});
- tagInput.setValueField("tag");
- tagInput.setDisplayField("tag");
- tagInput.setType("comboBox");
- tagInput.setTextMatchStyle(TextMatchStyle.SUBSTRING);
- tagInput.setTooltip(MSG.view_tags_tooltip_3());
- /*tagInput.addBlurHandler(new BlurHandler() {
- public void onBlur(BlurEvent blurEvent) {
- String tag = form.getValueAsString("tag");
- if (tag != null) {
- Tag newTag = new Tag(tag);
- tags.add(newTag);
- save();
- // TagEditorView.this.setup();
- }
- }
- });*/
- tagInput.addKeyPressHandler(new KeyPressHandler() {
- public void onKeyPress(KeyPressEvent event) {
- if ((event.getCharacterValue() != null) && (event.getCharacterValue() == KeyCodes.KEY_ENTER)) {
- String tag = form.getValueAsString("tag");
- if (tag != null) {
- Tag newTag = new Tag(tag);
- tags.add(newTag);
- save();
- dialog.destroy();
- // TagEditorView.this.setup();
- }
- }
- }
- });
-
- form.setFields(tagInput);
-
- dialog.setIsModal(true);
- dialog.setShowHeader(false);
- dialog.setShowEdges(false);
- dialog.setEdgeSize(10);
- dialog.setWidth(200);
- dialog.setHeight(30);
-
- dialog.setShowToolbar(false);
-
- Map bodyDefaults = new HashMap();
- bodyDefaults.put("layoutLeftMargin", 5);
- bodyDefaults.put("membersMargin", 10);
- dialog.setBodyDefaults(bodyDefaults);
-
- dialog.addItem(form);
-
- dialog.setDismissOnEscape(true);
- dialog.setDismissOnOutsideClick(true);
-
- dialog.show();
- dialog.moveTo(left - 8, top - 4);
- tagInput.focusInItem();
+ tagInputDialog.show();
+ tagInputDialog.place(addImg);
+ markForRedraw();
}
private void save() {
this.callback.tagsChanged(tags);
TagEditorView.this.setup();
}
+
+ private class TagInputDialog extends LocatableDialog {
+ private ComboBoxItem tagInputItem;
+
+ public TagInputDialog(String locatorId) {
+ super(locatorId);
+
+ setIsModal(true);
+ setShowHeader(false);
+ setShowEdges(false);
+ setEdgeSize(10);
+ setWidth(200);
+ setHeight(30);
+ setShowToolbar(false);
+ setDismissOnEscape(true);
+ setDismissOnOutsideClick(true);
+ Map<String, Integer> bodyDefaults = new HashMap<String, Integer>(2);
+ bodyDefaults.put("layoutLeftMargin", 5);
+ bodyDefaults.put("membersMargin", 10);
+ setBodyDefaults(bodyDefaults);
+
+ final LocatableDynamicForm form = new LocatableDynamicForm(extendLocatorId("tagInputForm"));
+ addItem(form);
+
+ tagInputItem = new ComboBoxItem("tag");
+ tagInputItem.setShowTitle(false);
+ tagInputItem.setHideEmptyPickList(true);
+ tagInputItem.setValueField("tag");
+ tagInputItem.setDisplayField("tag");
+ tagInputItem.setType("comboBox");
+ tagInputItem.setTextMatchStyle(TextMatchStyle.SUBSTRING);
+ tagInputItem.setTooltip(MSG.view_tags_tooltip_3());
+ tagInputItem.addKeyPressHandler(new KeyPressHandler() {
+ public void onKeyPress(KeyPressEvent event) {
+ if ((event.getCharacterValue() != null) && (event.getCharacterValue() == KeyCodes.KEY_ENTER)) {
+ //String tag = form.getValueAsString("tag");
+ String tag = tagInputItem.getEnteredValue();
+ if (tag != null) {
+ Tag newTag = new Tag(tag);
+ tags.add(newTag);
+ TagEditorView.this.save();
+ TagInputDialog.this.hide();
+ }
+ }
+ }
+ });
+ form.setFields(tagInputItem);
+ }
+
+ @Override
+ public void show() {
+ super.show();
+ tagInputItem.clearValue();
+ tagInputItem.focusInItem();
+ }
+
+ public void setTagSuggestions(String[] suggestions) {
+ tagInputItem.setValueMap(suggestions);
+ }
+
+ public void place(Canvas canvas) {
+ // move this object over top the given canvas
+ moveTo(canvas.getAbsoluteLeft() - 8, canvas.getAbsoluteTop() - 4);
+ }
+ }
}
13 years, 3 months
[rhq] modules/enterprise
by ips
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/filter/CacheControlFilter.java | 76 ++++++++++
modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml | 9 +
2 files changed, 85 insertions(+)
New commits:
commit c9efcac6010e5a0a6f64472d1465d8e3cd991545
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Mar 23 16:58:19 2011 -0400
implement "perfect caching" for GWT-compiled URLs (https://bugzilla.redhat.com/show_bug.cgi?id=617729)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/filter/CacheControlFilter.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/filter/CacheControlFilter.java
new file mode 100644
index 0000000..3f49857
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/filter/CacheControlFilter.java
@@ -0,0 +1,76 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * 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 version 2 of the License.
+ *
+ * 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.rhq.enterprise.gui.coregui.server.filter;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.Date;
+
+/**
+ * Specify the cache policy browsers should use for GWT-compiled files. See
+ * http://code.google.com/webtoolkit/doc/latest/DevGuideCompilingAndDebuggin... for more info.
+ *
+ * @author Ian Springer
+ */
+public class CacheControlFilter implements Filter {
+
+ private static final long SECONDS_IN_ONE_YEAR = 365 * 24 * 60 * 60L;
+ private static final long MILLISECONDS_IN_ONE_YEAR = SECONDS_IN_ONE_YEAR * 1000;
+
+ public void init(FilterConfig config) throws ServletException {
+ return;
+ }
+
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException,
+ ServletException {
+ HttpServletRequest httpServletRequest = (HttpServletRequest) request;
+ String requestURI = httpServletRequest.getRequestURI();
+
+ if (requestURI.contains(".nocache.")) {
+ // Tell browser to disable caching of the content.
+ Date now = new Date();
+ HttpServletResponse httpResponse = (HttpServletResponse) response;
+ httpResponse.setDateHeader("Date", now.getTime());
+ httpResponse.setDateHeader("Expires", now.getTime() - 1);
+ httpResponse.setHeader("Pragma", "no-cache");
+ httpResponse.setHeader("Cache-Control", "public, max-age=0, must-revalidate");
+ } else if (requestURI.contains(".cache.")) {
+ // Tell browser to cache the content for one year.
+ Date now = new Date();
+ HttpServletResponse httpResponse = (HttpServletResponse) response;
+ httpResponse.setDateHeader("Date", now.getTime());
+ httpResponse.setDateHeader("Expires", now.getTime() + MILLISECONDS_IN_ONE_YEAR);
+ httpResponse.setHeader("Cache-Control", "max-age=" + SECONDS_IN_ONE_YEAR);
+ }
+
+ filterChain.doFilter(request, response);
+ }
+
+ public void destroy() {
+ return;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
index ac247b1..d06fa58 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
+++ b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
@@ -7,6 +7,15 @@
<display-name>RHQ GUI</display-name>
+ <filter>
+ <filter-name>CacheControlFilter</filter-name>
+ <filter-class>org.rhq.enterprise.gui.coregui.server.filter.CacheControlFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>CacheControlFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
<servlet>
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI RoleGWTService</servlet-name>
13 years, 3 months
[rhq] modules/enterprise
by ips
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java | 16 ++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java | 35 ++++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ObjectFilter.java | 3
3 files changed, 34 insertions(+), 20 deletions(-)
New commits:
commit 2dfc4a34aa925d2683bb6dff736e5154fbe6c443
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Mar 23 13:21:21 2011 -0400
some changes to locators in Table sub-widgets to make sure locators are hierarchal
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index 9d1c1ba..c68da84 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -458,11 +458,12 @@ public class ConfigurationEditor extends LocatableVLayout {
Menu menu = new LocatableMenu(toolStrip.extendLocatorId("JumpMenu"));
for (SectionStackSection section : sectionStack.getSections()) {
MenuItem item = new MenuItem(section.getTitle());
+ item.setAttribute("name", section.getName());
item.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
- int x = event.getMenu().getItemNum(event.getItem());
- sectionStack.expandSection(x);
- sectionStack.showSection(x);
+ int index = event.getMenu().getItemNum(event.getItem());
+ sectionStack.expandSection(index);
+ sectionStack.showSection(index);
}
});
menu.addItem(item);
@@ -491,13 +492,14 @@ public class ConfigurationEditor extends LocatableVLayout {
section = new SectionStackSection(MSG.common_title_generalProp());
section.setExpanded(true);
} else {
- section = new SectionStackSection(
- "<div style=\"float:left; font-weight: bold;\">"
+ String title = "<div style=\"float:left; font-weight: bold;\">"
+ group.getDisplayName()
+ "</div>"
+ (group.getDescription() != null ? ("<div style='padding-left: 10px; font-weight: normal; font-size: smaller; float: left;'>"
- + " - " + group.getDescription() + "</div>")
- : ""));
+ + " - " + group.getDescription() + "</div>")
+ : "");
+ section = new SectionStackSection(title);
+ section.setName(group.getName());
section.setExpanded(!group.isDefaultHidden());
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index 4864145..b22a79a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -52,7 +52,6 @@ import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.events.DoubleClickEvent;
import com.smartgwt.client.widgets.events.DoubleClickHandler;
-import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.HiddenItem;
import com.smartgwt.client.widgets.form.fields.SelectItem;
@@ -72,7 +71,6 @@ import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.menu.IMenuButton;
import com.smartgwt.client.widgets.menu.MenuItem;
import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
-import com.smartgwt.client.widgets.toolbar.ToolStrip;
import org.rhq.core.domain.search.SearchSubsystem;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
@@ -80,11 +78,13 @@ import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.components.form.SearchBarItem;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIMenuButton;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableMenu;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableToolStrip;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
@@ -133,8 +133,8 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
private boolean tableActionDisableOverride = false;
protected List<Canvas> extraWidgetsAboveFooter = new ArrayList<Canvas>();
protected List<Canvas> extraWidgetsInMainFooter = new ArrayList<Canvas>();
- private ToolStrip footer;
- private ToolStrip footerExtraWidgets;
+ private LocatableToolStrip footer;
+ private LocatableToolStrip footerExtraWidgets;
public Table(String locatorId) {
this(locatorId, null, null, null, null, true);
@@ -210,7 +210,7 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
protected void onInit() {
super.onInit();
- contents = new LocatableVLayout(extendLocatorId("tableContents"));
+ contents = new LocatableVLayout(extendLocatorId("Contents"));
contents.setWidth100();
contents.setHeight100();
//contents.setOverflow(Overflow.AUTO);
@@ -287,7 +287,7 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
setTableTitle(this.tableTitle);
if (showHeader) {
- titleLayout = new HLayout();
+ titleLayout = new LocatableHLayout(contents.extendLocatorId("Title"));
titleLayout.setAutoHeight();
titleLayout.setAlign(VerticalAlignment.BOTTOM);
contents.addMember(titleLayout, 0);
@@ -301,16 +301,16 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
// Footer
- // A second toolstrip that optionaly appears before the main footer - it will contain extra widgets.
+ // A second toolstrip that optionally appears before the main footer - it will contain extra widgets.
// This is hidden from view unless extra widgets are actually added to the table above the main footer.
- this.footerExtraWidgets = new ToolStrip();
+ this.footerExtraWidgets = new LocatableToolStrip(contents.extendLocatorId("FooterExtraWidgets"));
footerExtraWidgets.setPadding(5);
footerExtraWidgets.setWidth100();
footerExtraWidgets.setMembersMargin(15);
footerExtraWidgets.hide();
contents.addMember(footerExtraWidgets);
- this.footer = new ToolStrip();
+ this.footer = new LocatableToolStrip(contents.extendLocatorId("Footer"));
footer.setPadding(5);
footer.setWidth100();
footer.setMembersMargin(15);
@@ -747,7 +747,17 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
public void addTableAction(String locatorId, String title, String confirmation,
LinkedHashMap<String, ? extends Object> valueMap, TableAction tableAction) {
- TableActionInfo info = new TableActionInfo(locatorId, title, confirmation, valueMap, tableAction);
+ // If the specified locator ID is qualified, strip off the ancestry prefix, so we can make sure its locator ID
+ // extends the footer's locator ID as it should.
+ int underscoreIndex = locatorId.lastIndexOf('_');
+ String unqualifiedLocatorId;
+ if (underscoreIndex >= 0 && underscoreIndex != (locatorId.length() - 1)) {
+ unqualifiedLocatorId = locatorId.substring(underscoreIndex + 1);
+ } else {
+ unqualifiedLocatorId = locatorId;
+ }
+ TableActionInfo info = new TableActionInfo(this.footer.extendLocatorId(unqualifiedLocatorId), title,
+ confirmation, valueMap, tableAction);
tableActions.add(info);
}
@@ -894,7 +904,7 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
*
* @author Joseph Marques
*/
- private static class TableFilter extends DynamicForm implements KeyPressHandler, ChangedHandler,
+ private static class TableFilter extends LocatableDynamicForm implements KeyPressHandler, ChangedHandler,
com.google.gwt.event.dom.client.KeyPressHandler {
private Table<?> table;
@@ -902,7 +912,7 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
private HiddenItem hiddenItem;
public TableFilter(Table<?> table) {
- super();
+ super(table.extendLocatorId("TableFilter"));
setWidth100();
setPadding(5);
this.table = table;
@@ -1050,4 +1060,5 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
protected SearchSubsystem getSearchSubsystem() {
return null;
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ObjectFilter.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ObjectFilter.java
index e090640..01921e6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ObjectFilter.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ObjectFilter.java
@@ -39,7 +39,7 @@ public class ObjectFilter {
for (Object object : collection) {
filterFields(object, goodFields);
}
- com.allen_sauer.gwt.log.client.Log.info("Object filtered from size [" + sizeOfBefore + "] to [" + sizeOf(collection) + "]");
+ Log.debug("Object filtered from size [" + sizeOfBefore + "] to [" + sizeOf(collection) + "]");
return collection;
}
@@ -80,4 +80,5 @@ public class ObjectFilter {
}
return -1;
}
+
}
13 years, 3 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java | 8 --------
1 file changed, 8 deletions(-)
New commits:
commit 42eaa4d6e29b325f94539bcb87d6f2155706df18
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 23 13:04:27 2011 -0400
remove unused, obsolete code
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java
index 522c9cd..14f9a39 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java
@@ -66,12 +66,10 @@ public class TagEditorView extends LocatableLayout {
private LinkedHashSet<Tag> tags = new LinkedHashSet<Tag>();
- private boolean editing = false;
private boolean readOnly;
private TagsChangedCallback callback;
private boolean vertical = false;
- private boolean alwaysEdit = false;
public TagEditorView(String locatorId, Set<Tag> tags, boolean readOnly, TagsChangedCallback callback) {
super(locatorId);
@@ -96,11 +94,6 @@ public class TagEditorView extends LocatableLayout {
this.vertical = vertical;
}
- public void setAlwaysEdit(boolean alwaysEdit) {
- this.alwaysEdit = alwaysEdit;
- this.editing = true;
- }
-
@Override
protected void onDraw() {
super.onDraw();
@@ -122,7 +115,6 @@ public class TagEditorView extends LocatableLayout {
for (final Tag tag : tags) {
LocatableHLayout tagLayout = new LocatableHLayout(((Locatable) layout).extendLocatorId(tag.getName()));
tagLayout.setHeight(18);
- //tagLayout.set
HTMLFlow tagString = new HTMLFlow("<a href=\"" + LinkManager.getTagLink(tag.toString()) + "\">"
+ tag.toString() + "</a>");
13 years, 3 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java | 64 ++++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java | 18 ++
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 1
3 files changed, 58 insertions(+), 25 deletions(-)
New commits:
commit 15099180a4a54d3d973ab8fe16116787e929c33b
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 23 12:36:09 2011 -0400
be able to view details of the current message in the message bar via right-mouse context menu
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java
index 39648a2..f000569 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java
@@ -24,14 +24,22 @@ import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.events.DoubleClickEvent;
import com.smartgwt.client.widgets.events.DoubleClickHandler;
+import com.smartgwt.client.widgets.events.RightMouseDownEvent;
+import com.smartgwt.client.widgets.events.RightMouseDownHandler;
+import com.smartgwt.client.widgets.menu.Menu;
+import com.smartgwt.client.widgets.menu.MenuItem;
+import com.smartgwt.client.widgets.menu.events.ClickHandler;
+import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLabel;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableMenu;
/**
* A bar for displaying a message at the top of a page - the equivalent of the JSF h:messages component.
- * The message will be displayed for 30 seconds and then will be automatically cleared.
+ * The message will be displayed for 30 seconds and then will be automatically cleared unless
+ * it is a sticky message.
*
* @author Ian Springer
* @author Jay Shaughnessy
@@ -39,32 +47,42 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLabel;
public class MessageBar extends LocatableHLayout implements MessageCenter.MessageListener {
private static final String LOCATOR_ID = "MessageBar";
private static final int AUTO_HIDE_DELAY_MILLIS = 30000;
-
- private LocatableLabel label = new LocatableLabel(extendLocatorId("Label"));
- private Message stickyMessage;
-
private static final String NON_BREAKING_SPACE = " ";
+ private LocatableLabel label;
+ private Message currentMessage;
+ private Message stickyMessage; // this message will always be shown until dismissed by user.
+ private Menu showDetailsMenu;
+
public MessageBar() {
super(LOCATOR_ID);
-
setOverflow(Overflow.VISIBLE);
- }
-
- @Override
- protected void onDraw() {
- super.onDraw();
-
setWidth100();
setAlign(Alignment.CENTER);
+ label = new LocatableLabel(extendLocatorId("Label"));
label.setAlign(Alignment.CENTER);
label.setWidth("600px");
label.setHeight("30px");
label.setCanSelectText(true);
+ addMember(label);
+
+ showDetailsMenu = new LocatableMenu(extendLocatorId("showDetailsMenu"));
+ MenuItem showDetailsMenuItem = new MenuItem(MSG.view_messageCenter_messageBarShowDetails());
+ showDetailsMenuItem.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(MenuItemClickEvent event) {
+ MessageCenterView.showDetails(MessageBar.this.currentMessage);
+ }
+ });
+ showDetailsMenu.setItems(showDetailsMenuItem);
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
setLabelEmpty();
- addMember(label);
// sometimes it's annoying to have the error message hang around for too long;
// let the user click the message so it goes away on demand
@@ -75,12 +93,22 @@ public class MessageBar extends LocatableHLayout implements MessageCenter.Messag
}
});
+ addRightMouseDownHandler(new RightMouseDownHandler() {
+ @Override
+ public void onRightMouseDown(RightMouseDownEvent event) {
+ if (MessageBar.this.currentMessage != null) {
+ showDetailsMenu.showContextMenu();
+ }
+ }
+ });
+
CoreGUI.getMessageCenter().addMessageListener(this);
}
@Override
public void onMessage(Message message) {
if (!message.isBackgroundJobResult()) {
+ this.currentMessage = message;
updateLabel(message);
// Auto-clear the message after some time unless it's been designated as sticky.
@@ -91,6 +119,7 @@ public class MessageBar extends LocatableHLayout implements MessageCenter.Messag
@Override
public void run() {
clearMessage(false);
+ // if we had a sticky message before, show it again, now that our more recent message has gone away
if (stickyMessage != null) {
updateLabel(stickyMessage);
}
@@ -101,9 +130,9 @@ public class MessageBar extends LocatableHLayout implements MessageCenter.Messag
}
public void clearMessage(boolean clearSticky) {
+ this.currentMessage = null;
setLabelEmpty();
markForRedraw();
-
if (clearSticky) {
this.stickyMessage = null;
}
@@ -123,13 +152,6 @@ public class MessageBar extends LocatableHLayout implements MessageCenter.Messag
String styleName = (contents != null) ? message.getSeverity().getStyle() : null;
label.setStyleName(styleName);
- // TODO: perhaps just set the text to green/orange/red along with the proper icon and not have the defined
- // color block...
-
- // TODO: Create some custom edge images in green, yellow, red, etc. so we can add nice rounded corners to the
- // label.
- //label.setShowEdges(true);
-
String icon = (contents != null) ? message.getSeverity().getIcon() : null;
label.setIcon(icon);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
index f9ac79c..f861a37 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
@@ -317,8 +317,18 @@ public class MessageCenterView extends Table implements MessageCenter.MessageLis
return record;
}
- private void showDetails(Message message) {
- DynamicForm form = new LocatableDynamicForm(extendLocatorId("Details"));
+ /**
+ * This is a static utility method that is package protected so the message center view
+ * and the message bar can pop up a dialog showing a message's details.
+ *
+ * @param message the message whose details are to be shown
+ */
+ static void showDetails(Message message) {
+ if (message == null) {
+ return;
+ }
+
+ DynamicForm form = new LocatableDynamicForm("MessageCenterDetailsForm");
form.setWrapItemTitles(false);
form.setAlign(Alignment.LEFT);
@@ -340,7 +350,7 @@ public class MessageCenterView extends Table implements MessageCenter.MessageLis
form.setItems(title, severity, date, detail);
- final Window dialogWin = new LocatableWindow(this.extendLocatorId("MessageWindow"));
+ final Window dialogWin = new LocatableWindow("MessageCenterDetailsWindow");
dialogWin.setTitle(MSG.common_title_message());
dialogWin.setWidth(600);
dialogWin.setHeight(400);
@@ -360,7 +370,7 @@ public class MessageCenterView extends Table implements MessageCenter.MessageLis
});
}
- private String getSeverityIcon(Message.Severity severity) {
+ private static String getSeverityIcon(Message.Severity severity) {
if (severity == null) {
severity = Severity.Blank;
}
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 678ba25..56b7270 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -2096,3 +2096,4 @@ view_messageCenter_messageTime = Time
view_messageCenter_messageSeverity = Severity
view_messageCenter_messageDetail = Detail
view_messageCenter_stackTraceFollows = --- STACK TRACE FOLLOWS ---
+view_messageCenter_messageBarShowDetails = Show Details
13 years, 3 months
[rhq] 2 commits - modules/core
by Heiko W. Rupp
modules/core/plugin-container/src/main/java/org/rhq/core/pc/StandaloneContainer.java | 36 +++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
New commits:
commit e11fec9247d8995bb668d040b119f0a657dc983a
Merge: 58043cd 308f9f8
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Mar 23 16:47:59 2011 +0100
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit 58043cdc58274c84f0b515e568afd5a2ff0550b2
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Mar 23 11:18:48 2011 +0100
Allow setting a resource-config
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/StandaloneContainer.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/StandaloneContainer.java
index b6a1d30..4e4e103 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/StandaloneContainer.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/StandaloneContainer.java
@@ -36,6 +36,7 @@ import java.util.Set;
import java.util.Stack;
import org.rhq.core.clientapi.agent.PluginContainerException;
+import org.rhq.core.clientapi.agent.configuration.ConfigurationUpdateRequest;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
@@ -50,6 +51,7 @@ import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.operation.OperationDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pc.configuration.ConfigurationManager;
import org.rhq.core.pc.inventory.InventoryManager;
import org.rhq.core.pc.inventory.ResourceContainer;
import org.rhq.core.pc.measurement.MeasurementManager;
@@ -366,6 +368,9 @@ public class StandaloneContainer {
case R_CONFIG:
showResourceConfig();
break;
+ case SR_CONFIG:
+ setResourceConfig(tokens);
+ break;
}
return false;
@@ -426,6 +431,33 @@ public class StandaloneContainer {
}
+ private void setResourceConfig(String[] tokens) {
+ if (resourceId == 0) {
+ System.err.println("No resource set");
+ return;
+ }
+
+
+ Configuration config = null;
+ if (tokens.length > 1)
+ config = createConfigurationFromString(tokens[1]);
+ else {
+ System.err.println("Need at least 1 token");
+ return;
+ }
+
+ ConfigurationUpdateRequest request = new ConfigurationUpdateRequest(1,config,resourceId);
+
+ ConfigurationManager cm = pc.getConfigurationManager();
+
+ cm.updateResourceConfiguration(request);
+
+
+
+ }
+
+
+
private ResourceType getTypeForResourceId() {
ResourceContainer rc = inventoryManager.getResourceContainer(resourceId);
Resource res = rc.getResource();
@@ -789,7 +821,9 @@ public class StandaloneContainer {
STDIN("stdin","",0, "Stop reading the batch file and wait for commands on stdin"), //
WAIT("w", "milliseconds", 1, "Waits the given amount of time"),
P_CONFIG("pc", "", 0, "Shows the plugin configuration of the current resource."),
- R_CONFIG("rc", "", 0, "Shows the resource configuration of the current resource.");
+ R_CONFIG("rc", "", 0, "Shows the resource configuration of the current resource."),
+ SR_CONFIG("src", "", 0, "[parameters] set resource config ")
+ ;
private String abbrev;
private String args;
13 years, 3 months
[rhq] Branch 'as7plugin' - 2 commits - modules/plugins
by Heiko W. Rupp
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java | 111 ++++++++--
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java | 53 ++++
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseDiscovery.java | 4
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/NameValuePair.java | 42 +++
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Operation.java | 67 +-----
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/OperationDescription.java | 80 +++++++
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Subsystem.java | 4
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 73 ++++--
8 files changed, 335 insertions(+), 99 deletions(-)
New commits:
commit f70a35bfea7d230783b3079a2d16edcf0b60adb0
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Mar 23 16:47:25 2011 +0100
Include more items and allow for reading of list properties.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
index 005421d..c136b20 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
@@ -23,17 +23,22 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
+import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper;
import org.jetbrains.annotations.Nullable;
+import org.omg.CORBA.NamedValue;
import org.rhq.modules.plugins.jbossas7.json.NameValuePair;
+import org.rhq.modules.plugins.jbossas7.json.Operation;
/**
* Provide connections to the AS and reading / writing date from/to it.
@@ -83,7 +88,7 @@ public class ASConnection {
* Return the JSON-Ojbect for a certain path.
*
* @param base Path to the object/subsystem. Can be null/"" for the base objects
- * @param ops Operation to run on the api can be null
+ * @param ops OperationDescription to run on the api can be null
* @return A JSONObject encoding the level plus sub levels provided
* @throws Exception If anything goes wrong
*/
@@ -151,21 +156,62 @@ public class ASConnection {
try {
URL url = getBaseUrl(path,"operation="+s);
- URLConnection conn = url.openConnection();
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ conn.setDoOutput(true);
+// conn.setRequestMethod("POST");
OutputStream out = conn.getOutputStream();
ObjectMapper mapper = new ObjectMapper();
- mapper.writeValue(out,nvp);
+
+ Operation operation = new Operation();
+ operation.operation=s;
+ operation.nvp=nvp;
+ operation.address=pathToAddress(path);
+
+
+ String result = mapper.writeValueAsString(operation);
+ System.out.println("Json to send: " + result);
+ mapper.writeValue(out, operation);
+
out.flush();
out.close();
+
+ InputStream inputStream;
+ if (conn.getResponseCode()==HttpURLConnection.HTTP_OK) {
+ inputStream = conn.getInputStream();
+
+ BufferedReader in = new BufferedReader(new InputStreamReader(
+ inputStream));
+ String line;
+ StringBuilder builder = new StringBuilder();
+ while ((line = in.readLine()) != null) {
+ builder.append(line);
+ }
+ System.out.println(builder.toString());
+ }
+
} catch (IOException e) {
e.printStackTrace(); // TODO: Customise this generated block
}
}
+ private List<NameValuePair> pathToAddress(String path) {
+ if (path.endsWith("/"))
+ path = path.substring(0,path.length()-1);
+ if (path.startsWith("/"))
+ path = path.substring(1);
+ List<NameValuePair> result = new ArrayList<NameValuePair>();
+ String[] components = path.split("/");
+ for (int i = 0; i < components.length ; i+=2) {
+ NameValuePair valuePair = new NameValuePair(components[i],components[i+1]);
+ result.add(valuePair);
+ }
+
+ return result;
+ }
private URL getBaseUrl(String base, String ops) throws MalformedURLException {
String spec;
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
index ca746e0..28c0592 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
@@ -24,9 +24,12 @@ import org.codehaus.jackson.JsonNode;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertyList;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionList;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.MeasurementDataNumeric;
@@ -44,6 +47,8 @@ import org.rhq.core.pluginapi.operation.OperationFacet;
import org.rhq.core.pluginapi.operation.OperationResult;
import org.rhq.modules.plugins.jbossas7.json.NameValuePair;
+import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -144,14 +149,26 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet, Confi
public Configuration loadResourceConfiguration() throws Exception {
ConfigurationDefinition configDef = context.getResourceType().getResourceConfigurationDefinition();
- JsonNode json = connection.getLevelData(path,false,false);
+ JsonNode json = connection.getLevelData(key,false,false); // TODO path ? key?
Configuration ret = new Configuration();
for (PropertyDefinition propDef: configDef.getNonGroupedProperties()) {
JsonNode sub = json.findValue(propDef.getName());
- PropertySimple propertySimple = new PropertySimple(propDef.getName(),sub.getValueAsText());
- ret.put(propertySimple);
+ if (propDef instanceof PropertyDefinitionSimple) {
+ PropertySimple propertySimple = new PropertySimple(propDef.getName(),sub.getValueAsText());
+ ret.put(propertySimple);
+ } else if (propDef instanceof PropertyDefinitionList) {
+ PropertyList propertyList = new PropertyList(propDef.getName());
+ Iterator<JsonNode> values = sub.getElements();
+ while (values.hasNext()) {
+ JsonNode node = values.next();
+ String value = node.getTextValue();
+ PropertySimple propertySimple = new PropertySimple(propDef.getName(),value);
+ propertyList.add(propertySimple);
+ }
+ ret.put(propertyList);
+ }
}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseDiscovery.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseDiscovery.java
index 83d0e3e..571dbab 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseDiscovery.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseDiscovery.java
@@ -61,7 +61,11 @@ public class BaseDiscovery implements ResourceDiscoveryComponent
serverNameFull = "ASManager";
} else {
serverNameFull = getBaseDirFromCommandLine(commandLine);
+ if (serverNameFull==null || serverNameFull.isEmpty())
+ serverNameFull="JBossAS7";
serverName = serverNameFull.substring(serverNameFull.lastIndexOf("/")+1);
+ if (serverName.isEmpty())
+ serverName = serverNameFull;
// DomainClient client = DomainClient.Factory.create(InetAddress.getByName("localhost"),9990); //
// Map<ServerIdentity,ServerStatus> serverStatuses = client.getServerStatuses();
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/NameValuePair.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/NameValuePair.java
index 9c8ca19..ff3f10c 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/NameValuePair.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/NameValuePair.java
@@ -18,6 +18,8 @@
*/
package org.rhq.modules.plugins.jbossas7.json;
+import org.codehaus.jackson.annotate.JsonValue;
+
/**
*
* @author Heiko W. Rupp
@@ -31,4 +33,10 @@ public class NameValuePair {
this.name = name;
this.value = value;
}
+
+ @JsonValue
+ @Override
+ public String toString() {
+ return name +":"+ value ;
+ }
}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Operation.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Operation.java
index f00c421..4f5cda1 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Operation.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Operation.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
+ * Copyright (C) 2005-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -18,63 +18,30 @@
*/
package org.rhq.modules.plugins.jbossas7.json;
-import java.util.Map;
+import java.util.List;
-import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.annotate.JsonValue;
/**
- * // TODO: Document this
+ * Operation to run on the server
* @author Heiko W. Rupp
*/
public class Operation {
- @JsonProperty("operation-name")
- public String operationName;
- public String description;
- @JsonProperty("request-properties")
- public Map<String,As7RequestProperty> requestProperties;
-// @JsonProperty("reply-properties")
-// public ArrayList<As7ReplyProperty> replyProperties;
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder();
- sb.append("Operation");
- sb.append("{operationName='").append(operationName).append('\'');
- sb.append(", description='").append(description).append('\'');
- sb.append(", requestProperties=").append(requestProperties);
-// sb.append(", replyProperties=").append(replyProperties);
- sb.append('}');
- return sb.toString();
- }
+ public String operation;
+ public List<NameValuePair> address;
- public static class As7RequestProperty {
- public String description;
- public boolean required;
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder();
- sb.append("As7RequestProperty");
- sb.append("{description='").append(description).append('\'');
- sb.append(", required=").append(required);
- sb.append('}');
- return sb.toString();
- }
- }
+ public NameValuePair nvp;
- public static class As7ReplyProperty {
- @JsonProperty("value-type")
- public String valueType;
- public String description;
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder();
- sb.append("As7ReplyProperty");
- sb.append("{valueType='").append(valueType).append('\'');
- sb.append(", description='").append(description).append('\'');
- sb.append('}');
- return sb.toString();
- }
+ @JsonValue
+ public String toString() {
+ StringBuilder b = new StringBuilder();
+ b.append("{");
+ b.append("operation:").append(operation).append(",\n");
+ b.append("address:").append(address).append(",\n");
+ b.append(nvp);
+ b.append("}");
+ return b.toString();
}
}
+
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/OperationDescription.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/OperationDescription.java
new file mode 100644
index 0000000..18b3a40
--- /dev/null
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/OperationDescription.java
@@ -0,0 +1,80 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * 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 version 2 of the License.
+ *
+ * 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.rhq.modules.plugins.jbossas7.json;
+
+import java.util.Map;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * // TODO: Document this
+ * @author Heiko W. Rupp
+ */
+public class OperationDescription {
+ @JsonProperty("operation-name")
+ public String operationName;
+ public String description;
+ @JsonProperty("request-properties")
+ public Map<String,As7RequestProperty> requestProperties;
+// @JsonProperty("reply-properties")
+// public ArrayList<As7ReplyProperty> replyProperties;
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("OperationDescription");
+ sb.append("{operationName='").append(operationName).append('\'');
+ sb.append(", description='").append(description).append('\'');
+ sb.append(", requestProperties=").append(requestProperties);
+// sb.append(", replyProperties=").append(replyProperties);
+ sb.append('}');
+ return sb.toString();
+ }
+
+ public static class As7RequestProperty {
+ public String description;
+ public boolean required;
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("As7RequestProperty");
+ sb.append("{description='").append(description).append('\'');
+ sb.append(", required=").append(required);
+ sb.append('}');
+ return sb.toString();
+ }
+ }
+
+ public static class As7ReplyProperty {
+ @JsonProperty("value-type")
+ public String valueType;
+ public String description;
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("As7ReplyProperty");
+ sb.append("{valueType='").append(valueType).append('\'');
+ sb.append(", description='").append(description).append('\'');
+ sb.append('}');
+ return sb.toString();
+ }
+ }
+}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Subsystem.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Subsystem.java
index 89b41a0..7774cd3 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Subsystem.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Subsystem.java
@@ -37,7 +37,7 @@ public class Subsystem {
@JsonProperty("attributes") Map <String,Attribute> attributes;
@JsonProperty("model-description")
Subsystem modelDescription;
- @JsonProperty("operations") Map<String,Operation> operations = new HashMap<String, Operation>();
+ @JsonProperty("operations") Map<String,OperationDescription> operations = new HashMap<String, OperationDescription>();
public Map<String,Subsystem> children;
@@ -57,7 +57,7 @@ public class Subsystem {
sb.append(", model-description=").append(modelDescription).append('\n');
sb.append("\n, operations=");
if (operations!=null) {
- for (Map.Entry<String,Operation> ops : operations.entrySet())
+ for (Map.Entry<String,OperationDescription> ops : operations.entrySet())
sb.append(" ").append(ops).append('\n');
}
sb.append(", children=").append(children).append('\n');
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index 81da4b6..9a04f04 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -169,6 +169,7 @@
<c:simple-property name="path" readOnly="true" default="/subsystem/web/connector/*"/>
</plugin-configuration>
+
<metric property="bytesSent" measurementType="trendsup"/>
<metric property="bytesReceived" measurementType="trendsup"/>
<metric property="processingTime" measurementType="trendsup"/>
@@ -176,6 +177,12 @@
<metric property="maxTime" />
<metric property="requestCount" measurementType="trendsup"/>
+ <resource-configuration>
+ <c:simple-property name="protocol" required="false" description="The web connector protocol."/>
+ <c:simple-property name="socket-binding" required="false" description="The web connector socket-binding reference, this connector should be bound to."/>
+ <c:simple-property name="scheme" required="false" description="The web connector scheme"/>
+ </resource-configuration>
+
</service>
<service name="VHost"
@@ -185,6 +192,11 @@
<c:simple-property name="path" readOnly="true" default="/subsystem/web/virtual-server/*"/>
</plugin-configuration>
+ <resource-configuration>
+ <c:simple-property name="access-log"/>
+ <c:list-property name="alias" description="The virtual server aliases"/>
+ <c:simple-property name="rewrite"/>
+ </resource-configuration>
</service>
@@ -209,8 +221,8 @@
</plugin-configuration>
<resource-configuration>
- <c:simple-property name="default-interface" readOnly="true" displayName="Default Interface" description="Default Interface for these bindings. See NetworkInterfaces for its definition"/>
- <c:simple-property name="port-offset" readOnly="true" displayName="Port Offset" description="Offset from standard ports for this group"/>
+ <c:simple-property name="default-interface" readOnly="true" displayName="Default Interface" description="Default Interface for these bindings. See NetworkInterfaces for its definition" required="false"/>
+ <c:simple-property name="port-offset" readOnly="true" displayName="Port Offset" description="Offset from standard ports for this group" required="false"/>
</resource-configuration>
<service name="SocketBinding"
commit 3914a1c51bcb6f24e70ff2243664778b79b04873
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Mar 23 10:41:56 2011 +0100
Add support for reading of resource-config
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
index 6b64b7b..005421d 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
@@ -22,6 +22,7 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
@@ -32,6 +33,8 @@ import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper;
import org.jetbrains.annotations.Nullable;
+import org.rhq.modules.plugins.jbossas7.json.NameValuePair;
+
/**
* Provide connections to the AS and reading / writing date from/to it.
* @author Heiko W. Rupp
@@ -88,23 +91,7 @@ public class ASConnection {
URL url2;
String spec;
- if (base!=null && !base.isEmpty()) {
- if (!base.startsWith("/")) {
- spec = urlString + "/" + base;
- }
- else {
- spec = urlString + base;
- }
- if (ops!=null) {
- if (!ops.startsWith("?"))
- ops = "?" + ops;
- spec += ops;
- }
-
- url2 = new URL(spec);
- }
- else
- url2 = url;
+ url2 = getBaseUrl(base, ops);
JsonNode tree = null;
@@ -160,5 +147,47 @@ public class ASConnection {
return false;
}
+ public void execute(String path, String s, NameValuePair nvp) {
+
+ try {
+ URL url = getBaseUrl(path,"operation="+s);
+ URLConnection conn = url.openConnection();
+ OutputStream out = conn.getOutputStream();
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.writeValue(out,nvp);
+ out.flush();
+ out.close();
+ } catch (IOException e) {
+ e.printStackTrace(); // TODO: Customise this generated block
+ }
+
+ }
+
+
+
+
+ private URL getBaseUrl(String base, String ops) throws MalformedURLException {
+ String spec;
+ URL url2;
+ if (base!=null && !base.isEmpty()) {
+ if (!base.startsWith("/")) {
+ spec = urlString + "/" + base;
+ }
+ else {
+ spec = urlString + base;
+ }
+ if (ops!=null) {
+ if (!ops.startsWith("?"))
+ ops = "?" + ops;
+ spec += ops;
+ }
+
+ url2 = new URL(spec);
+ }
+ else
+ url2 = url;
+ return url2;
+ }
}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
index 2f293d9..ca746e0 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
@@ -23,12 +23,18 @@ import org.apache.commons.logging.LogFactory;
import org.codehaus.jackson.JsonNode;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinition;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.MeasurementDataNumeric;
import org.rhq.core.domain.measurement.MeasurementDataTrait;
import org.rhq.core.domain.measurement.MeasurementReport;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.inventory.ResourceContext;
@@ -36,10 +42,12 @@ import org.rhq.core.pluginapi.measurement.MeasurementFacet;
import org.rhq.core.pluginapi.operation.OperationContext;
import org.rhq.core.pluginapi.operation.OperationFacet;
import org.rhq.core.pluginapi.operation.OperationResult;
+import org.rhq.modules.plugins.jbossas7.json.NameValuePair;
+import java.util.Map;
import java.util.Set;
-public class BaseComponent implements ResourceComponent, MeasurementFacet
+public class BaseComponent implements ResourceComponent, MeasurementFacet, ConfigurationFacet
{
private final Log log = LogFactory.getLog(this.getClass());
@@ -134,7 +142,33 @@ public class BaseComponent implements ResourceComponent, MeasurementFacet
protected String getPath() { return path; }
+ public Configuration loadResourceConfiguration() throws Exception {
+ ConfigurationDefinition configDef = context.getResourceType().getResourceConfigurationDefinition();
+ JsonNode json = connection.getLevelData(path,false,false);
+ Configuration ret = new Configuration();
+
+ for (PropertyDefinition propDef: configDef.getNonGroupedProperties()) {
+ JsonNode sub = json.findValue(propDef.getName());
+ PropertySimple propertySimple = new PropertySimple(propDef.getName(),sub.getValueAsText());
+ ret.put(propertySimple);
+ }
+
+
+ return ret;
+ }
+
+ public void updateResourceConfiguration(ConfigurationUpdateReport report) {
+ Configuration conf = report.getConfiguration();
+ for (Map.Entry<String, PropertySimple> entry : conf.getSimpleProperties().entrySet()) {
+
+ NameValuePair nvp = new NameValuePair(entry.getKey(),entry.getValue().getStringValue());
+ connection.execute(path,"write-attribute",nvp);
+ }
+
+
+ // TODO: Customise this generated block
+ }
}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/NameValuePair.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/NameValuePair.java
new file mode 100644
index 0000000..9c8ca19
--- /dev/null
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/NameValuePair.java
@@ -0,0 +1,34 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * 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 version 2 of the License.
+ *
+ * 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.rhq.modules.plugins.jbossas7.json;
+
+/**
+ *
+ * @author Heiko W. Rupp
+ */
+public class NameValuePair {
+
+ public String name;
+ public String value;
+
+ public NameValuePair(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+}
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index 98a97d8..81da4b6 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -93,7 +93,7 @@
</server>
- <server name="JBossAS7 (Standalone)"
+ <server name="JBossAS7-Standalone"
discovery="BaseDiscovery"
class="BaseComponent"
>
@@ -127,29 +127,29 @@
/>
-->
- <server name="Messaging"
+ <server name="Messaging"
discovery="SubsystemDiscovery"
class="BaseComponent">
<plugin-configuration>
<c:simple-property name="path" readOnly="true" default="/subsystem/messaging"/>
</plugin-configuration>
- <resource-configuration>
- <c:simple-property name="journal-min-files" />
- <c:simple-property name="journal-type" />
- </resource-configuration>
+ <resource-configuration>
+ <c:simple-property name="journal-min-files" />
+ <c:simple-property name="journal-type" />
+ </resource-configuration>
- <service name="Acceptor"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- >
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="/subsystem/messaging/acceptor"/>
- </plugin-configuration>
+ <service name="Acceptor"
+ discovery="SubsystemDiscovery"
+ class="BaseComponent"
+ >
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true" default="/subsystem/messaging/acceptor"/>
+ </plugin-configuration>
- </service>
+ </service>
</server>
@@ -164,7 +164,7 @@
<service name="Connector"
discovery="SubsystemDiscovery"
class="BaseComponent"
- >
+ >
<plugin-configuration>
<c:simple-property name="path" readOnly="true" default="/subsystem/web/connector/*"/>
</plugin-configuration>
@@ -176,11 +176,11 @@
<metric property="maxTime" />
<metric property="requestCount" measurementType="trendsup"/>
- </service>
+ </service>
<service name="VHost"
- discovery="SubsystemDiscovery"
- class="BaseComponent">
+ discovery="SubsystemDiscovery"
+ class="BaseComponent">
<plugin-configuration>
<c:simple-property name="path" readOnly="true" default="/subsystem/web/virtual-server/*"/>
</plugin-configuration>
@@ -196,32 +196,37 @@
class="BaseComponent"
description="A named network interface, along with required criteria for determining the IP address to associate with that interface">
<plugin-configuration>
- <c:simple-property name="path" readOnly="true" default="/"/>
+ <c:simple-property name="path" readOnly="true" default="/"/>
</plugin-configuration>
</service>
<service name="SocketBindingGroup"
discovery="SocketBindingGroupDiscovery"
class="BaseComponent"
- >
+ >
<plugin-configuration>
<c:simple-property name="path" readOnly="true" default="/socket-binding-group/"/>
</plugin-configuration>
+ <resource-configuration>
+ <c:simple-property name="default-interface" readOnly="true" displayName="Default Interface" description="Default Interface for these bindings. See NetworkInterfaces for its definition"/>
+ <c:simple-property name="port-offset" readOnly="true" displayName="Port Offset" description="Offset from standard ports for this group"/>
+ </resource-configuration>
+
<service name="SocketBinding"
discovery="SocketBindingDiscovery"
class="BaseComponent">
<plugin-configuration>
- <c:simple-property name="path" readOnly="true"/>
+ <c:simple-property name="path" readOnly="true"/>
</plugin-configuration>
- </service>
- </service>
+ </service>
+ </service>
</server>
- <server name="JBossAS (Managed)"
+ <server name="JBossAS-Managed"
discovery="BaseDiscovery"
class="BaseComponent"
>
@@ -238,9 +243,9 @@
<metric property="serverGroup" dataType="trait" displayType="summary" />
<resource-configuration>
<!--<c:group name="interfaces">-->
- <c:simple-property name="loopback" default="127.0.0.1" />
- <c:simple-property name="external" default="any" />
- <c:simple-property name="public" default="any" />
+ <c:simple-property name="loopback" default="127.0.0.1" />
+ <c:simple-property name="external" default="any" />
+ <c:simple-property name="public" default="any" />
<!--</c:group>-->
</resource-configuration>
@@ -251,7 +256,7 @@
discovery="org.rhq.plugins.jmx.LocalJMXServerDiscoveryComponent"
class="org.rhq.plugins.jmx.JMXServerComponent"
singleton="true"
- />
+ />
</server>
13 years, 3 months
[rhq] 3 commits - modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java | 27 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/AutoRefreshPortlet.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/AutoRefreshPortletUtil.java | 72 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupAlertsPortlet.java | 34 ----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupAlertsPortlet3.java | 38 +----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupBundleDeploymentsPortlet.java | 33 +---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupEventsPortlet.java | 32 ----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java | 34 +---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOobsPortlet.java | 34 ----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java | 32 +---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupPkgHistoryPortlet.java | 34 ----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java | 33 ----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java | 33 +---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java | 34 ----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedResourcesPortlet.java | 33 ----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java | 33 ----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java | 32 ----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryPortlet.java | 32 ----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java | 69 +++++++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 3
20 files changed, 269 insertions(+), 409 deletions(-)
New commits:
commit 308f9f8d0ea4e019c3439d79e259a20f8ee39162
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 23 10:09:24 2011 -0400
trivial: add import lost in merge
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
index 7c748fa..898c04b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
@@ -66,6 +66,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGro
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
import org.rhq.enterprise.gui.coregui.client.util.BrowserUtility;
+import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableCanvas;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
commit b649b2f2f9853879ec2494df9510b04cbaac0dd7
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 23 10:09:06 2011 -0400
More Tabbing Fun
There are multiple ways that during one rendering of tabs
we can get a request for another. We need to shut down user and smartgwt
initiated tab selection events until we're ready (until we've finished the
previous rendering). Hopefully this finally gets it right. I added some more
comments in this for the next unlucky soul (well, probably me...).
I think I also may have gotten rid of some unwanted, duplicate rendering.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
index 7413dae..6329f67 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
@@ -38,6 +38,8 @@ public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, T
/** maps Tab locator IDs to Tabs. */
private Map<String, TwoLevelTab> hiddenTabs = new LinkedHashMap<String, TwoLevelTab>();
+ private boolean ignoreSelectEvents = false;
+
public TwoLevelTabSet(String locatorId) {
super(locatorId);
}
@@ -109,7 +111,15 @@ public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, T
return m.addHandler(TwoLevelTabSelectedEvent.TYPE, handler);
}
+ // This is invoked by smartgwt when the user clicks on a Tab in the TabSet, or TabSet.selectTab() is called. It
+ // sets the current SubTab and fires an event to notify AbstractTwoLevelTabSet that a tab/subtab has been selected.
public void onTabSelected(TabSelectedEvent tabSelectedEvent) {
+ // if requested, ignore select tab notifications. smartgwt can generate unwanted notifications
+ // while we manipulate the tabset (e.g. when hiding the current tab). We want to manage this at a higher level
+ if (isIgnoreSelectEvents()) {
+ return;
+ }
+
TwoLevelTab tab = (TwoLevelTab) getSelectedTab();
SubTab currentSubTab = tab.getLayout().getCurrentSubTab();
if (null != currentSubTab) {
@@ -119,7 +129,15 @@ public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, T
}
}
+ // This is invoked by an event fired in SubTabLayout when the user clicks a SubTab button. It sets the Tab
+ // and fires an event to notify AbstractTwoLevelTabSet that a tab/subtab has been selected.
public void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent) {
+ // if requested, ignore select tab notifications. smartgwt can generate unwanted notifications
+ // while we manipulate the tabset (e.g. when hiding the current tab). We want to manage this at a higher level
+ if (isIgnoreSelectEvents()) {
+ return;
+ }
+
tabSelectedEvent.setTabNum(getSelectedTabNumber());
Tab tab = getSelectedTab();
tabSelectedEvent.setId(this.getTabByTitle(tab.getTitle()).getName());
@@ -156,6 +174,14 @@ public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, T
}
}
+ public boolean isIgnoreSelectEvents() {
+ return ignoreSelectEvents;
+ }
+
+ public void setIgnoreSelectEvents(boolean ignoreSelectEvents) {
+ this.ignoreSelectEvents = ignoreSelectEvents;
+ }
+
@Override
public void destroy() {
// add the hidden tabs back under the TabSet. This will get them destroyed by smartgwt when the tabset
@@ -168,4 +194,5 @@ public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, T
}
super.destroy();
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
index e303c50..04d6410 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
@@ -133,18 +133,21 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
}
}
+ // This is invoked by events fired in TwoLevelTabSet whenever a tab/subtab combo has been selected.
public void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent) {
- // We want to finish the tab selection process, which may involve async loading of content,
- // before allowing more tab selection. This avoids potential tab "looping" that happens when a new
- // tab is selected before the previous one could finish loading. So, disable the tab set here, and
- // re-enable it later when the tab content is actuall rendered (see selectTab).
+ // Establishing the proper tabbed view may involve tab add/remove and async loading of content. While doing this
+ // we want to prevent user initiation of another tab change. To block users from clicking tabs we
+ // disable the tab set. We re-enable the tabset when safe. (see this method and also selectTab()).
if (getSelectedItemId() == null) {
this.tabSet.disable();
CoreGUI.goToView(History.getToken());
+
} else {
- String tabPath = "/" + tabSelectedEvent.getId() + "/" + tabSelectedEvent.getSubTabId();
+ String tabId = tabSelectedEvent.getId();
+ String subTabId = tabSelectedEvent.getSubTabId();
+ String tabPath = "/" + tabId + "/" + subTabId;
String path = this.baseViewPath + "/" + getSelectedItemId() + tabPath;
// If the selected tab or subtab is not already the current history item, the user clicked on the tab, rather
@@ -153,11 +156,16 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
if (!(History.getToken().equals(path) || History.getToken().startsWith(path + "/"))) {
this.tabSet.disable();
CoreGUI.goToView(path);
+
+ } else {
+ // ensure the tabset is enabled if we're not going to be doing any further tab selection
+ this.tabSet.enable();
}
}
}
public void renderView(final ViewPath viewPath) {
+
new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
@Override
public void onPermissionsLoaded(Set<Permission> permissions) {
@@ -168,6 +176,7 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
}
private void renderTabs(final ViewPath viewPath) {
+
// e.g. #Resource/10010/Summary/Overview
// ^ current path
final int id = Integer.parseInt(viewPath.getCurrent().getPath());
@@ -191,10 +200,19 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
}
if (getSelectedItemId() == null || getSelectedItemId() != id) {
- loadSelectedItem(id, viewPath);
+ // A different entity (resource or group), load it and try to navigate to the same tabs if possible.
+ // Changing entities may change the available tabs as the same tab set may not be supported by the
+ // new entity's type. To maintain a valid tab selection for the TabSet, smartgwt will generate an
+ // events if the current tab is removed (which can happen say, when navigating from a resource of type A
+ // to a resource of type B). We need to ignore tab selection events generated by smartgwt because we
+ // handle this at a higher level. To do this we explicitly set events to be be ignored. We re-enable
+ // the event handling when safe. (see selectTab()).
+ this.tabSet.setIgnoreSelectEvents(true);
+ this.loadSelectedItem(id, viewPath);
+
} else {
// Same Resource - just switch tabs.
- selectTab(this.tabName, this.subTabName, viewPath);
+ this.selectTab(this.tabName, this.subTabName, viewPath);
}
}
@@ -210,23 +228,36 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
TwoLevelTab tab = (tabName != null) ? this.tabSet.getTabByName(tabName) : null;
SubTab subtab = null;
+ // if the requested tab is not available for the tabset then select the defaults (firing a new event)
if (tab == null || tab.getDisabled()) {
+ this.tabSet.setIgnoreSelectEvents(false);
subtab = selectDefaultTabAndSubTab();
- } else {
- // Do *not* select the tab and trigger the tab selected event until the subtab has been selected first.
- subtab = (subtabName != null) ? tab.getSubTabByName(subtabName) : tab.getDefaultSubTab();
- if (subtab == null || tab.getLayout().isSubTabDisabled(subtab)) {
- // due to our attempt to perform sticky tabbing we may request an invalid subtab when
- // switching resources. Just silently go to the default tab/subtab.
- subtab = tab.getLayout().getDefaultSubTab();
- }
- tab.getLayout().selectSubTab(subtab);
-
- // Now that the subtab has been selected, select the tab (this will cause a tab selected event to fire).
+ return;
+ }
+
+ // the tab is available, now get the subtab
+ subtab = (subtabName != null) ? tab.getSubTabByName(subtabName) : tab.getDefaultSubTab();
+
+ // due to our attempt to perform sticky tabbing we may request an invalid subtab when
+ // switching resources. If the requested subtab is not available the select the default subtab for the tab
+ if (subtab == null || tab.getLayout().isSubTabDisabled(subtab)) {
+ subtab = tab.getLayout().getDefaultSubTab();
+ }
+
+ // select the subTab (this does not fire an event, just sets the subtab)
+ tab.getLayout().selectSubTab(subtab);
+
+ // now that the tab/subtab is determined, if currently selected tab is not the desired tab, then
+ // select it now (firing a new event).
+ if (!tab.equals(this.tabSet.getSelectedTab())) {
+ this.tabSet.setIgnoreSelectEvents(false);
this.tabSet.selectTab(tab);
+ return;
}
+ // if the desired tab/subtab are already selected, now we can render the subtab canvas
Canvas subView = subtab.getCanvas();
+
if (subView instanceof BookmarkableView) {
// Handle any remaining view items (e.g. id of a selected item in a subtab that contains a Master-Details view).
((BookmarkableView) subView).renderView(viewPath);
@@ -237,8 +268,10 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
}
// ensure the tabset is enabled (disabled in onTabSelected), and redraw
+ this.tabSet.setIgnoreSelectEvents(false);
this.tabSet.enable();
this.tabSet.markForRedraw();
+
} catch (Exception e) {
this.tabSet.enable();
Log.info("Failed to select tab " + tabName + "/" + subtabName + ": " + e);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 38e09eb..91f617d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -85,7 +85,6 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
public static class Tab {
public static final String OPERATIONS = "Operations";
public static final String CONFIGURATION = "Configuration";
- // TODO: other tabs
}
public static class OperationsSubTab {
@@ -142,6 +141,8 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
public ResourceDetailView(String locatorId) {
super(locatorId, BASE_VIEW_PATH);
+
+ // hide until we have our tabs in place
this.hide();
}
commit 48ec8e2feb895608ba589bfd36406f939a5f5e47
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 22 17:33:26 2011 -0400
Resource/Group dash AutoRefreshPortlets were continuing to refresh even
when the Summary/Activity subtab was not being viewed. This generates a lot
of background work and db round trips. The reason is that we don't
destroy a subtab's canvas if the user stays within the same entity detail
view (on the assumption that the user may well revisit the same subtab).
Now, skip the refresh request if the subtab canvas is not visible.
- consolidate some autoresreshportlet logic into a util class
- add isRefreshing() to interface, and also skip the refresh request if the
portlet is still refreshing from a previous request (not every ARP currently
has this implemented)
- get rid of some warnings/unused code
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/AutoRefreshPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/AutoRefreshPortlet.java
index 9b23871..897c1b4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/AutoRefreshPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/AutoRefreshPortlet.java
@@ -32,4 +32,10 @@ public interface AutoRefreshPortlet extends Portlet {
* should be canceled when the portlet goes out of scope (typically in an onDestroy() override).
*/
void startRefreshCycle();
+
+ /**
+ * @return true if the portlet is currently responding to a refresh (i.e. reloading data). This can be used
+ * to ignore refresh requests until a prior request is completed.
+ */
+ boolean isRefreshing();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/AutoRefreshPortletUtil.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/AutoRefreshPortletUtil.java
new file mode 100644
index 0000000..4977de6
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/AutoRefreshPortletUtil.java
@@ -0,0 +1,72 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * 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 version 2 of the License.
+ *
+ * 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.rhq.enterprise.gui.coregui.client.dashboard;
+
+import com.google.gwt.user.client.Timer;
+import com.smartgwt.client.widgets.Canvas;
+
+import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
+import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
+
+/**
+ * @author Jay Shaughnessy
+ */
+public class AutoRefreshPortletUtil {
+
+ public static Timer startRefreshCycle(final AutoRefreshPortlet portlet, final Canvas autoRefreshPortletCanvas,
+ Timer refreshTimer) {
+
+ final int refreshInterval = UserSessionManager.getUserPreferences().getPageRefreshInterval();
+
+ //cancel any existing timer
+ if (null != refreshTimer) {
+ refreshTimer.cancel();
+ }
+
+ if (refreshInterval >= MeasurementUtility.MINUTES) {
+
+ refreshTimer = new Timer() {
+ public void run() {
+
+ // if the portlet is already refreshing or if the portlet is not currently on screen then
+ // don't bother doing the work. this protects against unnecessary or unwanted db queries
+ // being performed in the background.
+ if (!portlet.isRefreshing() && autoRefreshPortletCanvas.isVisible()) {
+ autoRefreshPortletCanvas.redraw();
+ }
+ }
+ };
+
+ refreshTimer.scheduleRepeating(refreshInterval);
+ }
+
+ return refreshTimer;
+ }
+
+ public static void onDestroy(final Canvas portlet, Timer refreshTimer) {
+
+ if (refreshTimer != null) {
+
+ refreshTimer.cancel();
+ }
+
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupAlertsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupAlertsPortlet.java
index cc14736..740d549 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupAlertsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupAlertsPortlet.java
@@ -43,12 +43,11 @@ import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
-import org.rhq.enterprise.gui.coregui.client.Messages;
-import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.alert.AlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.alert.AlertPortletConfigurationDataSource;
import org.rhq.enterprise.gui.coregui.client.components.measurement.CustomConfigMeasurementRangeEditor;
import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortletUtil;
import org.rhq.enterprise.gui.coregui.client.dashboard.CustomSettingsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
@@ -56,7 +55,6 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.PortletConfigurationEditorComponent;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.alerts.PortletAlertSelector;
import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.summary.AbstractActivityView;
-import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
@@ -216,7 +214,6 @@ public class GroupAlertsPortlet extends AlertHistoryView implements CustomSettin
@Override
public void onSubmitValues(SubmitValuesEvent event) {
- String selectedValue;
//alert severity
portletConfig = AbstractActivityView.saveAlertPrioritySettings(alertPrioritySelector, portletConfig);
@@ -260,37 +257,21 @@ public class GroupAlertsPortlet extends AlertHistoryView implements CustomSettin
}
}
- @Override
public void startRefreshCycle() {
- //current setting
- final int refreshInterval = UserSessionManager.getUserPreferences().getPageRefreshInterval();
-
- //cancel any existing timer
- if (refreshTimer != null) {
- refreshTimer.cancel();
- }
-
- if (refreshInterval >= MeasurementUtility.MINUTES) {
-
- refreshTimer = new Timer() {
- public void run() {
- redraw();
- }
- };
-
- refreshTimer.scheduleRepeating(refreshInterval);
- }
+ refreshTimer = AutoRefreshPortletUtil.startRefreshCycle(this, this, refreshTimer);
}
@Override
protected void onDestroy() {
- if (refreshTimer != null) {
- refreshTimer.cancel();
- }
+ AutoRefreshPortletUtil.onDestroy(this, refreshTimer);
super.onDestroy();
}
+ public boolean isRefreshing() {
+ return false;
+ }
+
@Override
protected void setupTableInteractions(boolean hasWriteAccess) {
// The portlet is a "subsystem" view. Meaning the alerts displayed can be from any accessible group for
@@ -363,7 +344,6 @@ final class AlertResourceSelectorRegion extends LocatableVLayout {
this.currentlyAssignedIds = assigned;
}
- private static final Messages MSG = CoreGUI.getMessages();
private PortletAlertSelector selector = null;
private Integer[] currentlyAssignedIds;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupAlertsPortlet3.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupAlertsPortlet3.java
index 7c166ad..2a2b3ac 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupAlertsPortlet3.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupAlertsPortlet3.java
@@ -46,9 +46,9 @@ import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
-import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.components.measurement.CustomConfigMeasurementRangeEditor;
import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortletUtil;
import org.rhq.enterprise.gui.coregui.client.dashboard.CustomSettingsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
@@ -60,7 +60,6 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.summary.AbstractActivityView;
import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
import org.rhq.enterprise.gui.coregui.client.util.GwtRelativeDurationConverter;
-import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableCanvas;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -207,10 +206,10 @@ public class GroupAlertsPortlet3 extends LocatableVLayout implements CustomSetti
if (property != null) {
String currentSetting = property.getStringValue();
if (currentSetting.trim().isEmpty() || currentSetting.equalsIgnoreCase("5")) {
- PageControl pageControl = new PageControl(0, 5);
+ //PageControl pageControl = new PageControl(0, 5);
pc.setPageSize(5);
} else {
- PageControl pageControl = new PageControl(0, Integer.valueOf(currentSetting));
+ //PageControl pageControl = new PageControl(0, Integer.valueOf(currentSetting));
pc.setPageSize(Integer.valueOf(currentSetting));
}
}
@@ -356,40 +355,21 @@ public class GroupAlertsPortlet3 extends LocatableVLayout implements CustomSetti
return customSettings;
}
- @Override
public void startRefreshCycle() {
- //current setting
- final int refreshInterval = UserSessionManager.getUserPreferences().getPageRefreshInterval();
-
- //cancel any existing timer
- if (refreshTimer != null) {
- refreshTimer.cancel();
- }
-
- if (refreshInterval >= MeasurementUtility.MINUTES) {
-
- refreshTimer = new Timer() {
- public void run() {
- if (!currentlyLoading) {
- loadData();
- redraw();
- }
- }
- };
-
- refreshTimer.scheduleRepeating(refreshInterval);
- }
+ refreshTimer = AutoRefreshPortletUtil.startRefreshCycle(this, this, refreshTimer);
}
@Override
protected void onDestroy() {
- if (refreshTimer != null) {
+ AutoRefreshPortletUtil.onDestroy(this, refreshTimer);
- refreshTimer.cancel();
- }
super.onDestroy();
}
+ public boolean isRefreshing() {
+ return this.currentlyLoading;
+ }
+
@Override
public void redraw() {
super.redraw();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupBundleDeploymentsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupBundleDeploymentsPortlet.java
index 2c4fdc1..4d163ab 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupBundleDeploymentsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupBundleDeploymentsPortlet.java
@@ -43,8 +43,8 @@ import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
-import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortletUtil;
import org.rhq.enterprise.gui.coregui.client.dashboard.CustomSettingsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
@@ -55,7 +55,6 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.summary.AbstractActivityView;
import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
import org.rhq.enterprise.gui.coregui.client.util.GwtRelativeDurationConverter;
-import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableCanvas;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -263,37 +262,21 @@ public class GroupBundleDeploymentsPortlet extends LocatableVLayout implements C
});
}
- @Override
public void startRefreshCycle() {
- //current setting
- final int refreshInterval = UserSessionManager.getUserPreferences().getPageRefreshInterval();
-
- //cancel any existing timer
- if (refreshTimer != null) {
- refreshTimer.cancel();
- }
-
- if (refreshInterval >= MeasurementUtility.MINUTES) {
- refreshTimer = new Timer() {
- public void run() {
- if (!currentlyLoading) {
- loadData();
- redraw();
- }
- }
- };
- refreshTimer.scheduleRepeating(refreshInterval);
- }
+ refreshTimer = AutoRefreshPortletUtil.startRefreshCycle(this, this, refreshTimer);
}
@Override
protected void onDestroy() {
- if (refreshTimer != null) {
- refreshTimer.cancel();
- }
+ AutoRefreshPortletUtil.onDestroy(this, refreshTimer);
+
super.onDestroy();
}
+ public boolean isRefreshing() {
+ return this.currentlyLoading;
+ }
+
@Override
public void redraw() {
super.redraw();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupEventsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupEventsPortlet.java
index ec4dae7..3b069c5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupEventsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupEventsPortlet.java
@@ -39,9 +39,9 @@ import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.core.domain.event.EventSeverity;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
-import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.components.measurement.CustomConfigMeasurementRangeEditor;
import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortletUtil;
import org.rhq.enterprise.gui.coregui.client.dashboard.CustomSettingsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
@@ -292,39 +292,21 @@ public class GroupEventsPortlet extends LocatableVLayout implements CustomSettin
});
}
- @Override
public void startRefreshCycle() {
- //current setting
- final int refreshInterval = UserSessionManager.getUserPreferences().getPageRefreshInterval();
-
- //cancel any existing timer
- if (refreshTimer != null) {
- refreshTimer.cancel();
- }
-
- if (refreshInterval >= MeasurementUtility.MINUTES) {
-
- refreshTimer = new Timer() {
- public void run() {
- if (!currentlyLoading) {
- redraw();
- }
- }
- };
-
- refreshTimer.scheduleRepeating(refreshInterval);
- }
+ refreshTimer = AutoRefreshPortletUtil.startRefreshCycle(this, this, refreshTimer);
}
@Override
protected void onDestroy() {
- if (refreshTimer != null) {
+ AutoRefreshPortletUtil.onDestroy(this, refreshTimer);
- refreshTimer.cancel();
- }
super.onDestroy();
}
+ public boolean isRefreshing() {
+ return this.currentlyLoading;
+ }
+
@Override
public void redraw() {
super.redraw();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
index 5cf7b36..7c748fa 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
@@ -51,9 +51,9 @@ import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.components.measurement.CustomConfigMeasurementRangeEditor;
import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortletUtil;
import org.rhq.enterprise.gui.coregui.client.dashboard.CustomSettingsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
@@ -66,7 +66,6 @@ import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGro
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
import org.rhq.enterprise.gui.coregui.client.util.BrowserUtility;
-import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableCanvas;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -454,39 +453,21 @@ public class GroupMetricsPortlet extends LocatableVLayout implements CustomSetti
recentMeasurementsContent.markForRedraw();
}
- @Override
public void startRefreshCycle() {
- //current setting
- final int refreshInterval = UserSessionManager.getUserPreferences().getPageRefreshInterval();
-
- //cancel any existing timer
- if (refreshTimer != null) {
- refreshTimer.cancel();
- }
-
- if (refreshInterval >= MeasurementUtility.MINUTES) {
-
- refreshTimer = new Timer() {
- public void run() {
- if (!currentlyLoading) {
- loadData();
- redraw();
- }
- }
- };
-
- refreshTimer.scheduleRepeating(refreshInterval);
- }
+ refreshTimer = AutoRefreshPortletUtil.startRefreshCycle(this, this, refreshTimer);
}
@Override
protected void onDestroy() {
- if (refreshTimer != null) {
- refreshTimer.cancel();
- }
+ AutoRefreshPortletUtil.onDestroy(this, refreshTimer);
+
super.onDestroy();
}
+ public boolean isRefreshing() {
+ return this.currentlyLoading;
+ }
+
@Override
public void redraw() {
super.redraw();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOobsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOobsPortlet.java
index ed3fb42..265e200 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOobsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOobsPortlet.java
@@ -40,8 +40,8 @@ import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.core.domain.measurement.composite.MeasurementOOBComposite;
import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortletUtil;
import org.rhq.enterprise.gui.coregui.client.dashboard.CustomSettingsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
@@ -51,7 +51,6 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.PortletConfigura
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.summary.AbstractActivityView;
import org.rhq.enterprise.gui.coregui.client.util.GwtRelativeDurationConverter;
-import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableCanvas;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -243,40 +242,21 @@ public class GroupOobsPortlet extends LocatableVLayout implements CustomSettings
});
}
- @Override
public void startRefreshCycle() {
- //current setting
- final int refreshInterval = UserSessionManager.getUserPreferences().getPageRefreshInterval();
-
- //cancel any existing timer
- if (refreshTimer != null) {
- refreshTimer.cancel();
- }
-
- if (refreshInterval >= MeasurementUtility.MINUTES) {
-
- refreshTimer = new Timer() {
- public void run() {
- if (!currentlyLoading) {
- loadData();
- redraw();
- }
- }
- };
-
- refreshTimer.scheduleRepeating(refreshInterval);
- }
+ refreshTimer = AutoRefreshPortletUtil.startRefreshCycle(this, this, refreshTimer);
}
@Override
protected void onDestroy() {
- if (refreshTimer != null) {
+ AutoRefreshPortletUtil.onDestroy(this, refreshTimer);
- refreshTimer.cancel();
- }
super.onDestroy();
}
+ public boolean isRefreshing() {
+ return this.currentlyLoading;
+ }
+
@Override
public void redraw() {
super.redraw();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java
index 37813ac..10031d1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupOperationsPortlet.java
@@ -48,9 +48,9 @@ import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.components.measurement.CustomConfigMeasurementRangeEditor;
import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortletUtil;
import org.rhq.enterprise.gui.coregui.client.dashboard.CustomSettingsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
@@ -296,37 +296,21 @@ public class GroupOperationsPortlet extends LocatableVLayout implements CustomSe
}
}
- @Override
public void startRefreshCycle() {
- //current setting
- final int refreshInterval = UserSessionManager.getUserPreferences().getPageRefreshInterval();
-
- //cancel any existing timer
- if (refreshTimer != null) {
- refreshTimer.cancel();
- }
-
- if (refreshInterval >= MeasurementUtility.MINUTES) {
-
- refreshTimer = new Timer() {
- public void run() {
- redraw();
- }
- };
-
- refreshTimer.scheduleRepeating(refreshInterval);
- }
+ refreshTimer = AutoRefreshPortletUtil.startRefreshCycle(this, this, refreshTimer);
}
@Override
protected void onDestroy() {
- if (refreshTimer != null) {
- refreshTimer.cancel();
- }
+ AutoRefreshPortletUtil.onDestroy(this, refreshTimer);
super.onDestroy();
}
+ public boolean isRefreshing() {
+ return false;
+ }
+
private boolean isAutoGroup() {
return ResourceGroupDetailView.AUTO_GROUP_VIEW_PATH.equals(getBaseViewPath());
}
@@ -355,6 +339,7 @@ class GroupOperationsCriteriaHistoryListView extends GroupOperationHistoryListVi
private ResourceGroupComposite composite;
+ @SuppressWarnings("unchecked")
public GroupOperationsCriteriaHistoryListView(String locatorId, GroupOperationsCriteriaDataSource dataSource,
String title, Criteria criteria, ResourceGroupComposite composite) {
super(locatorId, composite);
@@ -363,6 +348,7 @@ class GroupOperationsCriteriaHistoryListView extends GroupOperationHistoryListVi
setShowFooterRefresh(false); //disable footer refresh
}
+ @SuppressWarnings("unchecked")
public void setDatasource(GroupOperationsCriteriaDataSource datasource) {
super.setDataSource(datasource);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupPkgHistoryPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupPkgHistoryPortlet.java
index 30c21a7..e58b1da 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupPkgHistoryPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupPkgHistoryPortlet.java
@@ -43,8 +43,8 @@ import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
-import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortletUtil;
import org.rhq.enterprise.gui.coregui.client.dashboard.CustomSettingsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
@@ -54,7 +54,6 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.PortletConfigura
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.summary.AbstractActivityView;
import org.rhq.enterprise.gui.coregui.client.util.GwtRelativeDurationConverter;
-import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableCanvas;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -260,40 +259,21 @@ public class GroupPkgHistoryPortlet extends LocatableVLayout implements CustomSe
});
}
- @Override
public void startRefreshCycle() {
- //current setting
- final int refreshInterval = UserSessionManager.getUserPreferences().getPageRefreshInterval();
-
- //cancel any existing timer
- if (refreshTimer != null) {
- refreshTimer.cancel();
- }
-
- if (refreshInterval >= MeasurementUtility.MINUTES) {
-
- refreshTimer = new Timer() {
- public void run() {
- if (!currentlyLoading) {
- loadData();
- redraw();
- }
- }
- };
-
- refreshTimer.scheduleRepeating(refreshInterval);
- }
+ refreshTimer = AutoRefreshPortletUtil.startRefreshCycle(this, this, refreshTimer);
}
@Override
protected void onDestroy() {
- if (refreshTimer != null) {
+ AutoRefreshPortletUtil.onDestroy(this, refreshTimer);
- refreshTimer.cancel();
- }
super.onDestroy();
}
+ public boolean isRefreshing() {
+ return this.currentlyLoading;
+ }
+
@Override
public void redraw() {
super.redraw();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java
index efa62f7..37d57df 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java
@@ -31,15 +31,14 @@ import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.dashboard.DashboardPortlet;
-import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortletUtil;
import org.rhq.enterprise.gui.coregui.client.dashboard.CustomSettingsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery.AutodiscoveryQueueDataSource;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery.ResourceAutodiscoveryView;
-import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
@@ -197,37 +196,19 @@ public class AutodiscoveryPortlet extends ResourceAutodiscoveryView implements C
return dataSource;
}
- @Override
public void startRefreshCycle() {
- //current setting
- final int refreshInterval = UserSessionManager.getUserPreferences().getPageRefreshInterval();
-
- //cancel any existing timer
- if (refreshTimer != null) {
- refreshTimer.cancel();
- }
-
- if (refreshInterval >= MeasurementUtility.MINUTES) {
-
- refreshTimer = new Timer() {
- public void run() {
-
- redraw();
- }
- };
-
- refreshTimer.scheduleRepeating(refreshInterval);
- }
+ refreshTimer = AutoRefreshPortletUtil.startRefreshCycle(this, this, refreshTimer);
}
@Override
protected void onDestroy() {
- if (refreshTimer != null) {
-
- refreshTimer.cancel();
- }
+ AutoRefreshPortletUtil.onDestroy(this, refreshTimer);
super.onDestroy();
}
+ public boolean isRefreshing() {
+ return false;
+ }
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java
index f14d791..556ee6f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java
@@ -37,11 +37,11 @@ import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortletUtil;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
-import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
/**
* @author Greg Hinkle
@@ -127,36 +127,19 @@ public class FavoriteResourcesPortlet extends ResourceSearchView implements Auto
}
}
- @Override
public void startRefreshCycle() {
- //current setting
- final int refreshInterval = UserSessionManager.getUserPreferences().getPageRefreshInterval();
-
- //cancel any existing timer
- if (refreshTimer != null) {
- refreshTimer.cancel();
- }
-
- if (refreshInterval >= MeasurementUtility.MINUTES) {
-
- refreshTimer = new Timer() {
- public void run() {
-
- redraw();
- }
- };
-
- refreshTimer.scheduleRepeating(refreshInterval);
- }
+ refreshTimer = AutoRefreshPortletUtil.startRefreshCycle(this, this, refreshTimer);
}
@Override
protected void onDestroy() {
- if (refreshTimer != null) {
-
- refreshTimer.cancel();
- }
+ AutoRefreshPortletUtil.onDestroy(this, refreshTimer);
super.onDestroy();
}
+
+ public boolean isRefreshing() {
+ return false;
+ }
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
index 665898e..fed9070 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
@@ -46,11 +46,10 @@ import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
-import org.rhq.enterprise.gui.coregui.client.Messages;
-import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.alert.AlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.alert.AlertPortletDataSource;
import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortletUtil;
import org.rhq.enterprise.gui.coregui.client.dashboard.CustomSettingsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
@@ -566,39 +565,21 @@ public class RecentAlertsPortlet extends AlertHistoryView implements CustomSetti
}
}
- @Override
public void startRefreshCycle() {
- //current setting
- final int refreshInterval = UserSessionManager.getUserPreferences().getPageRefreshInterval();
-
- //cancel any existing timer
- if (refreshTimer != null) {
- refreshTimer.cancel();
- }
-
- if (refreshInterval >= MeasurementUtility.MINUTES) {
-
- refreshTimer = new Timer() {
- public void run() {
-
- redraw();
- }
- };
-
- refreshTimer.scheduleRepeating(refreshInterval);
- }
+ refreshTimer = AutoRefreshPortletUtil.startRefreshCycle(this, this, refreshTimer);
}
@Override
protected void onDestroy() {
- if (refreshTimer != null) {
-
- refreshTimer.cancel();
- }
+ AutoRefreshPortletUtil.onDestroy(this, refreshTimer);
super.onDestroy();
}
+ public boolean isRefreshing() {
+ return false;
+ }
+
@Override
protected void setupTableInteractions(boolean hasWriteAccess) {
// The portlet is a "subsystem" view. Meaning the alerts displayed can be from any accessible group for
@@ -655,7 +636,6 @@ class AlertResourceSelectorRegion extends LocatableVLayout {
this.currentlyAssignedIds = assigned;
}
- private static final Messages MSG = CoreGUI.getMessages();
private PortletAlertSelector selector = null;
private Integer[] currentlyAssignedIds;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedResourcesPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedResourcesPortlet.java
index e63c0c7..e570a04 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedResourcesPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedResourcesPortlet.java
@@ -37,14 +37,13 @@ import com.smartgwt.client.widgets.tree.TreeGrid;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.dashboard.DashboardPortlet;
-import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortletUtil;
import org.rhq.enterprise.gui.coregui.client.dashboard.CustomSettingsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
-import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
public class RecentlyAddedResourcesPortlet extends LocatableVLayout implements CustomSettingsPortlet,
@@ -252,36 +251,18 @@ public class RecentlyAddedResourcesPortlet extends LocatableVLayout implements C
return dataSource;
}
- @Override
public void startRefreshCycle() {
- //current setting
- final int refreshInterval = UserSessionManager.getUserPreferences().getPageRefreshInterval();
-
- //cancel any existing timer
- if (refreshTimer != null) {
- refreshTimer.cancel();
- }
-
- if (refreshInterval >= MeasurementUtility.MINUTES) {
-
- refreshTimer = new Timer() {
- public void run() {
-
- redraw();
- }
- };
-
- refreshTimer.scheduleRepeating(refreshInterval);
- }
+ refreshTimer = AutoRefreshPortletUtil.startRefreshCycle(this, this, refreshTimer);
}
@Override
protected void onDestroy() {
- if (refreshTimer != null) {
-
- refreshTimer.cancel();
- }
+ AutoRefreshPortletUtil.onDestroy(this, refreshTimer);
super.onDestroy();
}
+
+ public boolean isRefreshing() {
+ return false;
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java
index 69a36a0..c839109 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java
@@ -43,8 +43,8 @@ import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
import org.rhq.core.domain.configuration.definition.PropertySimpleType;
import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
-import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortletUtil;
import org.rhq.enterprise.gui.coregui.client.dashboard.CustomSettingsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
@@ -52,7 +52,6 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.AncestryUtil;
import org.rhq.enterprise.gui.coregui.client.operation.RecentOperationsDataSource;
import org.rhq.enterprise.gui.coregui.client.operation.ScheduledOperationsDataSource;
-import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLabel;
@@ -513,36 +512,18 @@ public class OperationsPortlet extends LocatableVLayout implements CustomSetting
return this.scheduledOperationsGrid;
}
- @Override
public void startRefreshCycle() {
- //current setting
- final int refreshInterval = UserSessionManager.getUserPreferences().getPageRefreshInterval();
-
- //cancel any existing timer
- if (refreshTimer != null) {
- refreshTimer.cancel();
- }
-
- if (refreshInterval >= MeasurementUtility.MINUTES) {
-
- refreshTimer = new Timer() {
- public void run() {
-
- redraw();
- }
- };
-
- refreshTimer.scheduleRepeating(refreshInterval);
- }
+ refreshTimer = AutoRefreshPortletUtil.startRefreshCycle(this, this, refreshTimer);
}
@Override
protected void onDestroy() {
- if (refreshTimer != null) {
-
- refreshTimer.cancel();
- }
+ AutoRefreshPortletUtil.onDestroy(this, refreshTimer);
super.onDestroy();
}
+
+ public boolean isRefreshing() {
+ return false;
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
index bd28719..8fcaba0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
@@ -49,10 +49,10 @@ import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
import org.rhq.core.domain.configuration.definition.PropertySimpleType;
import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
-import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableWidget;
import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortletUtil;
import org.rhq.enterprise.gui.coregui.client.dashboard.CustomSettingsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
@@ -340,39 +340,21 @@ public class ProblemResourcesPortlet extends Table<ProblemResourcesDataSource> i
return timeRange;
}
- @Override
public void startRefreshCycle() {
- //current setting
- final int refreshInterval = UserSessionManager.getUserPreferences().getPageRefreshInterval();
-
- //cancel any existing timer
- if (refreshTimer != null) {
- refreshTimer.cancel();
- }
-
- if (refreshInterval >= MeasurementUtility.MINUTES) {
-
- refreshTimer = new Timer() {
- public void run() {
-
- redraw();
- }
- };
-
- refreshTimer.scheduleRepeating(refreshInterval);
- }
+ refreshTimer = AutoRefreshPortletUtil.startRefreshCycle(this, this, refreshTimer);
}
@Override
protected void onDestroy() {
- if (refreshTimer != null) {
-
- refreshTimer.cancel();
- }
+ AutoRefreshPortletUtil.onDestroy(this, refreshTimer);
super.onDestroy();
}
+ public boolean isRefreshing() {
+ return false;
+ }
+
}
/**Construct table widget Label to display timerange settings used with latest datasource query.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryPortlet.java
index 70fbc3e..3466bb6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryPortlet.java
@@ -38,14 +38,13 @@ import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.core.domain.resource.InventorySummary;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortletUtil;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceBossGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -172,37 +171,18 @@ public class InventorySummaryPortlet extends LocatableVLayout implements AutoRef
}
}
- @Override
public void startRefreshCycle() {
- //current setting
- final int refreshInterval = UserSessionManager.getUserPreferences().getPageRefreshInterval();
-
- //cancel any existing timer
- if (refreshTimer != null) {
- refreshTimer.cancel();
- }
-
- if (refreshInterval >= MeasurementUtility.MINUTES) {
-
- refreshTimer = new Timer() {
- public void run() {
-
- redraw();
- }
- };
-
- refreshTimer.scheduleRepeating(refreshInterval);
- }
+ refreshTimer = AutoRefreshPortletUtil.startRefreshCycle(this, this, refreshTimer);
}
@Override
protected void onDestroy() {
- if (refreshTimer != null) {
-
- refreshTimer.cancel();
- }
+ AutoRefreshPortletUtil.onDestroy(this, refreshTimer);
super.onDestroy();
}
+ public boolean isRefreshing() {
+ return false;
+ }
}
13 years, 3 months