protected void alert(String m) { if ("ajax".equals(Executions.getCurrent().getDesktop().getDeviceType())) { //zk.jar cannot depends on zul.jar; thus we call Messagebox.show() via //reflection. try { if (_alert == null) { final Class<?> mboxcls = Classes.forNameByThread("org.zkoss.zul.Messagebox"); _alert = mboxcls.getMethod("show", new Class<?>[] { String.class }); } _alert.invoke(null, new Object[] { m }); return; //done } catch (Throwable ex) { log.debug("Failed to invoke org.zkoss.zul.Messagebox", ex); //Ignore } } org.zkoss.zk.ui.util.Clients.alert(m); }
wapp = desktop.getWebApp(); if (deviceType == null) deviceType = desktop != null ? desktop.getDeviceType() : "ajax";
wapp = exec.getDesktop().getWebApp(); if (deviceType == null) deviceType = exec.getDesktop().getDeviceType();
final String errpg = desktop.getWebApp().getConfiguration().getErrorPage(desktop.getDeviceType(), err); if (errpg != null) { try {
final Desktop desktop = exec.getDesktop(); final Configuration config = desktop.getWebApp().getConfiguration(); final String location = config.getErrorPage(desktop.getDeviceType(), err); if (location != null) { try {
public void setDefinition(String name) { final Execution exec = Executions.getCurrent(); if (exec != null) { final ExecutionCtrl execCtrl = (ExecutionCtrl) exec; final PageDefinition pgdef = execCtrl.getCurrentPageDefinition(); final Page page = execCtrl.getCurrentPage(); ComponentDefinition compdef = pgdef != null ? pgdef.getComponentDefinition(name, true) : page != null ? page.getComponentDefinition(name, true) : null; if (compdef == null) compdef = Impls.getDefinitionByDeviceType(this, exec.getDesktop().getDeviceType(), name); if (compdef != null) { setDefinition(compdef); return; } } else { for (String deviceType : LanguageDefinition.getDeviceTypes()) { final ComponentDefinition compdef = Impls.getDefinitionByDeviceType(this, deviceType, name); if (compdef != null) { setDefinition(compdef); return; } } } throw new ComponentNotFoundException(name + " not found"); }
/** Returns the component definition of the specified class, or null * if not found. */ /*package*/ static ComponentDefinition getDefinition(Execution exec, Class<? extends Component> cls) { if (exec != null) { final ExecutionCtrl execCtrl = (ExecutionCtrl) exec; final PageDefinition pgdef = execCtrl.getCurrentPageDefinition(); final Page page = execCtrl.getCurrentPage(); final ComponentDefinition compdef = pgdef != null ? pgdef.getComponentDefinition(cls, true) : page != null ? page.getComponentDefinition(cls, true) : null; if (compdef != null && compdef.getLanguageDefinition() != null) return compdef; //already from langdef (not from pgdef) final ComponentDefinition compdef2 = Components.getDefinitionByDeviceType(exec.getDesktop().getDeviceType(), cls); return compdef != null && (compdef2 == null || !Objects.equals(compdef.getImplementationClass(), compdef2.getImplementationClass())) ? compdef : compdef2; //Feature 2816083: use compdef2 if same class } for (String deviceType : LanguageDefinition.getDeviceTypes()) { final ComponentDefinition compdef = Components.getDefinitionByDeviceType(deviceType, cls); if (compdef != null) return compdef; } return null; }