Package com.mucommander.xml

Examples of com.mucommander.xml.XmlAttributes


     * Returns the XML attributes describing the specified font.
     * @param  font font to described as XML attributes.
     * @return      the XML attributes describing the specified font.
     */
    private static XmlAttributes getFontAttributes(Font font) {
        XmlAttributes attributes; // Stores the font's description.

        attributes = new XmlAttributes();

        // Font family and size.
        attributes.add(ATTRIBUTE_FAMILY, font.getFamily());
        attributes.add(ATTRIBUTE_SIZE, Integer.toString(font.getSize()));

        // Font style.
        if(font.isBold())
            attributes.add(ATTRIBUTE_BOLD, VALUE_TRUE);
        if(font.isItalic())
            attributes.add(ATTRIBUTE_ITALIC, VALUE_TRUE);

        return attributes;
    }
View Full Code Here


     * Returns the XML attributes describing the specified color.
     * @param  color color to described as XML attributes.
     * @return       the XML attributes describing the specified color.
     */
    private static XmlAttributes getColorAttributes(Color color) {
        XmlAttributes attributes; // Stores the color's description.
        StringBuilder buffer;     // Used to build the color's string representation.

        buffer = new StringBuilder();

        // Red component.
        if(color.getRed() < 16)
            buffer.append('0');
        buffer.append(Integer.toString(color.getRed(), 16));

        // Green component.
        if(color.getGreen() < 16)
            buffer.append('0');
        buffer.append(Integer.toString(color.getGreen(), 16));

        // Blue component.
        if(color.getBlue() < 16)
            buffer.append('0');
        buffer.append(Integer.toString(color.getBlue(), 16));

        // Builds the XML attributes.
        attributes = new XmlAttributes();
        attributes.add(ATTRIBUTE_COLOR, buffer.toString());

        if(color.getAlpha() != 255) {
            buffer.setLength(0);
            if(color.getAlpha() < 16)
                buffer.append('0');
            buffer.append(Integer.toString(color.getAlpha(), 16));
            attributes.add(ATTRIBUTE_ALPHA, buffer.toString());
        }

        return attributes;
    }
View Full Code Here

        try {out.endElement(ELEMENT_ROOT);}
        catch(IOException e) {throw new CommandException(e);}
    }

    public void startAssociation(String command) throws CommandException {
        XmlAttributes attr;

        attr = new XmlAttributes();
        attr.add(ATTRIBUTE_COMMAND, command);

        try {
            out.startElement(ELEMENT_ASSOCIATION, attr);
            out.println();
        }
View Full Code Here

        try {out.endElement(ELEMENT_ASSOCIATION);}
        catch(IOException e) {throw new CommandException(e);}
    }

    public void setMask(String mask, boolean isCaseSensitive) throws CommandException {
        XmlAttributes attr;

        attr = new XmlAttributes();
        attr.add(ATTRIBUTE_VALUE, mask);
        if(!isCaseSensitive)
            attr.add(ATTRIBUTE_CASE_SENSITIVE, VALUE_FALSE);

        try {out.writeStandAloneElement(ELEMENT_MASK, attr);}
        catch(IOException e) {throw new CommandException(e);}
    }
View Full Code Here

        try {out.writeStandAloneElement(ELEMENT_MASK, attr);}
        catch(IOException e) {throw new CommandException(e);}
    }

    public void setIsSymlink(boolean isSymlink) throws CommandException {
        XmlAttributes attr;

        attr = new XmlAttributes();
        attr.add(ATTRIBUTE_VALUE, isSymlink ? VALUE_TRUE : VALUE_FALSE);

        try {out.writeStandAloneElement(ELEMENT_IS_SYMLINK, attr);}
        catch(IOException e) {throw new CommandException(e);}
    }
View Full Code Here

        try {out.writeStandAloneElement(ELEMENT_IS_SYMLINK, attr);}
        catch(IOException e) {throw new CommandException(e);}
    }

    public void setIsHidden(boolean isHidden) throws CommandException {
        XmlAttributes attr;

        attr = new XmlAttributes();
        attr.add(ATTRIBUTE_VALUE, isHidden ? VALUE_TRUE : VALUE_FALSE);

        try {out.writeStandAloneElement(ELEMENT_IS_HIDDEN, attr);}
        catch(IOException e) {throw new CommandException(e);}
    }
View Full Code Here

        try {out.writeStandAloneElement(ELEMENT_IS_HIDDEN, attr);}
        catch(IOException e) {throw new CommandException(e);}
    }

    public void setIsReadable(boolean isReadable) throws CommandException {
        XmlAttributes attr;

        attr = new XmlAttributes();
        attr.add(ATTRIBUTE_VALUE, isReadable ? VALUE_TRUE : VALUE_FALSE);

        try {out.writeStandAloneElement(ELEMENT_IS_READABLE, attr);}
        catch(IOException e) {throw new CommandException(e);}
    }
View Full Code Here

        try {out.writeStandAloneElement(ELEMENT_IS_READABLE, attr);}
        catch(IOException e) {throw new CommandException(e);}
    }

    public void setIsWritable(boolean isWritable) throws CommandException {
        XmlAttributes attr;

        attr = new XmlAttributes();
        attr.add(ATTRIBUTE_VALUE, isWritable ? VALUE_TRUE : VALUE_FALSE);

        try {out.writeStandAloneElement(ELEMENT_IS_WRITABLE, attr);}
        catch(IOException e) {throw new CommandException(e);}
    }
View Full Code Here

        try {out.writeStandAloneElement(ELEMENT_IS_WRITABLE, attr);}
        catch(IOException e) {throw new CommandException(e);}
    }

    public void setIsExecutable(boolean isExecutable) throws CommandException {
        XmlAttributes attr;

        attr = new XmlAttributes();
        attr.add(ATTRIBUTE_VALUE, isExecutable ? VALUE_TRUE : VALUE_FALSE);

        try {out.writeStandAloneElement(ELEMENT_IS_EXECUTABLE, attr);}
        catch(IOException e) {throw new CommandException(e);}
    }
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.