org.zkoss.zk.ui.Desktop.getId()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(136)

本文整理了Java中org.zkoss.zk.ui.Desktop.getId()方法的一些代码示例,展示了Desktop.getId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Desktop.getId()方法的具体详情如下:
包路径:org.zkoss.zk.ui.Desktop
类名称:Desktop
方法名:getId

Desktop.getId介绍

[英]Returns ID of this desktop. It is unique in the whole session.
[中]返回此桌面的ID。这在整个会议中是独一无二的。

代码示例

代码示例来源:origin: org.zkoss.zk/zk

/**
 * @param evtnm the event name to echo back
 * @param data the data to sent with the event when echoed back
 * @param dt the desktop to receive the event.
 */
public AuEchoGlobal(String evtnm, String data, Desktop dt) {
  super("echoGx", new String[] { evtnm, data, dt.getId() });
}

代码示例来源:origin: org.carewebframework/org.carewebframework.ext.performance

/**
 * Creates a new performance data instance associated with the specified desktop.
 * 
 * @param desktop desktop.
 */
public PerformanceData(Desktop desktop) {
  desktopId = desktop.getId();
}

代码示例来源:origin: org.zkoss.zk/zk

/** Constructs an echo response with the specified desktop.
 *
 * @param desktop the desktop to send the echo response to.
 * If null, the echo response is sent to each desktop in the
 * same browser window.
 * @since 3.0.0
 */
public AuEcho(Desktop desktop) {
  super("echo", desktop != null ? desktop.getId() : null);
}

代码示例来源:origin: org.zkoss.zk/zk

/** Constructs a client-info response with the specified desktop.
 *
 * @param desktop the desktop to get the client info back.
 * If null, the client info is sent back for each desktop in the
 * same browser window.
 * @since 3.0.0
 */
public AuClientInfo(Desktop desktop) {
  super("clientInfo", desktop != null ? desktop.getId() : null);
}

代码示例来源:origin: org.zkoss.zats/zats-mimic

public String getId() {
  return desktop.getId();
}

代码示例来源:origin: org.zkoss.zk/zk

private static String[] toArray(String evtnm, String data, Collection<Desktop> dts) {
    final List<String> l = new LinkedList<String>();
    l.add(evtnm);
    l.add(data);
    for (Desktop desktop : dts)
      l.add(desktop.getId());
    return l.toArray(new String[l.size()]);
  }
}

代码示例来源:origin: org.zkoss.zk/zk

public void addDesktop(Desktop desktop) {
  //final boolean added;
  final Desktop old;
  synchronized (_desktops) {
    old = _desktops.put(desktop.getId(), desktop);
  }
  if (old != null) {
    _desktops.put(old.getId(), old); //recover
    if (log.isWarnEnabled()) {
      log.warn(desktop == old ? "Register a desktop twice: " + desktop
          : "Replicated ID: " + desktop + "; already used by " + old);
    }
  }
  //if (log.isDebugEnabled()) log.debug("After added, desktops: "+_desktops);
}

代码示例来源:origin: org.zkoss.zk/zk

/** Handles the (client and) server start of load request
 * for the performance measurement.
 *
 * @return the request ID
 */
private static String meterLoadStart(PerformanceMeter pfmeter, Execution exec, long startTime) {
  //Future: handle the zkClientStart parameter
  final String pfReqId = exec.getDesktop().getId();
  try {
    pfmeter.requestStartAtServer(pfReqId, exec, startTime);
  } catch (Throwable ex) {
    log.warn("Ingored: failed to invoke " + pfmeter, ex);
  }
  return pfReqId;
}

代码示例来源:origin: org.zkoss.zk/zk

public void removeDesktop(Desktop desktop) {
  final boolean oldexp = _desktops.disableExpunge(true);
  try {
    final Desktop old;
    synchronized (_desktops) {
      old = _desktops.remove(desktop.getId());
    }
    if (old == null)
      log.warn("Removing non-existent desktop: " + desktop);
    else
      desktopDestroyed(desktop);
  } finally {
    _desktops.disableExpunge(oldexp);
  }
}

代码示例来源:origin: org.zkoss.zk/zkex

/* package */OperationThread(Desktop desktop) {
  _desktop = desktop;
  _queue = new OperationQueue();
  this.setName("OPThread-" + desktop.getId());
}

代码示例来源:origin: org.zkoss.zk/zkex

/** Sets the delay between each polling request.
 * <p>Default: use the preference called
 * <code>PollingServerPush.delay.min</code>
 * <code>PollingServerPush.delay.max</code>,
 * and <code>PollingServerPush.delay.factor</code>.
 * If not defined, min is 1000, max is 15000, and factor is 5.
 */
public void setDelay(int min, int max, int factor) {
  Clients.response(
    new AuScript(null, "zkau.setSPushInfo('" + _desktop.getId()
      + "',{min:" + min + ",max:" + max + ",factor:" + factor + "})"));
}

代码示例来源:origin: org.carewebframework/org.carewebframework.security.spring.core

/**
 * Remove desktop security context on desktop cleanup.
 */
