@Override
 public void actionPerformed(ActionEvent arg0) {
   final GanttDialogPublicHoliday dialog = new GanttDialogPublicHoliday(myProject);
   Component dialogContent = dialog.getContentPane();
   myUIFacade
       .createDialog(
           dialogContent,
           new Action[] {
             new OkAction() {
               @Override
               public void actionPerformed(ActionEvent e) {
                 updateHolidays(dialog.getHolidays());
                 myProject.setModified();
                 try {
                   myProject
                       .getTaskManager()
                       .getAlgorithmCollection()
                       .getRecalculateTaskScheduleAlgorithm()
                       .run();
                 } catch (TaskDependencyException e1) {
                   GPLogger.getLogger(PublicHolidayDialogAction.class)
                       .log(Level.SEVERE, "Exception after changing holidays", e1);
                 }
                 myUIFacade.getActiveChart().reset();
               }
             },
             CancelAction.EMPTY
           },
           "")
       .show();
 }
示例#2
0
  public void save(UIFacade facade, TransformerHandler handler) throws SAXException {
    AttributesImpl attrs = new AttributesImpl();
    addAttribute(
        "zooming-state", facade.getZoomManager().getZoomState().getPersistentName(), attrs);
    addAttribute("id", "gantt-chart", attrs);
    startElement("view", attrs, handler);
    writeColumns(facade.getTaskTree().getVisibleFields(), handler);
    new OptionSaver()
        .saveOptionList(handler, facade.getGanttChart().getTaskLabelOptions().getOptions());
    writeTimelineTasks(facade, handler);
    writeRecentColors(handler);
    endElement("view", handler);

    addAttribute("id", "resource-table", attrs);
    startElement("view", attrs, handler);
    writeColumns(facade.getResourceTree().getVisibleFields(), handler);

    endElement("view", handler);
  }
示例#3
0
 /** Create a popup menu when mouse click */
 private void createPopupMenu(int x, int y) {
   Action[] popupMenuActions = getPopupMenuActions();
   JScrollBar vbar = getTreeTable().getVerticalScrollBar();
   myUIFacade.showPopupMenu(
       this,
       popupMenuActions,
       x
           - getTreeTable().getHorizontalScrollBar().getValue()
           + (vbar.isVisible() ? vbar.getWidth() : 0),
       y - vbar.getValue() + getTreeTable().getTable().getTableHeader().getHeight());
 }
示例#4
0
 /**
  * Writes tasks explicitly shown in the timeline as comma-separated list of task identifiers in
  * CDATA section of <timeline> element.
  */
 private void writeTimelineTasks(UIFacade facade, TransformerHandler handler) throws SAXException {
   AttributesImpl attrs = new AttributesImpl();
   Set<Task> timelineTasks = facade.getCurrentTaskView().getTimelineTasks();
   if (timelineTasks.isEmpty()) {
     return;
   }
   Function<Task, String> getId =
       new Function<Task, String>() {
         @Override
         public String apply(Task t) {
           return String.valueOf(t.getTaskID());
         }
       };
   cdataElement(
       "timeline",
       Joiner.on(',').join(Collections2.transform(timelineTasks, getId)),
       attrs,
       handler);
 }
 @Override
 public void actionPerformed(ActionEvent e) {
   for (GPOptionGroup group : myChart.getOptionGroups()) {
     group.lock();
   }
   final OkAction okAction =
       new OkAction() {
         @Override
         public void actionPerformed(ActionEvent e) {
           commit();
         }
       };
   final CancelAction cancelAction =
       new CancelAction() {
         @Override
         public void actionPerformed(ActionEvent e) {
           rollback();
         }
       };
   myUIFacade
       .createDialog(createDialogComponent(), new Action[] {okAction, cancelAction}, "")
       .show();
 }
示例#6
0
 @Override
 protected Chart getChart() {
   return myUIFacade.getGanttChart();
 }