diff options
author | Matti Tahvonen <matti.tahvonen@itmill.com> | 2011-09-08 10:38:46 +0000 |
---|---|---|
committer | Matti Tahvonen <matti.tahvonen@itmill.com> | 2011-09-08 10:38:46 +0000 |
commit | 5fc9f775f3b256c31204cc681c640513559184c9 (patch) | |
tree | 82416c17935b747091085b54ade73118877ce651 | |
parent | 8c104cd1c5db142097a99dbef0e7b43a8663e5c2 (diff) | |
download | vaadin-framework-5fc9f775f3b256c31204cc681c640513559184c9.tar.gz vaadin-framework-5fc9f775f3b256c31204cc681c640513559184c9.zip |
small fixes to debug window
svn changeset:20925/svn branch:6.7
4 files changed, 59 insertions, 42 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java index 236a16ed55..e1ffca55e3 100755 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java @@ -395,7 +395,8 @@ public class ApplicationConnection { * @param paintable */ void highlightComponent(Paintable paintable) { - String params = getRepaintAllParameters() + "&hightlightComponent=" + getPid(paintable); + String params = getRepaintAllParameters() + "&highlightComponent=" + + getPid(paintable); makeUidlRequest("", params, false); } diff --git a/src/com/vaadin/terminal/gwt/client/SimpleTree.java b/src/com/vaadin/terminal/gwt/client/SimpleTree.java index 121946e1ea..01ccb21054 100644 --- a/src/com/vaadin/terminal/gwt/client/SimpleTree.java +++ b/src/com/vaadin/terminal/gwt/client/SimpleTree.java @@ -35,7 +35,7 @@ public class SimpleTree extends ComplexPanel { style.setWidth(10, Unit.PX); style.setCursor(Cursor.POINTER); style.setBorderStyle(BorderStyle.SOLID); - style.setBorderColor("grey"); + style.setBorderColor("#666"); style.setBorderWidth(1, Unit.PX); style.setMarginRight(3, Unit.PX); style.setProperty("borderRadius", "4px"); @@ -109,6 +109,7 @@ public class SimpleTree extends ComplexPanel { protected void add(Widget child, Element container) { super.add(child, container); handle.getStyle().setDisplay(Display.INLINE_BLOCK); + } } diff --git a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java index 7caaf768d0..6384dce3f3 100755 --- a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java +++ b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java @@ -13,6 +13,7 @@ import com.google.gwt.core.client.JsArray; import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.dom.client.Style; import com.google.gwt.dom.client.Style.FontWeight; +import com.google.gwt.dom.client.Style.Overflow; import com.google.gwt.dom.client.Style.Position; import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.event.dom.client.ClickEvent; @@ -63,8 +64,7 @@ import com.vaadin.terminal.gwt.client.ui.VOverlay; */ public class VDebugConsole extends VOverlay implements Console { - private final class HighlightModeHandler implements - NativePreviewHandler { + private final class HighlightModeHandler implements NativePreviewHandler { private final Label label; private HighlightModeHandler(Label label) { @@ -72,25 +72,30 @@ public class VDebugConsole extends VOverlay implements Console { } public void onPreviewNativeEvent(NativePreviewEvent event) { - if(event.getTypeInt() == Event.ONKEYDOWN && event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE) { + if (event.getTypeInt() == Event.ONKEYDOWN + && event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE) { highlightModeRegistration.removeHandler(); VUIDLBrowser.deHiglight(); return; } - if(event.getTypeInt() == Event.ONMOUSEMOVE) { + if (event.getTypeInt() == Event.ONMOUSEMOVE) { VUIDLBrowser.deHiglight(); - Element eventTarget = Util.getElementFromPoint(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY()); - if(getElement().isOrHasChild(eventTarget)) { + Element eventTarget = Util.getElementFromPoint(event + .getNativeEvent().getClientX(), event.getNativeEvent() + .getClientY()); + if (getElement().isOrHasChild(eventTarget)) { return; } - - for(ApplicationConnection a : ApplicationConfiguration.getRunningApplications()) { - Paintable paintable = Util.getPaintableForElement(a, a.getView(), eventTarget); - if(paintable != null) { + for (ApplicationConnection a : ApplicationConfiguration + .getRunningApplications()) { + Paintable paintable = Util.getPaintableForElement(a, + a.getView(), eventTarget); + if (paintable != null) { String pid = a.getPid(paintable); VUIDLBrowser.highlight(paintable); - label.setText("Currently focused :" + paintable.getClass() + " ID:" + pid); + label.setText("Currently focused :" + + paintable.getClass() + " ID:" + pid); event.cancel(); event.consume(); event.getNativeEvent().stopPropagation(); @@ -98,16 +103,20 @@ public class VDebugConsole extends VOverlay implements Console { } } } - if(event.getTypeInt() == Event.ONCLICK) { + if (event.getTypeInt() == Event.ONCLICK) { VUIDLBrowser.deHiglight(); event.cancel(); event.consume(); event.getNativeEvent().stopPropagation(); highlightModeRegistration.removeHandler(); - Element eventTarget = Util.getElementFromPoint(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY()); - for(ApplicationConnection a : ApplicationConfiguration.getRunningApplications()) { - Paintable paintable = Util.getPaintableForElement(a, a.getView(), eventTarget); - if(paintable != null) { + Element eventTarget = Util.getElementFromPoint(event + .getNativeEvent().getClientX(), event.getNativeEvent() + .getClientY()); + for (ApplicationConnection a : ApplicationConfiguration + .getRunningApplications()) { + Paintable paintable = Util.getPaintableForElement(a, + a.getView(), eventTarget); + if (paintable != null) { a.highlightComponent(paintable); return; } @@ -148,11 +157,12 @@ public class VDebugConsole extends VOverlay implements Console { private int origLeft; - private static final String help = "Drag=move, shift-drag=resize, doubleclick=min/max." + private static final String help = "Drag title=move, shift-drag=resize, doubleclick title=min/max." + "Use debug=quiet to log only to browser console."; public VDebugConsole() { super(false, false); + getElement().getStyle().setOverflow(Overflow.HIDDEN); clear.setTitle("Clear console"); restart.setTitle("Restart app"); forceLayout.setTitle("Force layout"); @@ -291,6 +301,7 @@ public class VDebugConsole extends VOverlay implements Console { } panel.setHeight((height - 20) + "px"); panel.setWidth((width - 2) + "px"); + getElement().getStyle().setWidth(width, Unit.PX); } /* @@ -598,8 +609,8 @@ public class VDebugConsole extends VOverlay implements Console { setWidget(panel); caption.setClassName("v-debug-console-caption"); setStyleName("v-debug-console"); - DOM.setStyleAttribute(getElement(), "zIndex", 20000 + ""); - DOM.setStyleAttribute(getElement(), "overflow", "hidden"); + getElement().getStyle().setZIndex(20000); + getElement().getStyle().setOverflow(Overflow.HIDDEN); sinkEvents(Event.ONDBLCLICK); @@ -617,16 +628,18 @@ public class VDebugConsole extends VOverlay implements Console { actions = new HorizontalPanel(); Style style = actions.getElement().getStyle(); style.setPosition(Position.ABSOLUTE); - style.setBackgroundColor("grey"); - style.setRight(0, Unit.PX); + style.setBackgroundColor("#666"); + style.setLeft(135, Unit.PX); style.setHeight(25, Unit.PX); style.setTop(0, Unit.PX); + actions.add(clear); actions.add(restart); actions.add(forceLayout); actions.add(analyzeLayout); actions.add(highlight); - highlight.setTitle("Select a component and print details about it to the server log and client side console."); + highlight + .setTitle("Select a component and print details about it to the server log and client side console."); actions.add(savePosition); savePosition .setTitle("Saves the position and size of debug console to a cookie"); @@ -663,6 +676,7 @@ public class VDebugConsole extends VOverlay implements Console { .setTitle("Automatically scroll so that new messages are visible"); panel.add(actions); + panel.add(new HTML("<i>" + help + "</i>")); clear.addClickHandler(new ClickHandler() { @@ -734,15 +748,17 @@ public class VDebugConsole extends VOverlay implements Console { Cookies.setCookie(POS_COOKIE_NAME, pos); } }); - + highlight.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final Label label = new Label("--"); log("<i>Use mouse to select a component or click ESC to exit highlight mode.</i>"); panel.add(label); - highlightModeRegistration = Event.addNativePreviewHandler(new HighlightModeHandler(label)); - + highlightModeRegistration = Event + .addNativePreviewHandler(new HighlightModeHandler( + label)); + } }); diff --git a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java index cc10d7e221..b47c3ca31f 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java @@ -359,9 +359,9 @@ public abstract class AbstractCommunicationManager implements private static final String UTF8 = "UTF8"; - private static final String GET_PARAM_HIGHLIGHT_COMPONENT = "hightlightComponent"; + private static final String GET_PARAM_HIGHLIGHT_COMPONENT = "highlightComponent"; - private Paintable hightLightedPaintable; + private Paintable highLightedPaintable; private static String readLine(InputStream stream) throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); @@ -714,8 +714,8 @@ public abstract class AbstractCommunicationManager implements if (request.getParameter(GET_PARAM_HIGHLIGHT_COMPONENT) != null) { String pid = request .getParameter(GET_PARAM_HIGHLIGHT_COMPONENT); - hightLightedPaintable = idPaintableMap.get(pid); - highlightPaintable(hightLightedPaintable); + highLightedPaintable = idPaintableMap.get(pid); + highlightPaintable(highLightedPaintable); } } @@ -788,13 +788,13 @@ public abstract class AbstractCommunicationManager implements requestThemeName = null; } - protected void highlightPaintable(Paintable hightLightedPaintable2) { + protected void highlightPaintable(Paintable highLightedPaintable2) { StringBuilder sb = new StringBuilder(); sb.append("*** Debug details of a component: *** \n"); sb.append("Type: "); - sb.append(hightLightedPaintable2.getClass().getName()); - if (hightLightedPaintable2 instanceof AbstractComponent) { - AbstractComponent component = (AbstractComponent) hightLightedPaintable2; + sb.append(highLightedPaintable2.getClass().getName()); + if (highLightedPaintable2 instanceof AbstractComponent) { + AbstractComponent component = (AbstractComponent) highLightedPaintable2; sb.append("\nId:"); sb.append(paintableIdMap.get(component)); if (component.getCaption() != null) { @@ -807,7 +807,8 @@ public abstract class AbstractCommunicationManager implements logger.info(sb.toString()); } - protected void printHighlightedComponentHierarchy(StringBuilder sb, AbstractComponent component) { + protected void printHighlightedComponentHierarchy(StringBuilder sb, + AbstractComponent component) { LinkedList<Component> h = new LinkedList<Component>(); h.add(component); Component parent = component.getParent(); @@ -832,8 +833,7 @@ public abstract class AbstractCommunicationManager implements sb.append(" "); } l++; - Class<? extends Component> componentClass = component2 - .getClass(); + Class<? extends Component> componentClass = component2.getClass(); Class<?> topClass = componentClass; while (topClass.getEnclosingClass() != null) { topClass = topClass.getEnclosingClass(); @@ -1071,14 +1071,13 @@ public abstract class AbstractCommunicationManager implements } outWriter.write("]"); } - if (hightLightedPaintable != null) { + if (highLightedPaintable != null) { outWriter.write(", \"hl\":\""); - outWriter.write(paintableIdMap.get(hightLightedPaintable)); + outWriter.write(paintableIdMap.get(highLightedPaintable)); outWriter.write("\""); - hightLightedPaintable = null; + highLightedPaintable = null; } } - SystemMessages ci = null; try { |