Beispiel #1
1
    public void run() {
      SearchTOCItem tocitem;
      Vector nodes = new Vector();

      // Add all the children of the topnode to the Vector of nodes.
      Enumeration children = topNode.children();
      while (children.hasMoreElements()) {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) children.nextElement();
        nodes.addElement(node);
      }

      debug("items found");
      HelpModel helpmodel = searchnav.getModel();
      HelpSet hs = helpmodel.getHelpSet();
      debug("hs:" + hs.toString());
      Map map = hs.getCombinedMap();
      Enumeration itemEnum = e.getSearchItems();
      while (itemEnum.hasMoreElements()) {
        SearchItem item = (SearchItem) itemEnum.nextElement();
        debug("  item: " + item);
        URL url;
        try {
          url = new URL(item.getBase(), item.getFilename());
        } catch (MalformedURLException me) {
          System.err.println(
              "Failed to create URL from " + item.getBase() + "|" + item.getFilename());
          continue;
        }
        boolean foundNode = false;
        DefaultMutableTreeNode node = null;
        Enumeration nodesEnum = nodes.elements();
        while (nodesEnum.hasMoreElements()) {
          node = (DefaultMutableTreeNode) nodesEnum.nextElement();
          tocitem = (SearchTOCItem) node.getUserObject();
          URL testURL = tocitem.getURL();
          if (testURL != null && url != null && url.sameFile(testURL)) {
            tocitem = (SearchTOCItem) node.getUserObject();
            tocitem.addSearchHit(
                new SearchHit(item.getConfidence(), item.getBegin(), item.getEnd()));
            foundNode = true;
            break;
          }
        }
        if (!foundNode) {
          tocitem = new SearchTOCItem(item);
          node = new DefaultMutableTreeNode(tocitem);
          nodes.addElement(node);
        }
      }
      reorder(nodes);
      ((DefaultTreeModel) tree.getModel()).reload();
    }
 private void checkHelpSetURL(
     URL hsURL,
     ClassLoader globalClassLoader,
     ClassLoader moduleClassLoader,
     Map<String, URLClassLoader> classLoaderMap,
     String cnb) {
   HelpSet hs = null;
   try {
     hs = new HelpSet(moduleClassLoader, hsURL);
   } catch (HelpSetException ex) {
     throw new BuildException("Failed to parse " + hsURL + ": " + ex, ex, getLocation());
   }
   javax.help.Map map = hs.getCombinedMap();
   Enumeration<?> e = map.getAllIDs();
   Set<URI> okurls = new HashSet<URI>(1000);
   Set<URI> badurls = new HashSet<URI>(1000);
   Set<URI> cleanurls = new HashSet<URI>(1000);
   while (e.hasMoreElements()) {
     javax.help.Map.ID id = (javax.help.Map.ID) e.nextElement();
     URL u = null;
     try {
       u = id.getURL();
     } catch (MalformedURLException ex) {
       log("id:" + id, Project.MSG_WARN);
       ex.printStackTrace();
     }
     if (u == null) {
       throw new BuildException("Bogus map ID: " + id.id + " in: " + cnb);
     }
     log("Checking ID " + id.id, Project.MSG_VERBOSE);
     try {
       // System.out.println("CALL OF CheckLinks.scan");
       List<String> errors = new ArrayList<String>();
       CheckLinks.scan(
           this,
           globalClassLoader,
           classLoaderMap,
           id.id,
           "",
           new URI(u.toExternalForm()),
           okurls,
           badurls,
           cleanurls,
           false,
           false,
           false,
           2,
           Collections.<Mapper>emptyList(),
           errors);
       for (String error : errors) {
         log(error, Project.MSG_WARN);
       }
       // System.out.println("RETURN OF CheckLinks.scan");
     } catch (URISyntaxException ex) {
       ex.printStackTrace();
     } catch (IOException ex) {
       ex.printStackTrace();
     }
   }
 }
  /**
   * Try to find an id in a toolbox
   *
   * @param tbxName the toolbox's name
   * @param id the id to find
   * @return the URL corresponding to the id
   */
  public URL getURLFromID(String tbxName, String id) {
    if (tbxName == null) {
      return getURLFromID(id);
    }
    URL url = null;
    try {
      for (HelpSet hs : helpSets) {
        if (hs.getHelpSetURL().toString().replaceAll("\\\\", "/").contains("/" + tbxName + "/")) {
          javax.help.Map map = hs.getLocalMap();
          if (map.isValidID(id, hs)) {
            url = map.getURLFromID(javax.help.Map.ID.create(id, hs));
            if (url != null) {
              return url;
            }
          }
        }
      }
      url =
          new URL(
              helpSets
                  .get(0)
                  .getHelpSetURL()
                  .toString()
                  .replace("jhelpset.hs", "ScilabErrorPage.html"));
    } catch (MalformedURLException ex) {
    }

    return url;
  }
