From: Marc Englund Date: Tue, 9 Dec 2008 12:02:11 +0000 (+0000) Subject: Sampler updates. Code formatting fixes #2268 X-Git-Tag: 6.7.0.beta1~3628 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e060f468a7564793f92a023c06c761a7e323a21f;p=vaadin-framework.git Sampler updates. Code formatting fixes #2268 svn changeset:6130/svn branch:trunk --- diff --git a/WebContent/ITMILL/themes/sampler/icons/comment_yellow.gif b/WebContent/ITMILL/themes/sampler/icons/comment_yellow.gif new file mode 100644 index 0000000000..df7158a477 Binary files /dev/null and b/WebContent/ITMILL/themes/sampler/icons/comment_yellow.gif differ diff --git a/WebContent/ITMILL/themes/sampler/sampler/styles.css b/WebContent/ITMILL/themes/sampler/sampler/styles.css index a0e1799e59..ccce9ad747 100644 --- a/WebContent/ITMILL/themes/sampler/sampler/styles.css +++ b/WebContent/ITMILL/themes/sampler/sampler/styles.css @@ -54,6 +54,7 @@ font-weight: bold; font-size: 16px; } + .i-app-SamplerApplication .feature-info { background-color: #999; color: white; @@ -77,6 +78,10 @@ margin-top: 10px; } +.i-app-SamplerApplication .i-panel-content-source { + border: 1px solid #eee; +} + .i-customcomponent-ModeSwitch .i-button { height: 28px; border: none; diff --git a/src/com/itmill/toolkit/demo/sampler/CodeLabel.java b/src/com/itmill/toolkit/demo/sampler/CodeLabel.java new file mode 100644 index 0000000000..57288f090e --- /dev/null +++ b/src/com/itmill/toolkit/demo/sampler/CodeLabel.java @@ -0,0 +1,28 @@ +package com.itmill.toolkit.demo.sampler; + +import com.itmill.toolkit.ui.Label; + +public class CodeLabel extends Label { + + private static final String TAG = "codelabel"; + + public CodeLabel() { + super.setContentMode(CONTENT_PREFORMATTED); + } + + public CodeLabel(String content) { + super(content, CONTENT_PREFORMATTED); + } + + public String getTag() { + return TAG; + } + + public void setContentMode(int contentMode) { + if (contentMode != Label.CONTENT_PREFORMATTED) { + throw new UnsupportedOperationException( + "Only preformatted content supported"); + } + } + +} diff --git a/src/com/itmill/toolkit/demo/sampler/FeatureView.java b/src/com/itmill/toolkit/demo/sampler/FeatureView.java index 051bebacf2..6da72a059e 100644 --- a/src/com/itmill/toolkit/demo/sampler/FeatureView.java +++ b/src/com/itmill/toolkit/demo/sampler/FeatureView.java @@ -9,15 +9,17 @@ import com.itmill.toolkit.ui.CustomLayout; import com.itmill.toolkit.ui.Label; import com.itmill.toolkit.ui.Link; import com.itmill.toolkit.ui.OrderedLayout; +import com.itmill.toolkit.ui.Panel; import com.itmill.toolkit.ui.Button.ClickEvent; public class FeatureView extends CustomLayout { - private static final String MSG_SHOW_SRC = "Show java source"; - private static final String MSG_HIDE_SRC = "Hide java source"; + private static final String MSG_SHOW_SRC = "Show Java™ source"; + private static final String MSG_HIDE_SRC = "Hide Java™ source"; private OrderedLayout controls; + private Panel sourcePanel; private Label sourceCode; private Button showCode; @@ -38,19 +40,28 @@ public class FeatureView extends CustomLayout { showCode.setStyleName(Button.STYLE_LINK); controls.addComponent(showCode); - sourceCode = new Label(); - sourceCode.setVisible(false); + sourceCode = new CodeLabel(); sourceCode.setContentMode(Label.CONTENT_PREFORMATTED); - controls.addComponent(sourceCode); + + sourcePanel = new Panel(); + sourcePanel.getLayout().setSizeUndefined(); + sourcePanel.addStyleName(Panel.STYLE_LIGHT); + sourcePanel.addStyleName("source"); + sourcePanel.addComponent(sourceCode); + sourcePanel.setVisible(false); + sourcePanel.setWidth("100%"); + sourcePanel.setHeight("250px"); + + controls.addComponent(sourcePanel); } private void toggleSource() { - showSource(!sourceCode.isVisible()); + showSource(!sourcePanel.isVisible()); } private void showSource(boolean show) { showCode.setCaption((show ? MSG_HIDE_SRC : MSG_SHOW_SRC)); - sourceCode.setVisible(show); + sourcePanel.setVisible(show); } public void setFeature(Feature feature) { diff --git a/src/com/itmill/toolkit/demo/sampler/gwt/SamplerWidgetSet.gwt.xml b/src/com/itmill/toolkit/demo/sampler/gwt/SamplerWidgetSet.gwt.xml index 2f1e02eae5..c294d883f5 100644 --- a/src/com/itmill/toolkit/demo/sampler/gwt/SamplerWidgetSet.gwt.xml +++ b/src/com/itmill/toolkit/demo/sampler/gwt/SamplerWidgetSet.gwt.xml @@ -7,6 +7,10 @@