Esempio n. 1
0
 /**
  * Gets all the popular categories from database and sets it as the value of
  * "popularCategoriesCollection"
  */
 private void cachePopularCategories() {
   CategoryBusinessInterface categoryOperations =
       (CategoryBusinessInterface)
           CommonUtils.getBusinessInterface(
               EjbNamesConstants.CATEGORY_BEAN, CategoryHomeInterface.class);
   try {
     popularCategories = categoryOperations.getPopularCategories();
   } catch (RemoteException e) {
     logger.error(e.getStackTrace());
     CommonUtils.handleException(e, NewWelcomePanel.getMainFrame(), true, true, true, true);
   }
 }
    public void actionPerformed(ActionEvent actionEvent) {
      Cab2bHyperlink hyperlink = (Cab2bHyperlink) actionEvent.getSource();

      /* Get the user object associated with that source. */
      final HyperLinkUserObject hyperLinkUserObject =
          (HyperLinkUserObject) hyperlink.getUserObject();
      IQuery tempQuery = null;

      AbstractAssociatedDataPanel linkContainer =
          (AbstractAssociatedDataPanel) hyperlink.getParent();
      try {
        tempQuery = linkContainer.getQuery((hyperLinkUserObject.getAssociation()));
      } catch (RemoteException e) {
        CommonUtils.handleException(e, breadCrumbPanel, true, true, true, false);
      }
      final IQuery query = tempQuery;
      breadCrumbText = Utility.getDisplayName(hyperLinkUserObject.getTargetEntity());

      /* Get result by executing the Query in a worker thread. */
      CustomSwingWorker swingWorker =
          new CustomSwingWorker((JXPanel) breadCrumbPanel, SimpleSearchResultBreadCrumbPanel.this) {

            IQueryResult queryResult = null;

            protected void doNonUILogic() throws Exception {
              queryResult = CommonUtils.executeQuery((ICab2bQuery) query);
            }

            protected void doUIUpdateLogic() throws RuntimeException {
              /*
               * Get attributes and set in map, for later when the user is
               * navigating, and for now directly set it.
               */
              IAssociation association = hyperLinkUserObject.getAssociation();
              IDataRow parentDataRow = hyperLinkUserObject.getParentDataRow();

              currentBreadCrumbName = breadCrumbText;
              JXPanel resultPanel =
                  ResultPanelFactory.getResultPanel(
                      breadCrumbPanel, queryResult,
                      parentDataRow, association);
              addToPanel(resultPanel, breadCrumbText);
            }
          };
      if (query != null) {
        swingWorker.start();
      } else {
        addToPanel(ResultPanelFactory.getNoResultFoundPopup(breadCrumbText), breadCrumbText);
      }
    }