Beispiel #4
0
 private void initHelpBroker() {
   HelpSet helpSet = HelpSys.getHelpSet();
   if (helpSet != null) {
     helpBroker = helpSet.createHelpBroker();
     if (helpBroker instanceof DefaultHelpBroker) {
       DefaultHelpBroker defaultHelpBroker = (DefaultHelpBroker) helpBroker;
       defaultHelpBroker.setActivationWindow(this);
     }
   }
 }
 private void createHelp() {
   try {
     SwingHelpUtilities.setContentViewerUI("uk.ac.ebi.pride.gui.help.ExternalLinkContentViewerUI");
     ClassLoader cl = PrideInspectorContext.class.getClassLoader();
     URL url = HelpSet.findHelpSet(cl, this.getProperty("help.main.set"));
     mainHelpSet = new HelpSet(cl, url);
     mainHelpBroker = mainHelpSet.createHelpBroker();
   } catch (HelpSetException e) {
     logger.error("Failed to initialize help documents", e);
   }
 }
 public void enteredFromLeft(Map dataMap) {
   try {
     // HelpSet de Ayuda
     String helpHS = "ayuda.hs";
     HelpSet hs = com.geopista.app.help.HelpLoader.getHelpSet(helpHS);
     HelpBroker hb = hs.createHelpBroker();
     hb.enableHelpKey(this, "generadorInformeDatosGenerales", hs);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Beispiel #7
0
 private static void constructHelpSet() {
   try {
     final ClassLoader lLoader = App.class.getClassLoader();
     final URL lUrl = HelpSet.findHelpSet(lLoader, "apphelp.hs");
     final HelpSet lHelpSet = new HelpSet(lLoader, lUrl);
     final HelpBroker lHelpBroker = lHelpSet.createHelpBroker();
     viewModel.put("help", lHelpBroker);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Beispiel #8
0
 /**
  * Adds subhelpsets
  *
  * @param hs The HelpSet which subhelpsets will be added
  */
 protected void addSubHelpSets(HelpSet hs) {
   for (Enumeration e = hs.getHelpSets(); e.hasMoreElements(); ) {
     HelpSet ehs = (HelpSet) e.nextElement();
     // merge views
     NavigatorView[] views = ehs.getNavigatorViews();
     for (int i = 0; i < views.length; i++) {
       if (searchnav.canMerge(views[i])) searchnav.merge(views[i]);
     }
     addSubHelpSets(ehs);
   }
 }
Beispiel #9
0
  public XenaGUITester() {
    super("Xena GUI Component Tester!");
    setBounds(200, 200, 300, 400);

    this.setLayout(new GridLayout(5, 1));

    // TITLE PANEL
    JLabel titleLabel = new JLabel("Demo App for Xena stuff.");
    JPanel titlePanel = new JPanel();
    titlePanel.add(titleLabel);

    // HELP PANEL
    JLabel helpLabel = new JLabel("This button will show the help.");
    JButton helpButton = new JButton("Show help.");

    JPanel helpPanel = new JPanel();
    helpPanel.add(helpLabel);
    helpPanel.add(helpButton);

    HelpSet hs = null;
    try {
      ClassLoader cl = getClass().getClassLoader();
      URL hsURL = HelpSet.findHelpSet(cl, "XenaOnlineHelp");
      System.out.println("URL:" + hsURL);
      hs = new HelpSet(null, hsURL);
    } catch (Exception e1) {
      System.out.println("Helpset not found");
      // e1.printStackTrace();
    }
    HelpBroker hb = null;
    if (hs != null) {
      hb = hs.createHelpBroker();
    }

    helpButton.addActionListener(new CSH.DisplayHelpFromSource(hb));
    helpButton.addActionListener(new HelpListener());

    // SHOW XENA FILE PANEL
    JLabel showLabel = new JLabel("Show a xena file.");
    JButton showButon = new JButton("Open file.");
    showButon.addActionListener(new OpenListener());
    JPanel showPanel = new JPanel();
    showPanel.add(showLabel);
    showPanel.add(showButon);

    // and the view panel.

    // lets show the stuff.
    Container content = this.getContentPane();
    content.add(titlePanel);
    content.add(helpPanel);
    content.add(showPanel);
  }
Beispiel #10
0
  private void initHelpSystem() {
    if (helpBroker != null && helpSet != null) {
      return;
    }

    helpSet = initHelpSet();
    if (helpSet != null) {
      helpSet.setKeyData(
          HelpSet.implRegistry, HelpSet.helpBrokerClass, OnlineHelpBroker.class.getName());
      helpBroker = (OnlineHelpBroker) helpSet.createHelpBroker();
    }

    displayListener = new CSH.DisplayHelpFromSource(helpBroker);
  }
 private void initHelpSets(HelpSet hs) {
   helpSets = new ArrayList();
   helpSets.add(hs);
   for (Enumeration<HelpSet> e = hs.getHelpSets(); e.hasMoreElements(); ) {
     helpSets.add(e.nextElement());
   }
 }
Beispiel #12
0
  /**
   * Reloads data from new model, creates new search engine to search in new model if model contains
   * view with the same name
   */
  private void reloadData(HelpModel model) {
    debug("reloadData using new model");
    helpsearch = null;
    SearchView view = null;

    newHelpSet = model.getHelpSet();
    SearchView oldView = (SearchView) searchnav.getNavigatorView();
    String oldName = oldView.getName();
    NavigatorView[] navViews = newHelpSet.getNavigatorViews();
    for (int i = 0; i < navViews.length; i++) {
      if ((navViews[i].getName()).equals(oldName)) {
        NavigatorView tempView = navViews[i];
        if (tempView instanceof SearchView) {
          view = (SearchView) tempView;
          break;
        }
      }
    }

    if (view == null) return;

    topNode.removeAllChildren();
    searchnav.setSearchEngine(new MergingSearchEngine(view));

    setCellRenderer(view, tree);
    // add all subhelpsets
    addSubHelpSets(newHelpSet);
  }
  /** Acciones realizas al entrar en la pantalla */
  public void enter() {
    if (((Boolean) Identificadores.get("TablasModificadas")).booleanValue()
        && !((Boolean) Identificadores.get("TablasDominiosActualizada")).booleanValue()) {
      // Cada vez que se entra, se actualiza el arbol de tablas del sistema con
      // los posibles cambios realizados
      Identificadores.put("Tablas", null);
      Identificadores.put("Columnas", null);

      this.remove(jPanelTablas);
      jPanelTablas = new JPanelTables(TreeSelectionModel.SINGLE_TREE_SELECTION);
      jPanelTablas.setBorder(
          BorderFactory.createTitledBorder(I18N.get("GestorCapas", "tablas.arbol.titulo")));
      jPanelTablas.setBounds(new java.awt.Rectangle(5, 5, 250, 481));
      this.add(jPanelTablas);
      treeTablas = jPanelTablas.getTree();
      treeTablas.addTreeSelectionListener(this);

      // Si se modifica algo en la pantalla de tablas de base de datos, habrá
      // que actualizar la información tanto en el panel de tablasdominios como
      // en el de layers.
      Identificadores.put("TablasDominiosActualizada", true);
      if (((Boolean) Identificadores.get("LayersActualizada")).booleanValue()) {
        Identificadores.put("TablasModificadas", false);
        Identificadores.put("TablasDominiosActualizada", false);
        Identificadores.put("LayersActualizada", false);
      }
    }

    try {
      // Iniciamos la ayuda
      String helpHS = "help/catastro/gestordecapas/GestorCapasHelp_es.hs";
      ClassLoader c1 = this.getClass().getClassLoader();
      URL hsURL = HelpSet.findHelpSet(c1, helpHS);
      HelpSet hs = new HelpSet(null, hsURL);
      HelpBroker hb = hs.createHelpBroker();
      // fin de la ayuda
      hb.enableHelpKey(this, "Pestania2Dominios", hs);
    } catch (Exception excp) {
      excp.printStackTrace();
    }
  }
Beispiel #14
0
  protected HelpSet initHelpSet() {

    URL hsURL = HelpSet.findHelpSet(null, FILE_NAME);

    HelpSet helpSet = null;
    try {
      helpSet = new HelpSet(null, hsURL);
    } catch (HelpSetException e) {
      e.printStackTrace();
    }

    return helpSet;
  }
  /** Realiza el proceso de importación en cuanto se accede a esta pantalla */
  public void enteredFromLeft(Map dataMap) {
    sbMessage = new StringBuffer();
    final TaskMonitorDialog progressDialog =
        new TaskMonitorDialog(application.getMainFrame(), null);

    progressDialog.setTitle(I18N.get("Importacion", "importar.general.proceso.importando"));
    progressDialog.report(I18N.get("Importacion", "importar.general.proceso.importando"));
    progressDialog.addComponentListener(
        new ComponentAdapter() {
          public void componentShown(ComponentEvent e) {
            // Wait for the dialog to appear before starting the
            // task. Otherwise
            // the task might possibly finish before the dialog
            // appeared and the
            // dialog would never close. [Jon Aquino]
            new Thread(
                    new Runnable() {
                      public void run() {
                        try {
                          String rutaImp =
                              (String) blackboard.get(ImportarUtils_LCGIII.FILE_TO_IMPORT);
                          notInsertedRows = 0;
                          insertedRows = 0;
                          totalRows = 0;

                          XMLReader parser = new SAXParser();
                          parser.setFeature(
                              "http://apache.org/xml/features/validation/schema", true);
                          parser.setFeature("http://xml.org/sax/features/validation", true);

                          blackboard.put("UnidadesInsertadas", new Integer(0));
                          blackboard.put("UnidadesNoInsertadas", new Integer(0));
                          blackboard.put("ListaDatosRegistro", new ArrayList());

                          Fichero fich = new Fichero();
                          fich.setIdTipoFichero(Fichero.FIN_RETORNO);

                          // Inicializar la lista total de parcelas importadas (se almacenan las
                          // ref.catastrales)
                          blackboard.put("ListaTotalFincasImportadas", new ArrayList());
                          parser.setContentHandler(
                              new FinRetornoXMLHandler(parser, progressDialog, fich, true));
                          parser.parse(rutaImp);

                          insertedRows =
                              ((Integer) blackboard.get("UnidadesInsertadas")).intValue();
                          notInsertedRows =
                              ((Integer) blackboard.get("UnidadesNoInsertadas")).intValue();
                          totalRows = insertedRows + notInsertedRows;

                          progressDialog.report(
                              I18N.get("Importacion", "importar.general.proceso.grabando"));
                          ArrayList lstDatosRegistro =
                              (ArrayList) blackboard.get("ListaDatosRegistro");

                          // Llamada a método de REGISTRO DE EXPEDIENTES
                          Iterator itRegistro = lstDatosRegistro.iterator();
                          while (itRegistro.hasNext()) {
                            Object o = itRegistro.next();
                            ArrayList lst = null;
                            if (((DatosRegistroExpedientes) o).getLstFincas() != null
                                && ((DatosRegistroExpedientes) o).getLstFincas().size() != 0)
                              lst = ((DatosRegistroExpedientes) o).getLstFincas();
                            else if (((DatosRegistroExpedientes) o).getLstBienes() != null
                                && ((DatosRegistroExpedientes) o).getLstBienes().size() != 0)
                              lst = ((DatosRegistroExpedientes) o).getLstBienes();

                            if (ConstantesRegExp.clienteCatastro != null) {
                              fich.setContenido(fileToString(new File(rutaImp)));
                              ArrayList lstExp = new ArrayList();
                              lstExp.add(
                                  ((DatosRegistroExpedientes) o)
                                      .getExpediente()
                                      .getNumeroExpediente());
                              // A crearFichero se le pasa la lista de expedientes
                              ConstantesRegExp.clienteCatastro.crearFichero(lstExp, fich);
                            }
                          }

                        } catch (Exception e) {
                          e.printStackTrace();
                        } finally {
                          progressDialog.setVisible(false);
                        }
                      }
                    })
                .start();
          }
        });
    GUIUtil.centreOnWindow(progressDialog);

    progressDialog.setVisible(true);

    printFinalMessage();

    try {
      // Iniciamos la ayuda
      String helpHS = "help/catastro/importadores/importadoresHelp_es.hs";
      ClassLoader c1 = this.getClass().getClassLoader();
      URL hsURL = HelpSet.findHelpSet(c1, helpHS);
      HelpSet hs = new HelpSet(null, hsURL);
      HelpBroker hb = hs.createHelpBroker();
      // fin de la ayuda
      hb.enableHelpKey(this, "FinRetorno", hs);
    } catch (Exception excp) {
      excp.printStackTrace();
    }
  }