Exemplo n.º 1
0
  private void prepareTabs() throws Exception {
    Locale locale = getApplication().getLocale();
    GsonBuilder gb = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ");
    Gson gson = gb.create();
    Type collectionType = new TypeToken<LinkedHashMap<Integer, String>>() {}.getType();
    TreeMap<Integer, String> tabList = new TreeMap<Integer, String>();
    String metaDataString =
        getPbApplication().getBpmModule().getMetaData("PROCESSBASE_TABSHEETS_LIST");
    if (metaDataString != null) {
      LinkedHashMap<Integer, String> tabs2 = gson.fromJson(metaDataString, collectionType);
      if (!tabs2.isEmpty()) {
        tabList.putAll(tabs2);
      }
    }

    PbPanelModuleService pms = getPbApplication().getPanelModuleService();

    for (Entry<String, PbPanelModule> pm : pms.getModules().entrySet()) {
      System.out.println("moduleName = " + pm.getKey());

      if (pm != null) {
        try {
          PbPanelModule panel = pm.getValue();
          if (CollectionUtils.containsAny(Arrays.asList(panel.getRoles()), accessSet)) {
            tabs.addTab(panel, panel.getTitle(locale), null);
          } else {
            System.out.println("No rights for module = " + pm.getKey());
          }
        } catch (Exception ex) {
          System.out.println("Exception with pm = " + pm.getKey());
          ex.printStackTrace();
          throw new RuntimeException(ex);
        }
      }
    }
    if (tabs.getSelectedTab() != null && tabs.getSelectedTab() instanceof PbPanel) {
      PbPanel first = (PbPanel) tabs.getSelectedTab();
      first.initUI();
      first.setInitialized(true);
      first.setSizeFull();
    }
  }
Exemplo n.º 2
0
  public void initUI() {
    try {

      if (getPbApplication().getUser() == null) {
        initLogin(null);
        return;
      }
      defineAccess();
      HttpServletRequest servletRequest = getPbApplication().getHttpServletRequest();
      // if opened a p as process and t as task parameter
      if (servletRequest.getParameter("p") != null) {
        initProcess(servletRequest.getParameter("p"));
        return;
      } else if (servletRequest.getParameter("t") != null) {
        initTask(servletRequest.getParameter("t"));
        return;
      }

      mainLayout = (VerticalLayout) getContent();
      mainLayout.removeAllComponents();
      mainLayout.setMargin(true);
      mainLayout.setSizeFull();

      tabs = new TabSheet();

      // prepare tabs
      // String userName = getPbApplication().getUserName();
      prepareTabs();
      mainLayout.addComponent(getHeader());
      /*if (accessSet.contains("tasklist")) {
                  	consolePanel = new TaskListPanel();

                  	if(accessSet.size()==1){

                  		 consolePanel.initUI();
                  		 consolePanel.setInitialized(true);
                  		 consolePanel.setSizeFull();
                  		 mainLayout.addComponent(consolePanel);
                           mainLayout.setExpandRatio(consolePanel, 1);
                  		 return;
                  	}

                      tabs.addTab(consolePanel, getPbMessages("bpmTasklist"), null);
                  }
                  if (accessSet.contains("bpm")) {
                      bpmConfigurationPanel = new BPMConfigurationPanel();
                      tabs.addTab(bpmConfigurationPanel, getPbMessages("bpmAdmin"), null);
                  }
                  if (accessSet.contains("identity")) {
                      identityPanel = new IdentityPanel();
                      tabs.addTab(identityPanel, getPbMessages("bpmIdentity"), null);
                  }
                  if (accessSet.contains("bam")) {
                      bamConfigurationPanel = new BAMConfigurationPanel();
                      tabs.addTab(bamConfigurationPanel, getPbMessages("bamAdmin"), null);
                  }
                  if (accessSet.contains("monitoring")) {
                      bpmMonitoringPanel = new BPMMonitoringPanel();
                      tabs.addTab(bpmMonitoringPanel, getPbMessages("bpmMonitoring"), null);
                  }
                  if (accessSet.contains("development")) {
                  	developmentPanel = new DevelopmentPanel();
                  	tabs.addTab(developmentPanel, getPbMessages("bpmDevelopment"), null);
                  }

                  if (accessSet.contains("raport")) {
                  	raportListPanel = new RaportModule();
                      tabs.addTab(raportListPanel, "Raports", null);
                  }

      */
      if (tabs.getSelectedTab() != null && tabs.getSelectedTab() instanceof PbPanel) {
        PbPanel first = (PbPanel) tabs.getSelectedTab();
        first.initUI();
        first.setInitialized(true);
        first.setSizeFull();
      }

      tabs.setSizeFull();
      mainLayout.addComponent(tabs);
      // mainLayout.addComponent(tabs);
      mainLayout.setExpandRatio(tabs, 1);

      tabs.addListener((SelectedTabChangeListener) this);
      tabs.setImmediate(true);
    } catch (Exception ex) {
      ex.printStackTrace();
      throw new RuntimeException(ex);
    }
  }