本文整理了Java中org.zkoss.zul.Window
类的一些代码示例,展示了Window
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window
类的具体详情如下:
包路径:org.zkoss.zul.Window
类名称:Window
[英]A window.
Unlike other elements, each Window is an independent ID space (by implementing org.zkoss.zk.ui.IdSpace). It means a window and all its descendants forms a ID space and the ID of each of them is unique in this space. You could retrieve any of them in this space by calling #getFellow.
If a window X is a descendant of another window Y, X's descendants are not visible in Y's space. To retrieve a descendant, say Z, of X, you have to invoke Y.getFellow('X').getFellow('Z').
Events:
onMove, onOpen, onMaximize, onMinimize, and onClose.
Note: to have better performance, onOpen is sent only if a non-deferrable event listener is registered (see org.zkoss.zk.ui.event.Deferrable).
onMaximize
and onMinimize
are supported. (since 3.5.0)
onClose
is sent when the close button is pressed (if #isClosable is true). The window has to detach or hide the window. By default, #onClose detaches the window. To prevent it from detached, you have to call org.zkoss.zk.ui.event.Event#stopPropagationto prevent #onClose is called.
On the other hand, onOpen
is sent when a popup window (i.e., #getMode is popup) is closed due to user's activity (such as press ESC). This event is only a notification. In other words, the popup is hidden before the event is sent to the server. The application cannot prevent the window from being hidden.
Default #getZclass: z-window.(since 3.5.0)
[中]窗户。
与其他元素不同,每个窗口都是一个独立的ID空间(通过实现org.zkoss.zk.ui.IdSpace)。这意味着一个窗口及其所有子窗口构成一个ID空间,每个子窗口的ID在此空间中都是唯一的。您可以通过调用#getFellow来检索此空间中的任何一个。
如果一个窗口X是另一个窗口Y的后代,则X的后代在Y的空间中不可见。要检索X的后代,比如Z,必须调用Y.getFellow('X')。getFellow('Z')。
活动:
onMove、onOpen、onMaximize、onMinimize和onClose。
注意:为了获得更好的性能,只有在注册了不可延迟事件侦听器的情况下才会发送onOpen(请参见org.zkoss.zk.ui.event.deferrable)。
支持onMaximize
和onMinimize
。(从3.5.0开始)
按下关闭按钮时发送onClose
(如果#isClosable为真)。窗口必须分离或隐藏窗口。默认情况下,#onClose会分离窗口。为了防止它分离,你必须调用org。zkoss。zk。用户界面。事件调用事件#stopPropagationto prevent#onClose。
另一方面,当弹出窗口(即#getMode为popup)由于用户活动(如按ESC)而关闭时,onOpen
会被发送。此事件只是一个通知。换句话说,在事件发送到服务器之前,弹出窗口是隐藏的。应用程序无法防止窗口被隐藏。
默认#getZclass:z窗口。(从3.5.0开始)
代码示例来源:origin: org.zkoss.zk/zul
/** Sets the mode to overlapped, popup, modal, embedded or highlighted.
*
* @see #setMode(String)
*/
public void setMode(int mode) {
switch (mode) {
case POPUP:
doPopup();
break;
case OVERLAPPED:
doOverlapped();
break;
case EMBEDDED:
doEmbedded();
break;
case MODAL:
if (isEventThreadEnabled(false))
Events.postEvent(Events.ON_MODAL, this, null);
else
doModal();
break;
case HIGHLIGHTED:
doHighlighted();
break;
default:
throw new WrongValueException("Unknown mode: " + mode);
}
}
代码示例来源:origin: org.zkoss.zk/zul
/** Process the onClose event sent when the close button is pressed.
* <p>Default: detach itself.
*/
public void onClose() {
detach();
}
代码示例来源:origin: org.zkoss.zk/zul
public void onPageDetached(Page page) {
super.onPageDetached(page);
if (_mode == MODAL && getPage() == null)
leaveModal(OVERLAPPED);
}
代码示例来源:origin: org.zkoss.zk/zul
/**
* @param title the window title (see {@link #setTitle}).
* @param border the border (see {@link #setBorder}).
* @param closable whether it is closable (see {@link #setClosable}).
*/
public Window(String title, String border, boolean closable) {
this();
setTitle(title);
setBorder(border);
setClosable(closable);
}
代码示例来源:origin: org.zkoss.zk/zkmax
public void render(Component comp, Writer out) throws IOException {
final SmartWriter wh = new SmartWriter(out);
final Window self = (Window)comp;
final String uuid = self.getUuid();
final String zcls = self.getZclass();
wh.write(self.getOuterAttrs()).write(self.getInnerAttrs()).write(">");
final Caption caption = self.getCaption();
final String title = self.getTitle();
final boolean isFrame = !self.inEmbedded() && !self.inPopup();
final String noBorder = !"normal".equals(self.getBorder()) ? "-noborder" : "";
if (caption != null || title.length() > 0) {
wh.write("<div class=\"").write(zcls).write("-tl\"><div class=\"")
.write(uuid).write("!caption\" class=\"").write(zcls).write("-header\">");
if (caption == null) {
if (self.isClosable())
wh.write("<div id=\"").write(uuid).write("!close\" class=\"").write(zcls).write("-icon ").write(zcls).write("-close\"></div>");
if (self.isMaximizable()) {
wh.write("<div id=\"").write(uuid).write("!maximize\" class=\"").write(zcls).write("-icon ").write(zcls).write("-max");
if (self.isMaximized())
wh.write(" ").write(zcls).write("-maxd");
wh.write("\"></div>");
if (self.isMinimizable())
wh.write("<div id=\"").write(uuid).write("!minimize\" class=\"").write(zcls).write("-icon ").write(zcls).write("-min\"></div>");
new Out(title).render(out);
wh.write(self.getContentSclass()).write(" ").write(zcls).write("-cnt").write(noBorder);
wh.write("\"").writeAttr("style", self.getContentStyle());
代码示例来源:origin: org.carewebframework/org.carewebframework.vista.ui.context.encounter
/**
* Displays the encounter selection dialog.
*
* @param flags The encounter flags.
*/
public static void execute(EncounterFlag... flags) {
String resource = Constants.RESOURCE_PREFIX + "encounterSelection.zul";
Window dlg = (Window) FrameworkUtil.getAttribute(resource);
if (dlg == null || dlg.getPage() == null) {
dlg = PopupDialog.popup(resource, true, true, false);
FrameworkUtil.setAttribute(resource, dlg);
}
try {
EncounterSelection sel = ZKUtil.findChild(dlg, EncounterSelection.class);
sel.setEncounterFlags(EncounterFlag.flags(flags));
dlg.doModal();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: stackoverflow.com
@Listen("onClick = #reorderBtn")
public void onEditorOpen(Event e) {
Window win = (Window) Executions.createComponents("/lbMenu.zul", this.getSelf(), null);
win.doModal();
}
代码示例来源:origin: org.carewebframework/org.carewebframework.cal.ui.patientselection.v1
/**
* Handles a deferred request to show the dialog.
*
* @param event The onShow event.
* @throws Exception Unspecified exception.
*/
public void onShow(Event event) throws Exception {
root.removeAttribute(Constants.SELECTED_PATIENT_ATTRIB);
lstSearch.clearSelection();
onCheck$rgrpLists();
Events.echoEvent(Events.ON_FOCUS, root, null);
if (!root.inModal()) {
root.doModal();
}
}
代码示例来源:origin: org.carewebframework/org.carewebframework.cal.ui.patientselection.v1
@Override
public Patient select() {
Events.sendEvent("onShow", dlg, null);
return (Patient) dlg.getAttribute(Constants.SELECTED_PATIENT_ATTRIB);
}
};
代码示例来源:origin: org.carewebframework/org.carewebframework.rpms.ui.anticoag
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
record = (AntiCoagRecord) arg.get("record");
inputs = new Component[] { rgIndicated, cboGoal, cboMin, cboMax, cboDuration, datStart, wbProvider, txtComment };
loadComboValues();
Window win = (Window) root;
win.setTitle(StrUtil.formatMessage(win.getTitle(), record == null ? "Add" : "Edit"));
Events.postEvent("onInitDialog", comp, null);
}
代码示例来源:origin: stackoverflow.com
if (view instanceof Window) {
Window win = (Window) view;
PageCtrl pc = (PageCtrl) win.getPage();
pc.addBeforeHeadTags("<script type=\"text/javascript\">" + "(function(i,s,o,g,r,a,m)"
+ "{i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){"
+ "(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();" + "a=s.createElement(o),"
+ "m=s.getElementsByTagName(o)[0];" + "a.async=1;a.src=g;m.parentNode.insertBefore(a,m)" + "})"
+ "(window,document,'script','//www.google-analytics.com/analytics.js','ga');" + "ga('create', "
+ this.trackingID + ", 'auto'); " + "ga('send', 'pageview');" + "</script>");
} else {
throw new UiException("This view model must be applied from a Window component.");
}
代码示例来源:origin: org.carewebframework/org.carewebframework.rpms.ui.core
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
Iterator<Object> params = getParameters();
lookupParams = new LookupParams((Table) params.next());
((Window) comp).setTitle("Lookup " + lookupParams.getTableName());
String searchText = (String) params.next();
autoReturn = (Boolean) params.next();
screen = (String) params.next();
if (screen == null) {
screen = lookupParams.getScreen();
}
txtSearch.setText(searchText);
if (lookupParams.getRpc() == null) {
close(true);
}
initHeaders();
}
代码示例来源:origin: org.zkoss.zk/zul
private void afterUnmarshal() {
for (Iterator<Component> it = getChildren().iterator(); it.hasNext();) {
final Object child = it.next();
if (child instanceof Caption) {
_caption = (Caption) child;
break;
}
}
}
代码示例来源:origin: org.carewebframework/org.carewebframework.rpms.ui.core
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
String[] subsets = (String[]) arg.get("subsets");
TermSubset termSubsets = TermUtil.getSubset(null);
for (String subset : subsets) {
Listitem item = new Listitem(termSubsets.getMemberName(subset));
item.setValue(subset);
lbSubset.appendChild(item);
}
if (subsets.length == 1) {
pnlSubset.setVisible(false);
lbSubset.setSelectedIndex(0);
((Window) root).getCaption().setLabel(lbSubset.getSelectedItem().getLabel());
}
treeSearch.setItemRenderer(termMatchRenderer);
}
代码示例来源:origin: org.carewebframework/org.carewebframework.vista.ui.encounter
/**
* Displays the encounter selection dialog.
*
* @param flags The encounter flags.
*/
public static void execute(EncounterFlag... flags) {
try {
Window dlg = (Window) FrameworkUtil.getAttribute(SELECTION_DIALOG);
if (dlg == null || dlg.getPage() == null) {
dlg = PopupDialog.popup(SELECTION_DIALOG, true, true, false);
FrameworkUtil.setAttribute(SELECTION_DIALOG, dlg);
}
MainController sel = (MainController) getController(dlg);
sel.setEncounterFlags(EncounterFlag.flags(flags));
if (sel.needsInit) {
sel.init();
}
dlg.doModal();
} catch (Exception e) {
FrameworkUtil.setAttribute(SELECTION_DIALOG, null);
throw MiscUtil.toUnchecked(e);
}
}
代码示例来源:origin: org.zkoss.zk/zul
/** Process the onModal event by making itself a modal window.
*/
public void onModal() {
doModal();
}
代码示例来源:origin: org.carewebframework/org.carewebframework.rpms.ui.anticoag
public static AntiCoagRecord show(AntiCoagRecord record) {
Map<Object, Object> args = new HashMap<Object, Object>();
args.put("record", record);
return (AntiCoagRecord) PopupDialog.popup(DIALOG, args, false, false, true).getAttribute(ATTR_RESULT);
}
代码示例来源:origin: org.zkoss.zk/zul
doPopup();
else if ("overlapped".equals(name))
doOverlapped();
else if ("embedded".equals(name))
doEmbedded();
else if ("modal".equals(name)) {
if (isEventThreadEnabled(false))
Events.postEvent(Events.ON_MODAL, this, null);
else
doModal();
} else if ("highlighted".equals(name))
doHighlighted();
else
throw new WrongValueException("Unknown mode: " + name);
代码示例来源:origin: org.carewebframework/org.carewebframework.cal.ui.reporting
/**
* Show detail for specified list item.
*
* @param li The list item.
*/
protected void showDetail(Listitem li) {
@SuppressWarnings("unchecked")
M modelObject = li == null ? null : (M) li.getValue();
String detail = modelObject == null ? null : getDetail(modelObject);
if (!StringUtils.isEmpty(detail)) {
if (getShowDetailPane()) {
detailView.setContent(detail);
} else {
Map<Object, Object> map = new HashMap<Object, Object>();
map.put("title", detailTitle);
map.put("content", detail);
map.put("allowPrint", getAllowPrint());
try {
((Window) ZKUtil.loadZulPage(Constants.RESOURCE_PREFIX + "resourceListDetail.zul", null, map)).doModal();
} catch (Exception e) {
PromptDialog.showError(e);
}
}
}
}
代码示例来源:origin: stackoverflow.com
@Command
public void test(@BindingParam("cmp") Window x) {
x.detach();
}
内容来源于网络,如有侵权,请联系作者删除!