[Mc4j-cvs] mc4j/src/org/mc4j/console/query QueryNode.java,1.12,1.13
Brought to you by:
ghinkl
From: Greg H. <gh...@us...> - 2006-04-17 03:07:32
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/query In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6745/src/org/mc4j/console/query Modified Files: QueryNode.java Log Message: Dashboard and component tweaks Index: QueryNode.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/query/QueryNode.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** QueryNode.java 12 Apr 2006 19:14:15 -0000 1.12 --- QueryNode.java 17 Apr 2006 03:07:25 -0000 1.13 *************** *** 19,22 **** --- 19,24 ---- import org.mc4j.console.bean.MBeanNode; import org.mc4j.console.connection.ConnectionNode; + import org.mc4j.ems.connection.bean.EmsBean; + import org.mc4j.ems.connection.bean.attribute.EmsAttribute; import org.openide.ErrorManager; import org.openide.actions.OpenLocalExplorerAction; *************** *** 33,36 **** --- 35,39 ---- import java.util.List; import java.util.Set; + import java.util.SortedSet; import java.util.regex.Pattern; *************** *** 76,82 **** protected void refreshQuery() { ! ConnectionNode connectionNode = (ConnectionNode)getParentNode(); ! final List list = new ArrayList(connectionNode.getMBeanList()); this.getChildren().remove(this.getChildren().getNodes()); --- 79,86 ---- protected void refreshQuery() { ! final ConnectionNode connectionNode = (ConnectionNode)getParentNode(); ! final SortedSet<EmsBean> beans = connectionNode.getEmsConnection().getBeans(); ! //new ArrayList(connectionNode.getMBeanList()); this.getChildren().remove(this.getChildren().getNodes()); *************** *** 86,104 **** try { ! Iterator iter = list.iterator(); int i=0; ! while (iter.hasNext()) { ! Object obj = iter.next(); ! MBeanNode mBeanNode = (MBeanNode) obj; ! String canonicalName = mBeanNode.getEmsBean().getBeanName().getCanonicalName(); ! StatusDisplayer.getDefault().setStatusText("Searching MBean [" + i++ + " of " + list.size() + "]"); if ((patern == null) || patern.matcher(canonicalName).matches()) { if ((substringSearch == null) || (canonicalName.toUpperCase().indexOf(substringSearch.toUpperCase()) >= 0)) { ! if ((attributeNameSearch == null) || setContainsSubstring(mBeanNode.getAttributeNodeMap().keySet(), attributeNameSearch)) { ! ! addMBean(mBeanNode); } } --- 90,105 ---- try { ! for (EmsBean bean : beans) { int i=0; ! String canonicalName = bean.getBeanName().getCanonicalName(); ! StatusDisplayer.getDefault().setStatusText("Searching MBean [" + i++ + " of " + beans.size() + "]"); if ((patern == null) || patern.matcher(canonicalName).matches()) { if ((substringSearch == null) || (canonicalName.toUpperCase().indexOf(substringSearch.toUpperCase()) >= 0)) { ! if ((attributeNameSearch == null) || setContainsSubstring(bean.getAttributes(), attributeNameSearch)) { ! MBeanNode node = connectionNode.getMBeanNode(canonicalName); ! addMBean(node); } } *************** *** 107,123 **** } catch (Exception e) { ErrorManager.getDefault().notify(e); } } }); ! t.start(); } ! private boolean setContainsSubstring(Set set, String substring) { String upperSubstring = substring.toUpperCase(); ! for (Iterator iterator = set.iterator(); iterator.hasNext();) { ! String s = (String) iterator.next(); ! if (s.toUpperCase().indexOf(upperSubstring) >= 0) return true; } --- 108,125 ---- } catch (Exception e) { ErrorManager.getDefault().notify(e); + } finally{ + StatusDisplayer.getDefault().setStatusText("Finished search"); } } }); ! t.setName("Query runner"); t.start(); } ! private boolean setContainsSubstring(Set<EmsAttribute> set, String substring) { String upperSubstring = substring.toUpperCase(); ! for (EmsAttribute attribute : set) { ! if (attribute.getName().toUpperCase().contains(upperSubstring)) return true; } *************** *** 205,209 **** public void setValue(Object value) { regularExpressionText = (String)value; ! patern = Pattern.compile((String)value); refreshQuery(); } --- 207,215 ---- public void setValue(Object value) { regularExpressionText = (String)value; ! if (regularExpressionText == null || regularExpressionText.length() == 0) ! patern = null; ! else ! patern = Pattern.compile((String)value); ! refreshQuery(); } |