📄 rowlayoutsample.java
字号:
/*
* GWT-Ext Widget Library
* Copyright 2007 - 2008, GWT-Ext LLC., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package com.gwtext.sample.showcase2.client.layout;
import com.gwtext.client.core.EventObject;
import com.gwtext.client.widgets.Button;
import com.gwtext.client.widgets.Component;
import com.gwtext.client.widgets.ComponentMgr;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
import com.gwtext.client.widgets.layout.FitLayout;
import com.gwtext.client.widgets.layout.RowLayout;
import com.gwtext.client.widgets.layout.RowLayoutData;
import com.gwtext.sample.showcase2.client.ShowcasePanel;
public class RowLayoutSample extends ShowcasePanel {
public String getSourceUrl() {
return "source/layout/RowLayoutSample.java.html";
}
public Panel getViewPanel() {
if (panel == null) {
panel = new Panel();
panel.setLayout(new FitLayout());
final Panel wrapperPanel = new Panel();
wrapperPanel.setLayout(new RowLayout());
wrapperPanel.setBorder(true);
wrapperPanel.setBodyStyle("border-style:dotted;border-color:blue;");
Panel firstPanel = new Panel();
firstPanel.setTitle("My Height is 75px");
firstPanel.setClosable(true);
final Button removeGreedyButton = new Button("Remove Greedy Panel", new ButtonListenerAdapter() {
public void onClick(Button button, EventObject e) {
wrapperPanel.remove("greedy");
button.disable();
}
});
final Button showHideButton = new Button("Show / Hide Bottom Panel", new ButtonListenerAdapter() {
public void onClick(Button button, EventObject e) {
Component b = ComponentMgr.getComponent("bottom");
b.setVisible(!b.isVisible());
}
});
firstPanel.add(showHideButton);
firstPanel.add(removeGreedyButton);
wrapperPanel.add(firstPanel, new RowLayoutData(75));
Panel secondPanel = new Panel();
secondPanel.setTitle("I will take half of the free space!");
secondPanel.setHtml(" I am greedy <br><br><br><br><br><br><br><br><br><br><br><br><br><br>" +
"<br><br><br><br>...");
secondPanel.setId("greedy");
secondPanel.setCollapsible(true);
secondPanel.setAutoScroll(true);
secondPanel.setBodyStyle("margin-bottom:10px");
wrapperPanel.add(secondPanel, new RowLayoutData("50%"));
Panel third = new Panel();
third.setTitle("I'll take some too");
third.setHtml("..if you don't mind. I don't have a <tt>height</tt> in the config.<br>Btw, " +
"you can resize me!<br><br><br><br><br><br><br><br><br><br><br><br><br>" +
"<br><br><br><br><br>...");
third.setId("panel3");
third.setAutoScroll(true);
wrapperPanel.add(third);
Panel fourth = new Panel();
fourth.setId("slider");
wrapperPanel.add(fourth, new RowLayoutData(5));
Panel fifth = new Panel();
fifth.setTitle("Let me settle too");
fifth.setHtml("Since there are two of us without <tt>height</tt> given, each will take 1/2 " +
"of the unallocated space (which is 50%), that's why my height initially is 25%." +
"<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>...");
fifth.setAutoScroll(true);
wrapperPanel.add(fifth);
Panel sixth = new Panel();
sixth.setTitle("I'm the panel with height in pixels too");
sixth.setHtml("Nothing special, 60px panel");
sixth.setId("bottom");
wrapperPanel.add(sixth, new RowLayoutData(60));
panel.add(wrapperPanel);
}
return panel;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -