示例#1
0
文件: Treechildren.java 项目: dije/zk
    public Set<? extends Component> getAvailableAtClient() {
      if (!isCropper()) return null;

      final Tree tree = getTree();
      final Component parent = getParent();
      final Execution exe = Executions.getCurrent();
      final String attrnm = VISIBLE_ITEM + tree.getUuid();
      Map<Treeitem, Boolean> map = cast((Map) exe.getAttribute(attrnm));
      if (map == null) {
        // Test very simple case first since getVisibleItems costly
        if (parent instanceof Treeitem) {
          for (Treeitem ti = (Treeitem) parent; ; ) {
            if (!ti.isOpen()) return Collections.emptySet();
            Component gp = ti.getParent().getParent();
            if (!(gp instanceof Treeitem)) break;
            ti = (Treeitem) gp;
          }
        }

        map = tree.getVisibleItems();
        Executions.getCurrent().setAttribute(attrnm, map);
      }
      return map.keySet();
      // yes, we return all visible items, not just direct children
      // in other words, we consider the whole tree as a single scope
      // See also bug 2814504
    }
示例#2
0
  /**
   * @type Metodo de la clase IActionGrid.java
   * @name getParameterMap
   * @desc este metodo debe definir en su implementacion la funcionalidad requerida para mostrar los
   *     detalles de un DTO
   */
  @SuppressWarnings("unchecked")
  public void getParameterMap() {
    log.info("Ejecutando el metodo[getParameterMap]");
    if (Executions.getCurrent().getArg().size() != 0)
      this.parametros = (Map<String, Object>) Executions.getCurrent().getArg();

    if (parametros.containsKey("ESTADO_EDICION"))
      this.estadoEditar = (Boolean) this.parametros.get("ESTADO_EDICION");

    if (parametros.containsKey("ESTADO_REGISTRO"))
      this.estadoAgregar = (Boolean) this.parametros.get("ESTADO_REGISTRO");
  }
示例#3
0
  private void doLogout() {

    UserCredentialManager mgmt = UserCredentialManager.getIntance();
    if (mgmt.isAuthenticated()) {
      // remove it from session
      HttpSession hSess =
          (HttpSession)
              ((HttpServletRequest) Executions.getCurrent().getNativeRequest()).getSession();
      hSess.removeAttribute("user");
    }

    mgmt.logOff();
    Executions.getCurrent().sendRedirect("/login.zul");
  }
示例#4
0
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public void doInit(Page page, Map arg) throws Exception {

		if (!LoginManager.getIntance().isAuthenticated()) {
			Executions.getCurrent().sendRedirect("login.zul");
		}
		String zulPath = page.getRequestPath();
		if (zulPath.contains("/")){
			zulPath = zulPath.replaceAll("\\/", "");
		}
		
		if (!LoginManager.getIntance().isRight(zulPath)){
			Executions.getCurrent().sendRedirect("accessdenied.zul");
		}
		 
	}
示例#5
0
  @AfterCompose
  public void doAfterCompose(@ContextParam(ContextType.VIEW) Component view) throws Exception {

    Selectors.wireComponents(view, this, false);

    String id = Executions.getCurrent().getParameter("id");

    if (id != null) {
      Date currentDate = Calendar.getInstance().getTime();
      bandinfoMonth.setDate(currentDate);
      bandinfoYear.setDate(currentDate);

      Project Project = (Project) new WorkWithProject().getEntity(new Integer(id));

      discrName = "Для проекта: " + Project.getName();

      ParseCorrection parseCorrection = new ParseCorrection();
      Object[] o = Project.getCorrectionsProject().toArray();

      CorrectionsProject[] cor = new CorrectionsProject[o.length];

      for (int i = 0; i < o.length; i++) cor[i] = (CorrectionsProject) o[i];

      parseCorrection.getModelByCorrection(cor);

      bandinfoMonth.setModel(parseCorrection.getModelByCorrection(cor));
      bandinfoYear.setModel(parseCorrection.getModelByCorrection(cor));

      setDataInChart();
    }
  }
 public void onInit() throws Exception {
   try {
     View view = Toolkit.getToolkit().getSvdbView(Executions.getCurrent().getDesktop());
     if (!view.isAdmin()) { // 非管理员用户
       IniFile userIniFile = view.getUserIni();
       String addTopN_str =
           userIniFile.getValue(userIniFile.getSections(), UserRightId.DoTopNReportlistAdd);
       String deleteTopN_str =
           userIniFile.getValue(userIniFile.getSections(), UserRightId.DoTopNReportlistDel);
       String editTopN_str =
           userIniFile.getValue(userIniFile.getSections(), UserRightId.DoStatisticReportlistEdit);
       if (!"1".equals(addTopN_str)) {
         addTopN.setDisabled(true);
       }
       if (!"1".equals(deleteTopN_str)) {
         delete.setDisabled(true);
       }
       if (!"1".equals(editTopN_str)) {
         editFlag = false;
       }
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
示例#7
0
  public void newAssociationConcept() {
    logger.debug("createConcept()");

    Map<String, Object> data = new HashMap<String, Object>();

    data.put("EditMode", PopupAssociationConcept.EDITMODES.CREATE);

    /*if (codeSystemVersionId > 0)
    data.put("ContentMode", PopupConcept.CONTENTMODE.CODESYSTEM);
    else if (valueSetVersionId > 0)
    data.put("ContentMode", PopupConcept.CONTENTMODE.VALUESET);*/
    // data.put("CodeSystemId", codeSystemId);
    // data.put("ValueSetId", valueSetId);
    try {
      Window w =
          (Window)
              Executions.getCurrent()
                  .createComponents("/gui/main/modules/PopupAssociationConcept.zul", null, data);
      ((PopupAssociationConcept) w).setUpdateListener(this);

      w.doModal();
    } catch (Exception e) {
      LoggingOutput.outputException(e, this);
    }
  }
/** @author APronchakov */
public class LoginController extends Window {

  HttpServletRequest httpServletRequest =
      (HttpServletRequest) Executions.getCurrent().getNativeRequest();

  public boolean isLogged() {
    return httpServletRequest.getUserPrincipal() != null ? true : false;
  }

  public void doLogin(String username, String password) {
    Form form = new Form();
    form.setDynamicProperty("action", "j_security_check");
    form.setDynamicProperty("method", "post");

    form.setPage(this.getPage());

    createInput(form, "hidden", "j_username", username);
    createInput(form, "hidden", "j_password", password);

    Clients.submitForm(form);
  }

  private void createInput(Form form, String type, String name, String value) {
    Input input = new Input();
    input.setParent(form);
    input.setDynamicProperty("type", type);
    input.setDynamicProperty("name", name);
    input.setValue(value);
  }
}
 @Override
 public void setCurrentUrl(final String currentUrl) {
   final HttpServletRequest httpServletRequest =
       (HttpServletRequest) Executions.getCurrent().getNativeRequest();
   this.currentUrl = UrlUtils.extractHostInformationFromRequest(httpServletRequest, currentUrl);
   getViewModel().setCurrentUrl(this.currentUrl);
 }
示例#10
0
 private AsyncListenerThread(EventQueue<T> que, ListenerInfo<T> inf, T event) {
   _desktop = Executions.getCurrent().getDesktop();
   _que = que;
   _inf = inf;
   _event = event;
   Threads.setDaemon(this, true);
 }
示例#11
0
  /** 批量删除topN报告 */
  public void onClick$delete(Event event) {
    if (topNList.getSelectedCount() <= 0) {
      try {
        Messagebox.show("请选择报告!", "提示", Messagebox.OK, Messagebox.INFORMATION);
      } catch (InterruptedException e) {
      }
      return;
    }
    try {
      int ret =
          Messagebox.show(
              "你确认要删除选中的记录吗?", "询问", Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
      if (ret == Messagebox.CANCEL) return;
      Set<Listitem> items = topNList.getSelectedItems();
      if (items == null || items.size() == 0) return;
      Iterator itr = items.iterator();
      this.iniFile = new IniFile(INI_FILE);
      if (iniFile == null) return;
      for (; itr.hasNext(); ) {
        Listitem item = (Listitem) itr.next();
        iniFile.deleteSection(item.getId());
        IniFile iniGen = new IniFile("reportTopN." + item.getId() + ".ini");
        try {
          iniGen.load();
        } catch (Exception e) {

        }
        List<String> sections = iniGen.getSectionList();
        for (String section : sections) {
          if (section.equalsIgnoreCase("TempSection(Please_modify_it)")) continue;
          Map<String, String> value = iniGen.getFmap().get(section);
          String fileType = value.get("fileType");
          String filePath = TopNLogListmodel.getfilename(section, fileType);
          File f = new File(filePath);
          if (!f.exists()) continue;
          f.delete();
          if (fileType.equals("html")) {
            f.delete();
            Toolkit.getToolkit().deleteFolder(filePath + "_files");
          }
          iniGen.deleteSection(section);
        }
        iniGen.saveChange();
      }

      iniFile.saveChange(); // 1252396986281
    } catch (Exception e) {
      e.printStackTrace();
    }
    View view = Toolkit.getToolkit().getSvdbView(Executions.getCurrent().getDesktop());
    String loginname = view.getLoginName();
    String minfo =
        loginname + " " + "在" + OpObjectId.topn_report.name + "中进行了  " + OpTypeId.del.name + "操作。";
    AppendOperateLog.addOneLog(loginname, minfo, OpTypeId.del, OpObjectId.topn_report);
    // 刷新页面
    refreshInifile();
    refreshiControl();
    this.topNGenerateTime.getItems().clear();
  }
示例#12
0
 // 下载本地文件
 public void onClick$download() throws FileNotFoundException {
   String path =
       Executions.getCurrent().getDesktop().getWebApp().getRealPath("/upload/info").trim();
   String fileName = (newsService.getWkTInfo(dis.getKiId())).getKiAddress().trim();
   String name = path.trim() + "\\".trim() + fileName.trim();
   File down = new File(name);
   Filedownload.save(down, null);
 }
示例#13
0
 // EventQueue//
 public void publish(T event) {
   if (event == null) throw new IllegalArgumentException();
   if (Executions.getCurrent() == null) {
     currentThread().postEvent(event);
   } else {
     Events.postEvent(ON_QUEUE, _dummyTarget, event);
   }
 }
示例#14
0
  @Override
  public void doAfterCompose(Component comp) throws Exception {
    super.doAfterCompose(comp);

    Map map = Executions.getCurrent().getArg();
    parent = (ShowPartnerController) map.get("parent");
    windowAddPartner.doModal();
  }
 @Override
 public void doAfterCompose(Component comp) throws Exception {
   super.doAfterCompose(comp);
   memberId = (Long) Executions.getCurrent().getArg().get("memberId");
   member = crudDao.find(Member.class, memberId);
   allBooks = getAllBooks();
   booksWithMember = getBooksWithMember(memberId);
 }
示例#16
0
 public void onClick() {
   UserCredentialManager userCredentialManager =
       (UserCredentialManager)
           new DelegatingVariableResolver().resolveVariable("userCredentialManager");
   userCredentialManager.logOff();
   Sessions.getCurrent().invalidate();
   Executions.getCurrent().sendRedirect("login.zul");
 }
示例#17
0
 // 下载或查看图片
 public void onClick$kiimage() throws FileNotFoundException {
   String path = Executions.getCurrent().getDesktop().getWebApp().getRealPath("/upload/info");
   File f =
       new File(
           path.trim()
               + "\\".trim()
               + newsService.getWkTInfo(dis.getKiId()).getKiImage().toString().trim());
   Filedownload.save(f, null);
 }
  @Override
  public void doAfterCompose(Component comp) throws Exception {
    super.doAfterCompose(comp);

    Map map = Executions.getCurrent().getArg();
    parent = (ShowSpecificAddressController) map.get("parent");
    // specificAddress = (SpecificAddress) map.get("obj");
    windowEditSpecificAddress.doModal();
  }
 @Override
 public void doAfterCompose(Component comp) throws Exception {
   super.doAfterCompose(comp);
   comp.setAttribute("controller", this);
   Map<String, SessionInfo> args = Executions.getCurrent().getArg();
   SessionInfo _ses = args.get(Param.SESSION);
   sessionManager = SessionInfoManagerFactory.getInstance().getSession(_ses.getId());
   this.sessionInfo = sessionManager.getSessionInfo();
   selectedPhysicians = sessionInfo.getAlternateTreatmentProviders();
 }
示例#20
0
 private void subscribe(EventListener<T> listener, EventListener<T> callback, boolean async) {
   if (async && _nAsync++ == 0) {
     final Execution exec = Executions.getCurrent();
     if (exec == null) throw new IllegalStateException("Execution required");
     ((DesktopCtrl) exec.getDesktop()).enableServerPush(true, this);
     // B65-ZK-1840 make sure the flag is true after enabling (otherwise disabling will fail)
     _serverPushEnabled = true;
   }
   _listenerInfos.add(new ListenerInfo<T>(listener, callback, async));
 }
 public static void showException(OptimisticLockingFailureException exception, String backURL) {
   LOG.info("an OptimistLockingFailureException caused a disruption to an user", exception);
   if (Executions.getCurrent() != null) {
     ConfirmCloseUtil.resetConfirmClose();
     Executions.sendRedirect("/common/concurrent_modification.zul?back=" + backURL);
   } else {
     LOG.warn(
         "Impossible to do redirect due to OptimisticLockingFailureException because of Executions.getCurrent() is null");
   }
 }
示例#22
0
 public static void showPointerPopup(
     Component component, String title, String msg, String desc, String type) {
   Execution exec = Executions.getCurrent();
   Page page = component != null ? component.getPage() : null;
   if (page == null && exec instanceof ExecutionCtrl)
     page = ((ExecutionCtrl) exec).getCurrentPage();
   if (type == null) type = Clients.NOTIFICATION_TYPE_INFO;
   Clients.response(
       new PointerPopupAuResponse(
           title, msg, desc, type, page, component, "after_start", 0, false));
 }
示例#23
0
文件: Utils.java 项目: zkoss/zk
  private static Map<Component, ShadowInfo> getShadowInfos(boolean autoCreate) {
    Execution exec = Executions.getCurrent();
    if (exec == null) return null;

    Map<Component, ShadowInfo> result = cast((Map) exec.getAttribute(COMPONENT_INFO));
    if (result == null && autoCreate) {
      result = new HashMap<Component, ShadowInfo>();
      exec.setAttribute(COMPONENT_INFO, result);
    }
    return result;
  }
示例#24
0
  private boolean isEventThreadEnabled(boolean attachedRequired) {
    Desktop desktop = getDesktop();
    if (desktop == null) {
      if (attachedRequired) throw new SuspendNotAllowedException("Not attached, " + this);

      final Execution exec = Executions.getCurrent();
      if (exec == null || (desktop = exec.getDesktop()) == null)
        return true; // assume enabled (safer)
    }
    return desktop.getWebApp().getConfiguration().isEventThreadEnabled();
  }
示例#25
0
 /** 初始化树上的数据 */
 public void initTree() {
   Session session = Executions.getCurrent().getDesktop().getSession();
   Object selectedViewNameObject = session.getAttribute("selectedViewName");
   if (selectedViewNameObject != null) {
     String selectedViewName = (String) selectedViewNameObject;
     if (selectedViewName != null && !selectedViewName.isEmpty()) {
       this.viewName = selectedViewName;
     }
   }
   this.initTree(this.getViewName());
 }
  public void cargarDatosIniciales() throws Exception {
    Map parametros = Executions.getCurrent().getArg();
    admision_seleccionada = (Admision) parametros.get("admision_seleccionada");
    Long codigo_historia = null;
    Hisc_urgencia hu = new Hisc_urgencia();
    hu.setNro_ingreso(admision_seleccionada.getNro_ingreso());
    hu.setCodigo_empresa(admision_seleccionada.getCodigo_empresa());
    hu.setCodigo_sucursal(admision_seleccionada.getCodigo_sucursal());
    hu.setNro_identificacion(admision_seleccionada.getNro_identificacion());

    hu = getServiceLocator().getServicio(Hisc_urgenciaService.class).consultar(hu);
    if (hu != null) {
      codigo_historia = hu.getCodigo_historia();
    }

    Impresion_diagnostica impresion_diagnostica = new Impresion_diagnostica();
    impresion_diagnostica.setCodigo_historia(codigo_historia);
    impresion_diagnostica.setCodigo_sucursal(admision_seleccionada.getCodigo_sucursal());
    impresion_diagnostica.setCodigo_empresa(admision_seleccionada.getCodigo_empresa());

    impresion_diagnostica =
        getServiceLocator()
            .getServicio(Impresion_diagnosticaService.class)
            .consultar(impresion_diagnostica);

    // log.info("impresion_diagnostica>>>>>>>>>>>" + impresion_diagnostica);

    if (impresion_diagnostica != null) {
      tbxCie_p.setValue(impresion_diagnostica.getCie_relacionado1());
      tbxCie_1.setValue(impresion_diagnostica.getCie_relacionado2());
      tbxCie_2.setValue(impresion_diagnostica.getCie_relacionado3());
    }

    // loadComponents();
    onMostrarModuloOrdenamiento();

    Anexo3_entidad anexo3_entidad = new Anexo3_entidad();
    anexo3_entidad.setCodigo_empresa(codigo_empresa);
    anexo3_entidad.setCodigo_sucursal(codigo_sucursal);
    anexo3_entidad.setCodigo_paciente(admision_seleccionada.getNro_identificacion());
    anexo3_entidad.setNro_ingreso(admision_seleccionada.getNro_ingreso());
    //		anexo3_entidad.setCie_1(impresion_diagnostica.getCie_relacionado2());
    //		anexo3_entidad.setCie_2(impresion_diagnostica.getCie_relacionado3());
    //		anexo3_entidad.setCie_p(impresion_diagnostica.getCie_relacionado1());
    anexo3_entidad = getServiceLocator().getAnexo3EntidadService().consultar(anexo3_entidad);
    if (anexo3_entidad != null) {
      mostrarDatos(anexo3_entidad);
    } else {
      accionForm(true, "registrar");
    }

    inicializarCampos();
  }
示例#27
0
  public BindingAnnotationInfoChecker getAnnotationInfoChecker() {
    Execution exec = Executions.getCurrent();
    if (exec == null) return null;

    BindingAnnotationInfoChecker checker =
        (BindingAnnotationInfoChecker) exec.getAttribute(CHECKER_KEY);
    if (checker == null) {
      checker = createDefaultAnnotationInfoChecker();
      exec.setAttribute(CHECKER_KEY, checker);
    }
    return checker;
  }
示例#28
0
 public void close() {
   _closed = true;
   _listenerInfos.clear();
   if (_serverPushEnabled) {
     try {
       // B65-ZK-1840 added enabler argument for reference counting
       ((DesktopCtrl) Executions.getCurrent().getDesktop()).enableServerPush(false, this);
     } catch (Throwable ex) {
       log.warn("Ingored: unable to stop server push", ex);
     }
   }
 }
示例#29
0
 private void handleFailedModal(int oldmode, boolean oldvisi) {
   try {
     if (Executions.getCurrent().getAttribute("javax.servlet.error.exception") != null) {
       // handle it specially if it is used for dispalying err
       setMode(HIGHLIGHTED);
     } else {
       setMode(oldmode); // restore
       setVisible(oldvisi);
     }
   } catch (Throwable ex) {
     log.realCauseBriefly("Causing another error", ex);
   }
 }
示例#30
0
  public BindingExecutionInfoCollector getExecutionInfoCollector() {

    Execution exec = Executions.getCurrent();
    if (exec == null) return null;

    BindingExecutionInfoCollector collector =
        (BindingExecutionInfoCollector) exec.getAttribute(COLLECTOR_KEY);
    if (collector == null) {
      collector = createBindingExecutionInfoCollector();
      exec.setAttribute(COLLECTOR_KEY, collector);
    }
    return collector;
  }