Package org.xml.sax.helpers

Examples of org.xml.sax.helpers.AttributesImpl


    private Calendar myCalendar = GregorianCalendar.getInstance(Locale.ENGLISH);

    void save(IGanttProject project, TransformerHandler handler)
            throws SAXException {
        AttributesImpl attrs = new AttributesImpl();
        startElement("calendars", attrs, handler);
        startElement("day-types", attrs, handler);
        //
        addAttribute("id", "0", attrs);
        emptyElement("day-type", attrs, handler);
View Full Code Here


import net.sourceforge.ganttproject.task.ResourceAssignment;
import net.sourceforge.ganttproject.task.Task;

class AssignmentSaver extends SaverBase {
    void save(IGanttProject project, TransformerHandler handler) throws SAXException {
        AttributesImpl attrs = new AttributesImpl();
        startElement("allocations", handler);
        Task[] tasks = project.getTaskManager().getTasks();
        for (int i = 0; i < tasks.length; i++) {
            Task task = tasks[i];
            ResourceAssignment[] assignments = task.getAssignments();
View Full Code Here

        myUIFacade = uiFacade;
    }

    public void save(OutputStream stream) throws IOException {
        try {
            AttributesImpl attrs = new AttributesImpl();
            StreamResult result = new StreamResult(stream);
            SAXTransformerFactory factory = (SAXTransformerFactory) SAXTransformerFactory
                    .newInstance();
            TransformerHandler handler = factory.newTransformerHandler();
            Transformer serializer = handler.getTransformer();
View Full Code Here

    private void saveAssignments(TransformerHandler handler) throws SAXException {
        new AssignmentSaver().save(getProject(), handler);
    }
    private void saveRoles(TransformerHandler handler) throws SAXException {
        AttributesImpl attrs = new AttributesImpl();
        RoleManager roleManager = getProject().getRoleManager();
        RoleSet[] roleSets = roleManager.getRoleSets();
        for (int i = 0; i < roleSets.length; i++) {
            RoleSet next = roleSets[i];
            if (next.isEnabled()) {
View Full Code Here

        String text = GanttLanguage.getInstance().getText(key);
        return GanttLanguage.getInstance().correctLabel(text);
    }

    protected void writeColumns(TableHeaderUIFacade visibleFields, TransformerHandler handler) throws SAXException {
      AttributesImpl attrs = new AttributesImpl();
      int totalWidth = 0;
      for (int i=0; i<visibleFields.getSize(); i++) {
        if (visibleFields.getField(i).isVisible()) {
          totalWidth += visibleFields.getField(i).getWidth();
        }
View Full Code Here

          emptyElement("field", attrs, handler);
        }
      }
    }
    protected void writeViews(UIFacade facade, TransformerHandler handler) throws SAXException {
      AttributesImpl attrs = new AttributesImpl();
      addAttribute("id", "task-table", attrs);
      startElement("view", attrs, handler);
      writeColumns(facade.getTaskTree().getVisibleFields(), handler);
      endElement("view", handler);
View Full Code Here


    protected void writeTasks(TaskManager taskManager,
            final TransformerHandler handler) throws ExportException,
            SAXException {
        AttributesImpl attrs = new AttributesImpl();
        addAttribute("xslfo-path", "", attrs);
        addAttribute("title", i18n("tasksList"), attrs);
        addAttribute("name", i18n("name"), attrs);
        addAttribute("begin", i18n("start"), attrs);
        addAttribute("end", i18n("end"), attrs);
        addAttribute("milestone", i18n("meetingPoint"), attrs);
        addAttribute("progress", "%", attrs);
        addAttribute("assigned-to", i18n("human"), attrs);
        addAttribute("notes", i18n("notes"), attrs);
        addAttribute("duration", i18n("duration"), attrs);
        startPrefixedElement("tasks", attrs, handler);
        TaskVisitor visitor = new TaskVisitor() {
            AttributesImpl myAttrs = new AttributesImpl();
            protected String serializeTask(Task t, int depth) throws Exception {
              addAttribute("depth", depth, myAttrs);
                startPrefixedElement("task", myAttrs, handler);
                {
                  addAttribute("id", "tpd1", myAttrs);
                  int priority = t.getPriority();
                  if (priority<0 || priority>2) {
                    priority = 1;
                  }
                  final String[] priorities = new String[] {i18n("low"), i18n("normal"), i18n("hight")};
                  textElement("priority", myAttrs, priorities[priority], handler);
                }

                addAttribute("id", "tpd3", myAttrs);
                textElement("name", myAttrs, t.getName(), handler);

                addAttribute("id", "tpd4", myAttrs);
                textElement("begin", myAttrs, t.getStart().toString(), handler);

                addAttribute("id", "tpd5", myAttrs);
                textElement("end", myAttrs, t.getEnd().toString(), handler);
                textElement("milestone", myAttrs, Boolean.valueOf(
                        t.isMilestone()).toString(), handler);

                addAttribute("id", "tpd7", myAttrs);
                textElement("progress", myAttrs, String.valueOf(t
                        .getCompletionPercentage()), handler);

                addAttribute("id", "tpd6", myAttrs);
                textElement("duration", myAttrs, String.valueOf(t.getDuration().getLength()), handler);

                final List attachments = t.getAttachments();
                for (int i=0; i<attachments.size(); i++) {
                  Document nextAttachment = (Document)attachments.get(i);
                  URI nextUri = nextAttachment.getURI();
                  if (nextUri!=null) {
                    String strUri = URLDecoder.decode(nextUri.toString(), "utf-8");
                    if (strUri.startsWith("file:")) {
                      if (strUri.endsWith("/")) {
                        strUri = strUri.replaceAll("/+$", "");
                      }
                      int lastSlash = strUri.lastIndexOf('/');
                      if (lastSlash >= 0) {
                        addAttribute("display-name", strUri.substring(lastSlash+1), myAttrs);
                      }
                    }
                    textElement("attachment", myAttrs, strUri, handler);
                  }
                  else {
                    textElement("attachment", myAttrs, nextAttachment.getPath(), handler);
                  }
                }
                {
                  ProjectResource coordinator = t.getAssignmentCollection().getCoordinator();
                  if (coordinator!=null) {
                    addAttribute("id", "tpd8", myAttrs);
                    textElement("coordinator", myAttrs, coordinator.getName(), handler);
                  }
                }
                StringBuffer usersS = new StringBuffer();
                ResourceAssignment[] assignments = t.getAssignments();
                if (assignments.length > 0) {
                    for (int j = 0; j < assignments.length; j++) {
                      addAttribute("resource-id", assignments[j].getResource().getId(), myAttrs);
                      emptyElement("assigned-resource", myAttrs, handler);
                        usersS.append(assignments[j].getResource().getName());
                        if (j<assignments.length-1) {
                          usersS.append(getAssignedResourcesDelimiter());
                        }
                    }
                }

                addAttribute("id", "tpdResources", myAttrs);
                textElement("assigned-to", myAttrs, usersS.toString(), handler);
                if (t.getNotes()!=null && t.getNotes().length()>0) {
                  textElement("notes", myAttrs, t.getNotes(), handler);
                }
                if (t.getColor()!=null) {
                    textElement("color", myAttrs, getHexaColor(t.getColor()),
                            handler);
                }
                {
                  AttributesImpl attrs = new AttributesImpl();
                  CustomColumnsValues customValues = t.getCustomValues();
                  for (Iterator it = getCustomColumnStorage().getCustomColums().iterator();
                       it.hasNext();) {
                    CustomColumn nextColumn = (CustomColumn) it.next();
                    Object value = customValues.getValue(nextColumn.getName());
View Full Code Here

      return " ";
    }

    protected void writeResources(ResourceManager resourceManager,
            TransformerHandler handler) throws SAXException {
        AttributesImpl attrs = new AttributesImpl();
        addAttribute("title", i18n("resourcesList"), attrs);
        addAttribute("name", i18n("colName"), attrs);
        addAttribute("role", i18n("colRole"), attrs);
        addAttribute("mail", i18n("colMail"), attrs);
        addAttribute("phone", i18n("colPhone"), attrs);
View Full Code Here

import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;

class TaskSaver extends SaverBase {
    void save(IGanttProject project, TransformerHandler handler, Color defaultColor) throws SAXException, IOException {
        AttributesImpl attrs = new AttributesImpl();
        if (defaultColor!=null) {
          addAttribute("color", ColorConvertion.getColor(defaultColor), attrs);
        }
        startElement("tasks", attrs, handler);
View Full Code Here

    private void writeTask(TransformerHandler handler, GanttTask task, CustomColumnsStorage customColumns) throws SAXException, IOException {
        if (task.getTaskID() == -1) {
            throw new IllegalArgumentException("Is it a fake root task? Task="+task);
        }
        AttributesImpl attrs = new AttributesImpl();
        addAttribute("id", String.valueOf(task.getTaskID()), attrs);
        addAttribute("name", task.getName(), attrs);
        if (task.colorDefined()) {
            addAttribute("color", ColorConvertion.getColor(task.getColor()), attrs);
        }
View Full Code Here

TOP

Related Classes of org.xml.sax.helpers.AttributesImpl

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.