Пример #1
0
  /**
   * Creates a new Outline object.
   *
   * @param djvuBean the DjVuBean to navigate.
   * @throws ArrayIndexOutOfBoundsException if the document has less than 2 pages.
   */
  public Outline(final DjVuBean djvuBean) {
    this.djvuBean = djvuBean;

    if (djvuBean.getDocument().size() < 2) {
      throw new ArrayIndexOutOfBoundsException("Can not navigate documents with only one page.");
    }

    final MouseListener mouseListener =
        new MouseAdapter() {
          public void mouseClicked(final MouseEvent e) {
            try {
              clickLocation(e.getX(), e.getY());
            } catch (final Throwable exp) {
              exp.printStackTrace(DjVuOptions.err);
              System.gc();
            }
          }
        };

    addMouseListener(mouseListener);

    final Document document = djvuBean.getDocument();
    final Bookmark bookmark = (Bookmark) document.getBookmark();
    bookmark.setDjVmDir(document.getDjVmDir());
    setFirstBookmark(bookmark);

    final Properties properties = djvuBean.properties;
    properties.put("addOn.NavPane", "Outline," + properties.getProperty("addOn.NavPane", "None"));
    djvuBean.addPropertyChangeListener(this);
  }
Пример #2
0
 public Bean(String classPackage, String clazz, ClassLoaderStrategy cls, Bean topLevelBean)
     throws Exception {
   // Get the no-arg constructor and create the bean
   try {
     Class classOfBean = ObjectXml.getClassOfBean((ClassLoader) cls, classPackage + "." + clazz);
     Constructor ct = null;
     // check whether this class is an inner class
     if (classOfBean.getEnclosingClass() != null) {
       ct = classOfBean.getConstructor(new Class[] {classOfBean.getEnclosingClass()});
       beanObject = ct.newInstance(new Object[] {topLevelBean.getBeanObject()});
     } else {
       ct = classOfBean.getConstructor((Class[]) null);
       beanObject = ct.newInstance((Object[]) null);
     }
     // Get an array of property descriptors
     beanInfo = Introspector.getBeanInfo(classOfBean);
     PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors();
     // load property descriptors into hashtable
     propDesc = new Properties();
     for (int i = 0; i < pds.length; i++) {
       propDesc.put(pds[i].getName(), pds[i]);
     }
   } catch (Exception e) {
     System.err.println("Exception creating bean: " + e.getMessage());
     e.printStackTrace();
     throw e;
   }
 }
Пример #3
0
 static {
   try {
     properties = new Properties();
     properties.load(Notepad.class.getResourceAsStream("resources/NotepadSystem.properties"));
     resources = ResourceBundle.getBundle("resources.Notepad", Locale.getDefault());
   } catch (MissingResourceException | IOException e) {
     System.err.println(
         "resources/Notepad.properties " + "or resources/NotepadSystem.properties not found");
     System.exit(1);
   }
 }
Пример #4
0
  protected static boolean vnmrjPassword(String strUser, char[] password) {
    boolean blogin = false;
    try {
      PasswordService objPassword = PasswordService.getInstance();
      String encrPassword = objPassword.encrypt(new String(password));
      if (pwprops == null) {
        String strPath = FileUtil.openPath(WUserUtil.PASSWORD);
        if (strPath == null) return blogin;
        pwprops = new Properties();
        FileInputStream fis = new FileInputStream(strPath);
        pwprops.load(fis);
        fis.close();
      }
      String stoPassword = pwprops.getProperty(strUser);
      if (encrPassword.equals(stoPassword)) blogin = true;
    } catch (Exception e) {
      // e.printStackTrace();
      Messages.writeStackTrace(e);
    }

    return blogin;
  }
Пример #5
0
 public PropertyDescriptor getPropertyDescriptor(String name) {
   return (PropertyDescriptor) propDesc.get(getPropertyName(name));
 }
Пример #6
0
 protected String getProperty(String key) {
   return properties.getProperty(key);
 }