18 package org.turro.zul.frame;
21 import org.turro.about.AboutTurro;
22 import org.turro.action.Plugins;
23 import org.turro.auth.Authentication;
24 import org.turro.command.Command;
25 import org.turro.command.CommandUtil;
26 import org.turro.elephant.context.Application;
27 import org.turro.elephant.context.ElephantContext;
28 import org.turro.elephant.zkoss.Modal;
29 import org.turro.i18n.I_;
30 import org.turro.menu.ElephantMenuBar;
31 import org.turro.menu.ElephantStatusBar;
32 import org.turro.menu.ElephantToolbar;
33 import org.turro.zul.portal.PortalContainer;
34 import org.turro.zul.portal.PortalWindows;
35 import org.zkoss.zk.ui.Executions;
36 import org.zkoss.zk.ui.ext.AfterCompose;
37 import org.zkoss.zk.ui.sys.PageCtrl;
38 import org.zkoss.zk.ui.util.Clients;
39 import org.zkoss.zul.*;
45 public class Framework extends Div implements AfterCompose {
52 private Borderlayout layout;
57 private Popup globalPopup;
62 Executions.getCurrent().getDesktop().setAttribute(
"el_framework",
this);
73 public void addContent(String label, String src, Map<String, Object> dynProps) {
78 this.container.addContent(container);
82 Tabpanel tp = container.getSelectedPanel();
83 if(tp !=
null) tp.setAttribute(key, value);
87 Tabpanel tp = container.getSelectedPanel();
88 return tp !=
null ? tp.getAttribute(key) :
null;
92 return panel !=
null ? panel.getAttribute(key) :
null;
111 public void showModal(String label, String src, Map arg, Command command) {
112 showModal(label, (Window) Executions.createComponents(src,
null, arg), command);
115 public void showModal(String label, Window window, Command command) {
116 window.setTitle(label);
117 window.setMode(Window.MODAL);
121 public void showPopup(String label, String src, Map arg) {
122 Window w = (Window) Executions.createComponents(src,
null, arg);
124 w.setPosition(
"center");
129 return portalWindows;
133 globalPopup.getChildren().clear();
141 private void addComponents() {
142 layout =
new Borderlayout();
145 North north =
new North();
146 north.setSclass(
"bbframetop");
147 layout.appendChild(north);
148 Vlayout vbox =
new Vlayout();
149 vbox.setSpacing(
"0px");
151 north.appendChild(vbox);
153 toolBar.setVflex(
"1");
155 vbox.appendChild(menuBar);
156 vbox.appendChild(toolBar);
158 Center center =
new Center();
159 center.setSclass(
"bbframecenter");
160 layout.appendChild(center);
162 center.appendChild(container);
164 South south =
new South();
165 south.setSclass(
"bbframebottom");
166 layout.appendChild(south);
168 south.appendChild(statusBar);
170 globalPopup =
new Popup();
171 appendChild(globalPopup);
180 I_.
get(
"BrightSide Application Framework"));
181 if(getPage() instanceof PageCtrl) {
182 ((PageCtrl) getPage()).addBeforeHeadTags(
183 "<link rel=\"shortcut icon\" href=\"" +
185 "\" type=\"image/x-icon\">");
188 Map<String, Object> args =
Plugins.
execute(
"CurrentCompany",
null);
190 statusBar.
setStatus(AboutTurro.getAbout(getPage()));
191 Clients.evalJavaScript(
192 "window.onbeforeunload = confirmExit;\n" +
193 "var exitWanted=false;\n" +
194 "function confirmExit() {\n" +
195 " if(!exitWanted) {" +
196 " return \"BrightSide Application Framework - Fundació TiC\";\n" +
208 return Executions.getCurrent().getDesktop().getAttribute(
object.getClass().getSimpleName() +
"_" + key);
211 public static Object
getAttribute(Object
object, String key, Object defaultValue) {
212 Object value = Executions.getCurrent().getDesktop().getAttribute(
object.getClass().getSimpleName() +
"_" + key);
213 return value ==
null ? defaultValue : value;
216 public static void setAttribute(Object
object, String key, Object value) {
217 Executions.getCurrent().getDesktop().setAttribute(
object.getClass().getSimpleName() +
"_" + key, value);
221 if(clipboard ==
null) {
static Map< String, Object > execute(String name, Map params)
static IContact getIContact()
static HtmlBasedComponent getLinkOrSpace(Object entity)
static Application getApplication()
static String getSiteName()
static String getSiteIcon()
static int doModal(String file)
static String get(String msg)
void setSelectedTooltiptext(String text)
void addContent(String label, String src)
void invalidateSelected()
void setSelectedLabel(String text)
static FrameClipboard getClipboard()
void addContent(String label, String src)
void showPopup(String label, String src, Map arg)
static Object getAttribute(Object object, String key)
static Framework getCurrent()
void setSelectedLabel(String text)
void invalidateSelected()
static Object getAttribute(Object object, String key, Object defaultValue)
void showModal(String label, String src, Map arg, Command command)
ElephantStatusBar getStatusBar()
Object getAttributeFrom(Tabpanel panel, String key)
static void setAttribute(Object object, String key, Object value)
void addContent(String label, String src, Map< String, Object > dynProps)
void setSelectedTooltiptext(String text)
PortalWindows getPortalWindows()
Object getSelectedAttribute(String key)
void addContent(PortalContainer container)
void showModal(String label, Window window, Command command)
void setSelectedAttribute(String key, Object value)