Initial commit towards adding a new "reference" section for the project's own reference over time, including an HTML encyclopedia (to easily reproducible/check HTML behavior across browsers) and a "code museum" that will house little code snippets that we create when testing issues, etc. The point is to accumulate a set of reference materials we can continue to keep around instead of editing Hello locally and throwing it away :-) Patch by: bruce Review by: jlabanca (pair programming) git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@2500 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/eclipse/reference/code-museum/.classpath b/eclipse/reference/code-museum/.classpath new file mode 100644 index 0000000..ba6caad --- /dev/null +++ b/eclipse/reference/code-museum/.classpath
@@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry combineaccessrules="false" kind="src" path="/gwt-user"/> + <classpathentry kind="output" path="bin"/> +</classpath>
diff --git a/eclipse/reference/code-museum/.project b/eclipse/reference/code-museum/.project new file mode 100644 index 0000000..51ebf3f --- /dev/null +++ b/eclipse/reference/code-museum/.project
@@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>code-museum</name> + <comment>museum project</comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>com.google.gwt.eclipse.plugin.gwtNature</nature> + </natures> + <linkedResources> + <link> + <name>src</name> + <type>2</type> + <locationURI>GWT_ROOT/reference/code-museum/src</locationURI> + </link> + </linkedResources> +</projectDescription>
diff --git a/eclipse/reference/code-museum/Museum.launch b/eclipse/reference/code-museum/Museum.launch new file mode 100644 index 0000000..a99eab6 --- /dev/null +++ b/eclipse/reference/code-museum/Museum.launch
@@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication"> +<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/> +<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.GWTShell"/> +<listAttribute key="org.eclipse.jdt.launching.CLASSPATH"> +<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="museum" path="1" type="4"/> "/> +<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/museum/src" path="3" type="2"/> "/> +<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento project="museum"/> </runtimeClasspathEntry> "/> +<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry externalArchive="/Applications/gwt-mac-1.4.61/gwt-dev-mac.jar" path="3" type="2"/> "/> +</listAttribute> +<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XstartOnFirstThread"/> +<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-out www com.google.gwt.inward.museum.Museum/Museum.html"/> +<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="museum"/> +<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/> +</launchConfiguration>
diff --git a/reference/code-museum/src/com/google/gwt/museum/Museum.gwt.xml b/reference/code-museum/src/com/google/gwt/museum/Museum.gwt.xml new file mode 100644 index 0000000..c199f7c --- /dev/null +++ b/reference/code-museum/src/com/google/gwt/museum/Museum.gwt.xml
@@ -0,0 +1,9 @@ +<module> + + <!-- Inherit the core Web Toolkit stuff. --> + <inherits name='com.google.gwt.user.User'/> + + <!-- Specify the app entry point class. --> + <entry-point class='com.google.gwt.museum.client.Museum'/> + +</module>
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/Issue2290.java b/reference/code-museum/src/com/google/gwt/museum/client/Issue2290.java new file mode 100644 index 0000000..2bd416b --- /dev/null +++ b/reference/code-museum/src/com/google/gwt/museum/client/Issue2290.java
@@ -0,0 +1,34 @@ +package com.google.gwt.museum.client; + +import com.google.gwt.user.client.ui.Button; +import com.google.gwt.user.client.ui.ClickListener; +import com.google.gwt.user.client.ui.Panel; +import com.google.gwt.user.client.ui.Tree; +import com.google.gwt.user.client.ui.TreeItem; +import com.google.gwt.user.client.ui.Widget; + +public class Issue2290 { + + public Issue2290(Panel p) { + Tree tree = new Tree(); + + final TreeItem treeItem1 = new TreeItem("Item1"); + tree.addItem(treeItem1); + + final TreeItem treeItem2 = new TreeItem("Item2"); + tree.addItem(treeItem2); + + p.add(tree); + + final Button button = new Button("Select", new ClickListener() { + public void onClick(Widget sender) { + treeItem1.setSelected(!treeItem1.isSelected()); + treeItem2.setSelected(!treeItem2.isSelected()); + + ((Button)sender).setText(treeItem1.isSelected() ? "Unselect" : "Select"); + } + }); + p.add(button); + } + +}
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/Issue2307.java b/reference/code-museum/src/com/google/gwt/museum/client/Issue2307.java new file mode 100644 index 0000000..b7ad56a --- /dev/null +++ b/reference/code-museum/src/com/google/gwt/museum/client/Issue2307.java
@@ -0,0 +1,54 @@ +package com.google.gwt.museum.client; + +import com.google.gwt.user.client.ui.Button; +import com.google.gwt.user.client.ui.CaptionPanel; +import com.google.gwt.user.client.ui.ClickListener; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.Grid; +import com.google.gwt.user.client.ui.Panel; +import com.google.gwt.user.client.ui.TextBox; +import com.google.gwt.user.client.ui.Widget; + +public class Issue2307 { + + private CaptionPanel captionPanel; + + private class ControlPanel extends Composite { + private final Grid grid = new Grid(3, 2); + + public ControlPanel() { + initWidget(grid); + + final TextBox textBox = new TextBox(); + grid.setWidget(0, 1, textBox); + grid.setWidget(0, 0, new Button("setCaptionText", new ClickListener() { + public void onClick(Widget sender) { + captionPanel.setCaptionText(textBox.getText()); + } + })); + + final TextBox htmlBox = new TextBox(); + grid.setWidget(1, 1, htmlBox); + grid.setWidget(1, 0, new Button("setCaptionHTML", new ClickListener() { + public void onClick(Widget sender) { + captionPanel.setCaptionHTML(htmlBox.getText()); + } + })); + + final TextBox contentBox = new TextBox(); + grid.setWidget(2, 1, contentBox); + grid.setWidget(2, 0, new Button("setContentWidget", new ClickListener() { + public void onClick(Widget sender) { + captionPanel.setContentWidget(new Button(contentBox.getText())); + } + })); + } + } + + public Issue2307(Panel p) { + captionPanel = new CaptionPanel("CaptionedPanel"); + p.add(captionPanel); + p.add(new ControlPanel()); + } + +}
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/Museum.java b/reference/code-museum/src/com/google/gwt/museum/client/Museum.java new file mode 100644 index 0000000..8860764 --- /dev/null +++ b/reference/code-museum/src/com/google/gwt/museum/client/Museum.java
@@ -0,0 +1,20 @@ +package com.google.gwt.museum.client; + +import com.google.gwt.core.client.EntryPoint; +import com.google.gwt.user.client.ui.Panel; +import com.google.gwt.user.client.ui.RootPanel; + +/** + * A repository for demonstrating bugs we once faced. + * + * TODO(bruce): make this more like the original bug sink idea. For now, it's + * just a hacked together set of examples based on past issues. + */ +public class Museum implements EntryPoint { + + public void onModuleLoad() { + Panel p = RootPanel.get(); + new Issue2290(p); + new Issue2307(p); + } +}
diff --git a/reference/code-museum/src/com/google/gwt/museum/public/Museum.html b/reference/code-museum/src/com/google/gwt/museum/public/Museum.html new file mode 100644 index 0000000..45cd959 --- /dev/null +++ b/reference/code-museum/src/com/google/gwt/museum/public/Museum.html
@@ -0,0 +1,24 @@ +<html> + <head> + <title>Museum</title> + + <style> + + <!-- For Issue 2290 --> + .gwt-TreeItem { + background-color: green; + } + + .gwt-TreeItem-selected { + background-color: red; + } + + </style> + + <script language='javascript' src='com.google.gwt.museum.Museum.nocache.js'></script> + </head> + + <body> + <iframe src="javascript:''" id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe> + </body> +</html>
diff --git a/reference/html-encyclopedia/FieldSet.html b/reference/html-encyclopedia/FieldSet.html new file mode 100644 index 0000000..53c5f9a --- /dev/null +++ b/reference/html-encyclopedia/FieldSet.html
@@ -0,0 +1,60 @@ +<html> +<body> + +<h1>Fieldset examples</h1> + +<h2>Fieldsets take HTML captions</h2> +Everything below is confirmed to work in FF 1.5, FF 2.0, IE 6, IE 7, Safari 3.1 + +<fieldset> + <legend><b>Bold</b> is supported</legend> + <button>Button</button> +</fieldset> + +<fieldset> + <legend><u>Underline</u> is supported</legend> + <button>Button</button> +</fieldset> + +<fieldset> + <legend><button>Buttons</button> are supported</legend> + <button>Button</button> +</fieldset> + +<fieldset> + <legend><img src="http://www.google.com/images/logo.gif"> (images are supported)</legend> + <button>Button</button> +</fieldset> + +<fieldset> + <legend> + <table> + <tr><td colspan="2">Tables work</td></tr> + <tr><td>row 1, col 1</td><td>row 1, col 2</td></tr> + <tr><td>row 2, col 1</td><td>row 2, col 2</td></tr> + </table> + </legend> + <button>Button</button> +</fieldset> + +<fieldset> + <legend> + <span><input id="mycheckbox" type="checkbox"><label for="mycheckbox">GWT-structured checkboxes work</label></span> + </legend> + <button>Button</button> +</fieldset> + +<h2>Fieldsets without a <legend> element shows no gap</h2> +<fieldset> + <button>Button</button> +</fieldset> + +<h2>Fieldsets with an empty <legend> element show a gap in some browsers</h2> +<fieldset> + <legend></legend> + <button>Button</button> +</fieldset> + +</body> +</html> +