Package com.mucommander.xml

Examples of com.mucommander.xml.XmlAttributes


     
      private void writeKeyMap(Map<String, KeyStroke[]> actionMap) throws IOException {
        try {
          writer.writeCommentLine("See http://trac.mucommander.com/wiki/ActionKeyMap for information on how to customize this file");
         
          XmlAttributes rootElementAttributes = new XmlAttributes();
        rootElementAttributes.add(VERSION_ATTRIBUTE, RuntimeConstants.VERSION);
         
          writer.startElement(ROOT_ELEMENT, rootElementAttributes, true);

          if (actionMap != null) {
                    for(String actionId: actionMap.keySet())
View Full Code Here


          writer.endElement(ROOT_ELEMENT);
        }
      }

      private void addMapping(String actionId, KeyStroke[] keyStrokes) throws IOException {
        XmlAttributes attributes = new XmlAttributes();
        attributes.add(ID_ATTRIBUTE, actionId);

          LOGGER.trace("     Writing mapping of "  + actionId + " to " + keyStrokes[0] + " and " + keyStrokes[1]);

        if (keyStrokes[0] != null)
          attributes.add(PRIMARY_KEYSTROKE_ATTRIBUTE, KeyStrokeUtils.getKeyStrokeRepresentation(keyStrokes[0]));

        if (keyStrokes[1] != null)
          attributes.add(ALTERNATE_KEYSTROKE_ATTRIBUTE, KeyStrokeUtils.getKeyStrokeRepresentation(keyStrokes[1]));
       
        writer.writeStandAloneElement(ACTION_ELEMENT, attributes);
      }
View Full Code Here

    public void startBookmarks() throws BookmarkException {
        // Root element
        try {
            // Version the file.
            // Note: the version attribute was introduced in muCommander 0.8.4.
            XmlAttributes attributes = new XmlAttributes();
            attributes.add("version", RuntimeConstants.VERSION);

            out.startElement(ELEMENT_ROOT, attributes);
            out.println();
        }
        catch(IOException e) {throw new BookmarkException(e);}
View Full Code Here

        try {
            // Opens the file for writing.
            out = new XmlWriter(stream);

            // Version the file
            XmlAttributes attributes = new XmlAttributes();
            attributes.add(ATTRIBUTE_VERSION, RuntimeConstants.VERSION);

            out.startElement(ROOT_ELEMENT, attributes);
            out.println();

            // Writes the content of the shell history.
View Full Code Here

   
    private void write(String[] actionIds) throws IOException {
      try {
        writer.writeCommentLine("See http://trac.mucommander.com/wiki/ToolBar for information on how to customize this file");
       
        XmlAttributes rootElementAttributes = new XmlAttributes();
        rootElementAttributes.add(VERSION_ATTRIBUTE, RuntimeConstants.VERSION);

          writer.startElement(ROOT_ELEMENT, rootElementAttributes, true);         
         
          int nbToolBarActions = actionIds.length;
          for (int i=0; i<nbToolBarActions; ++i)
View Full Code Here

   
    private void write(String actionId) throws IOException {
      if (actionId == null)
        writer.writeStandAloneElement(SEPARATOR_ELEMENT);
      else {
        XmlAttributes attributes = new XmlAttributes();
        attributes.add(ACTION_ID_ATTRIBUTE, actionId);

        // AppLogger.finest("Writing button: action_id = "  + attributes.getValue(ACTION_ATTRIBUTE_ID) + ", alt_action_id = " + attributes.getValue(ALT_ACTION_ATTRIBUTE_ID));

        writer.writeStandAloneElement(BUTTON_ELEMENT, attributes);
      }
View Full Code Here

   
    private void write(String[] actionIds, String[] alternativeActionIds, KeyStroke modifier) throws IOException {
      try {
        writer.writeCommentLine("See http://trac.mucommander.com/wiki/CommandBar for information on how to customize this file");
       
        XmlAttributes rootElementAttributes = new XmlAttributes();
        rootElementAttributes.add(MODIFIER_ATTRIBUTE, KeyStrokeUtils.getKeyStrokeRepresentation(modifier));
        rootElementAttributes.add(VERSION_ATTRIBUTE, RuntimeConstants.VERSION);

          writer.startElement(ROOT_ELEMENT, rootElementAttributes, true);         
         
          int nbCommandBarActions = actionIds.length;
          for (int i=0; i<nbCommandBarActions; ++i)
View Full Code Here

          writer.endElement(ROOT_ELEMENT);
        }
    }
   
    private void write(String actionId, String alternativeActionId) throws IOException {
      XmlAttributes attributes = new XmlAttributes();
      attributes.add(ACTION_ID_ATTRIBUTE, actionId);
      if (alternativeActionId != null)
        attributes.add(ALT_ACTION_ID_ATTRIBUTE, alternativeActionId);
     
            LOGGER.trace("Writing button: action_id = "  + attributes.getValue(ACTION_ID_ATTRIBUTE) + ", alt_action_id = " + attributes.getValue(ALT_ACTION_ID_ATTRIBUTE));
     
      writer.writeStandAloneElement(BUTTON_ELEMENT, attributes);
    }
View Full Code Here

     * Writes the specified command's XML description.
     * @param  command          command that should be written.
     * @throws CommandException if an error occurs.
     */
    public void addCommand(Command command) throws CommandException {
        XmlAttributes attributes;

        // Builds the XML description of the command.
        attributes = new XmlAttributes();
        attributes.add(ATTRIBUTE_ALIAS, command.getAlias());
        attributes.add(ATTRIBUTE_VALUE, command.getCommand());
        if (command.getType().toString() != null)
          attributes.add(ATTRIBUTE_TYPE, command.getType().toString());
        if(command.isDisplayNameSet())
            attributes.add(ATTRIBUTE_DISPLAY, command.getDisplayName());

        // Writes the XML description.
        try {out.writeStandAloneElement(ELEMENT_COMMAND, attributes);}
        catch(IOException e) {throw new CommandException(e);}
    }
View Full Code Here

    static void write(OutputStream stream) throws IOException {

        XmlWriter out  = new XmlWriter(stream);

        // Root element, add the encryption method used
        XmlAttributes attributes = new XmlAttributes();
        attributes.add(ATTRIBUTE_ENCRYPTION, WEAK_ENCRYPTION_METHOD);
        // Version the file
        attributes.add(ATTRIBUTE_VERSION, RuntimeConstants.VERSION);
        out.startElement(ELEMENT_ROOT, attributes);
        out.println();

        Iterator<CredentialsMapping> iterator = CredentialsManager.getPersistentCredentialMappings().iterator();
        CredentialsMapping credentialsMapping;
        FileURL realm;
        Enumeration<String> propertyKeys;
        String name;

        while(iterator.hasNext()) {
            credentialsMapping = iterator.next();
            realm = credentialsMapping.getRealm();

            // Start credentials element
            out.startElement(ELEMENT_CREDENTIALS);
            out.println();

            // Write URL
            out.startElement(ELEMENT_URL);
            out.writeCData(realm.toString(false));
            out.endElement(ELEMENT_URL);

            Credentials credentials = credentialsMapping.getCredentials();

            // Write login
            out.startElement(ELEMENT_LOGIN);
            out.writeCData(credentials.getLogin());
            out.endElement(ELEMENT_LOGIN);

            // Write password (XOR encrypted)
            out.startElement(ELEMENT_PASSWORD);
            out.writeCData(XORCipher.encryptXORBase64(credentials.getPassword()));
            out.endElement(ELEMENT_PASSWORD);

            // Write properties, each property is stored in a separate 'property' element
            propertyKeys = realm.getPropertyNames();
            while(propertyKeys.hasMoreElements()) {
                name = propertyKeys.nextElement();
                attributes = new XmlAttributes();
                attributes.add(ATTRIBUTE_NAME, name);
                attributes.add(ATTRIBUTE_VALUE, realm.getProperty(name));
                out.startElement(ELEMENT_PROPERTY, attributes);
                out.endElement(ELEMENT_PROPERTY);
            }

            // End credentials element
View Full Code Here

TOP

Related Classes of com.mucommander.xml.XmlAttributes

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.