1.1 --- a/bpel.editors/src/org/netbeans/modules/bpel/design/decoration/components/GlassPane.java Fri Jul 20 12:13:16 2007 +0000
1.2 +++ b/bpel.editors/src/org/netbeans/modules/bpel/design/decoration/components/GlassPane.java Fri Jul 20 14:11:20 2007 +0000
1.3 @@ -174,6 +174,16 @@
1.4 throw new IndexOutOfBoundsException("Too many headers"); // NOI18N
1.5 }
1.6 }
1.7 +
1.8 +
1.9 + public void removeHeaders() {
1.10 + labelPane.removeAll();
1.11 + }
1.12 +
1.13 +
1.14 + public void removeHTML() {
1.15 + html.delete(0, html.length());
1.16 + }
1.17
1.18
1.19 public void addListItem(String iconPath, String description) {
1.20 @@ -208,10 +218,25 @@
1.21
1.22 fillHTMLFooter();
1.23
1.24 - editorPane.setText(html.toString());
1.25 + String newText = html.toString();
1.26 + String oldText = editorPane.getText();
1.27 +
1.28 + if (!equals(newText, oldText)) {
1.29 + editorPane.setText(newText);
1.30 + editorPane.setCaretPosition(editorPane.getDocument()
1.31 + .getStartPosition().getOffset());
1.32 + }
1.33
1.34 html.delete(0, html.length());
1.35 }
1.36 +
1.37 +
1.38 + private boolean equals(String s1, String s2) {
1.39 + if (s1 == s2) return true;
1.40 + if (s1 == null) return false;
1.41 + if (s2 == null) return false;
1.42 + return s1.equals(s2);
1.43 + }
1.44
1.45
1.46 private void fillHTMLHeader() {
2.1 --- a/bpel.editors/src/org/netbeans/modules/bpel/design/decoration/components/ShowGlassPaneButton.java Fri Jul 20 12:13:16 2007 +0000
2.2 +++ b/bpel.editors/src/org/netbeans/modules/bpel/design/decoration/components/ShowGlassPaneButton.java Fri Jul 20 14:11:20 2007 +0000
2.3 @@ -74,6 +74,15 @@
2.4
2.5 glassPane.addHierarchyListener(this);
2.6 }
2.7 +
2.8 +
2.9 +
2.10 + public void setResultItems(List<ResultItem> resultItems) {
2.11 + glassPane.removeHeaders();
2.12 + glassPane.removeHTML();
2.13 + fillGlassPaneHeader(resultItems);
2.14 + fillGlassPaneContent(resultItems);
2.15 + }
2.16
2.17
2.18 private void fillGlassPaneHeader(List<ResultItem> resultItems) {
3.1 --- a/bpel.editors/src/org/netbeans/modules/bpel/design/decoration/providers/ValidationDecorationProvider.java Fri Jul 20 12:13:16 2007 +0000
3.2 +++ b/bpel.editors/src/org/netbeans/modules/bpel/design/decoration/providers/ValidationDecorationProvider.java Fri Jul 20 14:11:20 2007 +0000
3.3 @@ -122,9 +122,17 @@
3.4 entity.removeCookie(decoration_key);
3.5 entity.removeCookie(list_key);
3.6 } else if (!compareLists(old_results, new_results)){
3.7 + ShowGlassPaneButton showGlassPaneButton
3.8 + = getShowGlassPaneButton(entity);
3.9 + if (showGlassPaneButton == null) {
3.10 + showGlassPaneButton
3.11 + = new ShowGlassPaneButton(new_results);
3.12 + } else {
3.13 + showGlassPaneButton.setResultItems(new_results);
3.14 + }
3.15 +
3.16 ComponentsDescriptor cd = new ComponentsDescriptor();
3.17 - cd.add(new ShowGlassPaneButton(new_results),
3.18 - ComponentsDescriptor.RIGHT_TB);
3.19 + cd.add(showGlassPaneButton, ComponentsDescriptor.RIGHT_TB);
3.20
3.21 StripeDescriptor sd = StripeDescriptor
3.22 .createValidation(new_results);
3.23 @@ -148,6 +156,22 @@
3.24
3.25 }
3.26
3.27 +
3.28 + private ShowGlassPaneButton getShowGlassPaneButton(BpelEntity entity) {
3.29 + Decoration decoration = (Decoration) entity.getCookie(decoration_key);
3.30 + if (decoration == null) return null;
3.31 + ComponentsDescriptor components = decoration.getComponents();
3.32 + if (components == null) return null;
3.33 +
3.34 + for (int i = components.getComponentCount() - 1; i >= 0; i--) {
3.35 + java.awt.Component c = components.getComponent(i);
3.36 + if (c instanceof ShowGlassPaneButton) {
3.37 + return (ShowGlassPaneButton) c;
3.38 + }
3.39 + }
3.40 +
3.41 + return null;
3.42 + }
3.43
3.44
3.45 public void validationUpdated(List<ResultItem> results) {