/*
* Copyright 2007 Hilbrand Bouwkamp, hs@bouwkamp.com
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
//package com.bouwkamp.gwt.user.client.ui;
package com.educourseware.cms.gwt.client.ui.thirdparty;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
/**
* The <code>RoundedPanel</code> class adds similar rounded corners, as seen
* in other Google applications, to a widget. This is done by adding several
* <code>div</code> Elements around a Widget. The HTML code roughly for a
* corner height 2 looks as follows:
*
* <pre>
* <div>
* <div style="margin:0 2px"></div>
* <div style="margin:0 1px"></div>
* <div>your widget</div>
* <div style="margin:0 1px"></div>
* <div style="margin:0 2px"></div>
* </div>
* </pre>
*
* To add the rounded corners to a widget start simply wrap your own widget
* in the <code>RoundedPanel</code> class, for example with all corners
* rounded:
*
* <pre>
* // all 4 corners are rounded.
* RoundedPanel rp = new RoundedPanel(yourWidget);
* // use rp where you would use 'yourWidget' otherwise
* </pre>
*
* Or with custom set corners, like only on the left:
*
* <pre>
* // custom set corners
* RoundedPanel rp = new RoundedPanel(yourWidget, RoundedPanel.LEFT);
* // use rp where you would use 'yourWidget' otherwise
* </pre>
*
* By default the height of the corners is 2px. It is possible to set
* a different height at construction time. The height can be a value
* between and including 1 and 9. This value doesn't correspond exactly
* with the height, e.g. 9 is 12px heigh.
*
* <pre>
* // all 4 corners are rounded and height index 5
* RoundedPanel rp = new RoundedPanel(yourWidget, ALL, 5);
* // use rp where you would use 'yourWidget' otherwise
* </pre>
*
* Programmatically set the color of the corners with
* {@link #setCornerColor(String)}:
*
* <pre>
* // all 4 corners are rounded.
* RoundedPanel rp = new RoundedPanel(yourWidget);
* rp.setCornerColor("red");
* </pre>
*
* Default the css style name of the rounded corner divs is
* <code>cbg-RP</code>. Use it to set the colors of the corner. For example:
*
* <pre>
* .cbg-RP { background-color:#c3d9ff; }
* </pre>
*
* A custom style might be needed when the corners are visible only when a panel
* is selected (see the KitchenSink example modification below). Use the
* <code>setCornerStyleName</code> method to set the custom style name. For
* example set a custom style <code>my-RP</code> and add something like the
* following to the stylesheet:
*
* <pre>
* .selected .my-RP { background-color:#c3d9ff; }
* </pre>
*
* <h3>Adding rounded corners to DialogBox widgets</h3>
* Adding rounded corners to a <code>DialogBox</code> is somewhat more
* complicated. The problem with <code>DialogBox</code> is that it uses a
* private panel and the <code>RoundedPanel</code> should be applied to this
* private <code>Panel</code>. To add the rounded corners to a
* <code>DialogBox</code> you have to rewrite the implementation of the
* <code>DialogBox</code>. For the <code>DialogBox</code> widget this can
* be done as follows. First create a new class like
* <code>RoundedDialogBox</code> and copy the code from the original
* <code>DialogBox</code> (Please take the copyright of this class into
* account). Next make the following changes to the code:
*
* <pre>
* // Private variable for RoundedPanel
* private RoundedPanel rp;
* </pre>
*
* In the constructor change:
*
* <pre>
* super.add(panel);
* </pre>
*
* into:
*
* <pre>
* rp = new RoundedPanel(panel);
* super.add(rp);
* </pre>
*
* Next change the style, otherwise the style of the dialog box is applied to
* the rounded lines too. Do this by changing the following line:
*
* <pre>
* setStyleName("gwt-DialogBox");
* </pre>
*
* into:
*
* <pre>
* panel.setStyleName("gwt-DialogBox");
* </pre>
*
* In your css add the color of the border, something like:
*
* <pre>
* .cbg-RP { background-color:#AAAAAA; }
* </pre>
*
* There seems to be a problem with the width under IE. The RoundedPanel divs
* don't follow the width of the dialog. To fix this change the
* <code>show</code> method as follows:
*
* <pre>
* public void show() {
* super.show();
* // (The width must be set after the super.show() otherwise it will be 0).
* // NOTE: As of GWT 1.1 the .getOffsetWidth() returns 0 at this point.
* // This is different with earlier versions of GWT. Disable the line will make
* // the rounded corners work in at least Firefox 1.5, but not in IE.
* // I'm looking into this issue.
* rp.setWidth(panel.getOffsetWidth() + "px");
* }
* </pre>
*
* Now by extending your own dialog class on this <code>RoundedDialogBox</code>
* instead of the original <code>DialogBox</code> you will have rounded
* corners around your dialog.
*
*
* @author Hilbrand Bouwkamp(hs@bouwkamp.com)
* @version 1.3
*/
public class RoundedPanel extends SimplePanel {
/**
* <code>TOPLEFT</code> top left rounded corner
*/
public final static int TOPLEFT = 1;
/**
* <code>TOPRIGHT</code> top right rounded corner
*/
public final static int TOPRIGHT = 2;
/**
* <code>BOTTOMLEFT</code> bottom left rounded corner
*/
public final static int BOTTOMLEFT = 4;
/**
* <code>BOTTOMRIGHT</code> bottom right rounded corner
*/
public final static int BOTTOMRIGHT = 8;
/**
* <code>BOTTOM</code> rounded corners at the top
*/
public final static int TOP = TOPLEFT | TOPRIGHT;
/**
* <code>TOP</code> rounded corners at the bottom
*/
public final static int BOTTOM = BOTTOMLEFT | BOTTOMRIGHT;
/**
* <code>LEFT</code> rounded corners on the left side
*/
public final static int LEFT = TOPLEFT | BOTTOMLEFT;
/**
* <code>RIGHT</code> rounded corners on the right side
*/
public final static int RIGHT = TOPRIGHT | BOTTOMRIGHT;
/**
* <code>ALL</code> rounded corners on all sides
*/
public final static int ALL = TOP | BOTTOM;
/**
* Default border style
*/
private final static String RPSTYLE = "cbg-RP";
/**
* Lookup table for corner border width
*/
private final static String[][] CORNERBORDER = {
{ "1px" }, { "1px", "1px"}, { "1px", "1px", "1px"},
{ "1px", "1px", "1px", "1px" }, { "1px", "1px", "1px", "2px", "1px" },
{ "1px", "1px", "1px", "1px", "2px", "1px" },
{ "1px", "1px", "1px", "1px", "1px", "2px", "1px" },
{ "1px", "1px", "1px", "1px", "1px", "2px", "2px", "1px" },
{ "1px", "1px", "1px", "1px", "1px", "1px", "2px", "3px", "1px" }};
/**
* Lookup table for corner height
*/
private final static String[][] CORNERHEIGHT = {
{ "1px" }, { "1px", "1px"}, { "1px", "1px", "1px"},
{ "1px", "1px", "1px", "1px" }, { "2px", "1px", "1px", "1px", "1px" },
{ "2px", "1px", "1px", "1px", "1px", "1px" },
{ "2px", "1px", "1px", "1px", "1px", "1px", "1px" },
{ "2px", "1px", "1px", "1px", "1px", "1px", "1px", "1px" },
{ "3px", "2px", "1px", "1px", "1px", "1px", "1px", "1px", "1px" }};
/**
* Lookup table for corner margin
*/
private final static String[][] CORNERMARGIN = {
{ "1px" }, { "1px", "2px" }, { "1px", "2px", "3px" },
{ "1px", "2px", "3px", "4px
没有合适的资源?快使用搜索试试~ 我知道了~
使用gwt实现的一个模式框
共133个文件
class:39个
java:24个
png:20个
需积分: 0 9 下载量 48 浏览量
2008-10-16
22:15:34
上传
评论
收藏 5.55MB RAR 举报
温馨提示
一个gwt实现的模式层框,实现了遮住下层,可以往该框中添加任何组件
资源详情
资源评论
资源推荐
收起资源包目录
使用gwt实现的一个模式框 (133个子文件)
62AC59A408817D3DC999C3CEA6172D53 23KB
9CDE8D467B9D6A44D724A9090296AFB3 24KB
RoundedPanel.class 6KB
MainPanel.class 5KB
FasterTree.class 4KB
MessageBox.class 4KB
TopPanel.class 4KB
GlassPanel.class 4KB
EmbeddedObject.class 4KB
EmbeddedObject$EmbeddedObjectInfo.class 3KB
MediaPlayerVideo.class 3KB
ShowModalDialog.class 2KB
ShowModalDialog$WindowResize.class 2KB
RealPlayerVideo.class 2KB
FasterTree$1.class 2KB
ShowModalDialog$MyDialog.class 2KB
GlassPanelImplIE6.class 2KB
FasterTree$2.class 2KB
RoundButton.class 1KB
TopPanel$3.class 1KB
MainPanel$4.class 1KB
MainPanel$3.class 1KB
TopPanel$2.class 1KB
TopPanel$1.class 1KB
MainPanel$5.class 1KB
GlassPanelImpl.class 1KB
MainPanel$1.class 1KB
MediaObject.class 1KB
GlassPanelImplMozilla.class 979B
GlassPanelImplSafari.class 965B
GlassPanel$1.class 833B
MainPanel$2.class 825B
TestPanel.class 812B
GlassPanel$2.class 803B
EduCourseware.class 765B
GlassPanelImplStandard.class 672B
GlassPanelImplOpera.class 513B
Images.class 360B
GwtStyle.class 217B
BaseUI.class 167B
EmbeddedAction.class 154B
.classpath 791B
EduCourseware-compile.cmd 270B
Applicationresources-i18n.cmd 218B
EduCourseware-shell.cmd 217B
gwt.css 5KB
gwt.css 5KB
gwt.css 4KB
D3D27B426EEAA198B861541BF62257AA 23KB
E0BC68F9B116AAF42BA820618C9B95CE 24KB
confirm.gif 1KB
confirm.gif 1KB
warning.gif 1KB
warning.gif 1KB
msgok.gif 1024B
msgok.gif 1024B
error.gif 1023B
error.gif 1023B
a9.gif 618B
a9.gif 618B
a9.gif 618B
treeClosed.gif 199B
treeClosed.gif 199B
treeOpen.gif 198B
treeOpen.gif 198B
bg_headergradient.gif 190B
bg_headergradient.gif 190B
selectionBar.gif 154B
selectionBar.gif 154B
clear.cache.gif 43B
3995B6759C8B789A582579AF4E9D5CE0.cache.html 25KB
3FC0AB0FC6C4C7A52C8E86664CA9DEA8.cache.html 25KB
D07142636C114009245A1F0182E94B5E.cache.html 24KB
8D1D087973502A8CBBDFE6BD1E00A345.cache.html 24KB
EduCourseware.html 1KB
EduCourseware.html 1KB
EduCourseware.html 1KB
hosted.html 1KB
hosted.html 641B
history.html 436B
gwt-incubator.jar 1.52MB
RoundedPanel.java 15KB
EmbeddedObject.java 10KB
FasterTree.java 5KB
MediaPlayerVideo.java 5KB
RealPlayerVideo.java 5KB
MainPanel.java 5KB
GlassPanel.java 5KB
ShowModalDialog.java 4KB
TopPanel.java 4KB
MessageBox.java 3KB
GlassPanelImplSafari.java 2KB
GlassPanelImplMozilla.java 2KB
GlassPanelImplIE6.java 2KB
GlassPanelImpl.java 2KB
MediaObject.java 1KB
GlassPanelImplStandard.java 1KB
GlassPanelImplOpera.java 1KB
RoundButton.java 1KB
EduCourseware.java 790B
共 133 条
- 1
- 2
wgmaxine
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0