@Override
public void onCleanup(Desktop desktop) {
  HttpSession session = (HttpSession) desktop.getSession().getNativeSession();
  session.removeAttribute(getDesktopContextKey(desktop.getId()));
}

代码示例来源:origin: org.zkoss.zk/zkplus

/** Returns the result in the JavaScript.
 * The caller shall send it back and evaluate it at the client (<code>eval(jscode);</code>).
 * <p>After calling this method, the caller shall not modify the component's state any more.
 */
public String getResult() {
  final Desktop desktop = _exec.getDesktop();
  try {
    JSONArray result = ((WebAppCtrl) desktop.getWebApp()).getUiEngine().finishUpdate(_updctx);
    return new StringBuffer(512).append("zAu.doCmds('").append(desktop.getId()).append("',")
        .append(result.toString()).append(");").toString();
  } catch (Exception ex) { //not possible
    throw UiException.Aide.wrap(ex);
  }
}

代码示例来源:origin: org.carewebframework/org.carewebframework.security.spring.core

/**
 * Given a desktop, returns Spring security context object.
 * 
 * @param desktop The desktop whose security context is sought.
 * @return SecurityContext The Spring security context.
 */
public static SecurityContext getSecurityContext(Desktop desktop) {
  String key = getDesktopContextKey(desktop.getId());
  HttpSession session = (HttpSession) desktop.getSession().getNativeSession();
  return (SecurityContext) session.getAttribute(key);
}

代码示例来源:origin: org.zkoss.zk/zkmax

/** Returns the JavaScript codes to disable (aka., stop) the server push.
 * It is called by {@link #stopClientPush} to prepare the script
 * of {@link AuScript} that will be sent to the client.
 */
protected String getStopScript() {
  final String stop = _desktop.getWebApp().getConfiguration()
    .getPreference("CometServerPush.stop", null);
  return stop != null ? stop:
    "zkCmsp.stop('" + _desktop.getId() + "');";
}

代码示例来源:origin: org.carewebframework/org.carewebframework.security.spring.core

/**
 * Force transfer of session-based security context to desktop.
 */
@Override
public void onInit(Desktop desktop) {
  HttpSession session = (HttpSession) desktop.getSession().getNativeSession();
  getSecurityContext(session, desktop.getId());
}

代码示例来源:origin: org.zkoss.zk/zk

/** Returns the JavaScript codes to disable (a.k.a., stop) the server push.
 * It is called by {@link #stopClientPush} to prepare the script
 * of {@link AuScript} that will be sent to the client.
 */
protected String getStopScript() {
  final String stop = _desktop.getWebApp().getConfiguration().getPreference("PollingServerPush.stop", null);
  return stop != null ? stop : "zk.cpsp.stop('" + _desktop.getId() + "');";
}

代码示例来源:origin: org.zkoss.zk/zkex

/** Returns the JavaScript codes to disable (aka., stop) the server push.
 * It is called by {@link #stopClientPush} to prepare the script
 * of {@link AuScript} that will be sent to the client.
 */
protected String getStopScript() {
  final String stop = _desktop.getWebApp().getConfiguration()
    .getPreference("PollingServerPush.stop", null);
  return stop != null ? stop:
    "zkCpsp.stop('" + _desktop.getId() + "');";
}

代码示例来源:origin: org.zkoss.zk/zkmax

/** Returns the JavaScript codes to enable (aka., start) the server push.
 * It is called by {@link #startClientPush} to prepare the script
 * of {@link AuScript} that will be sent to the client.
 */
protected String getStartScript() {
  final String start = _desktop.getWebApp().getConfiguration()
    .getPreference("CometServerPush.start", null);
  if (start != null)
    return start;
  final String dtid = _desktop.getId();
  return "zk.invoke('zkmax.ui.cmsp',function(){zkCmsp.start('"
    + dtid + "');},'" + dtid + "');";
}
/** Returns the JavaScript codes to disable (aka., stop) the server push.

代码示例来源:origin: org.zkoss.zk/zkmax

public void render(Component comp, Writer out) throws IOException {
  final SmartWriter wh = new SmartWriter(out);
  final Fileupload self = (Fileupload) comp;
  final String uuid = self.getUuid();
  final Execution exec = Executions.getCurrent();
  wh.write("<div id=\"").write(uuid).write("\"");
  wh.write(self.getOuterAttrs()).write(self.getInnerAttrs()).write(">");
  String hgh = self.getNumber() > 3 ? (self.getNumber() * 16 + 30) + "pt" : "";
  wh.write("<iframe style=\"width:100%;height:").write(hgh)
   .write("\" frameborder=\"0\" src=\"")
   .write(exec.encodeURL("~./zul/html/fileupload.html.dsp"))
   .write("?dtid=").write(self.getDesktop().getId()).write("&amp;uuid=")
   .write(uuid).write("&amp;max=").write(Integer.toString(self.getNumber()))
   .write("&amp;native=").write(self.isNative()).writeln("\">")
   .write("</iframe></div>");
}

相关文章