Exemplo n.º 1
0
  public void setFields(Node node, NodeModel model) {
    for (Iterator i = fieldComponents.keySet().iterator(); i.hasNext(); ) {
      String fieldId = (String) i.next();
      Field field = Configuration.getFieldFromId(fieldId);
      Object value = field.getValue(node, model, null);

      String stringValue = "";
      if (value != null) stringValue = FieldConverter.toString(value);
      Object textComp = fieldComponents.get(fieldId);
      if (textComp instanceof JLabel) ((JLabel) textComp).setText(stringValue);
      else {
        ((ChangeAwareTextField) textComp).setText(stringValue);
        ((ChangeAwareComponent) textComp).resetChange();
      }
    }
  }
Exemplo n.º 2
0
  public List getChange() {
    ArrayList change = new ArrayList();
    for (Iterator i = fieldComponents.keySet().iterator(); i.hasNext(); ) {
      String fieldId = (String) i.next();
      Object component = fieldComponents.get(fieldId);
      if (component instanceof ChangeAwareComponent
          && ((ChangeAwareComponent) component).hasChanged()) {
        String stringValue;
        if (component instanceof JTextField) stringValue = ((JTextField) component).getText();
        // hangle other components here
        else continue;

        Field field = Configuration.getFieldFromId(fieldId);
        try {
          Object value = FieldConverter.fromString(stringValue, field.getDisplayType());
          change.add(new FieldChange(field, value));
        } catch (Exception e) {
          Alert.error(e.getMessage());
        }
      }
    }
    return change;
  }
Exemplo n.º 3
0
  public static void clear(boolean graphic) {
    ProjectFactory.getInstance()
        .setPromptDisabled(true); // prevent remove projects job from prompting to save
    Job job =
        ProjectFactory.getInstance().getPortfolio().getRemoveAllProjectsJob(null, false, null);
    SessionFactory.getInstance().getLocalSession().schedule(job);
    try {
      job.waitResult();
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    if (graphic) {
      GraphicManager gm = GraphicManager.getInstance();
      if (gm != null) ((DefaultFrameManager) gm.getFrameManager()).cleanUp(false);
    }
    ProjectFactory.getInstance().getPortfolio().getObjectEventManager().removeAll();
    ProjectFactory.getInstance().setPromptDisabled(false); // enable prompting again

    // Singletons, most of them can cause problems when it re-used.
    // Other singletons shouldn't be problem but have a cleanUp method just in case
    SessionFactory.cleanUp();
    ProjectFactory.cleanUp();
    ResourcePoolFactory.cleanUp();
    UniqueIdPool.cleanUp();
    MainFrame.cleanUp();
    GraphicManager.cleanUpStatic();
    StartupFactory.cleanUpStatic();

    CalendarCatalog.cleanUp();
    CalendarDefinition.cleanUp();
    CalendarService.cleanUp();
    WorkingCalendar.cleanUp();

    AdvancedOption.cleanUp();
    CalculationOption.cleanUp();
    CalendarOption.cleanUp();
    EditOption.cleanUp();
    GanttOption.cleanUp();
    GeneralOption.cleanUp();
    ScheduleOption.cleanUp();
    TimesheetOption.cleanUp();

    FieldConverter.cleanUp();

    ActionLists.cleanUp();
    CellStyles.cleanUp();
    Configuration.cleanUp();
    Dictionary.cleanUp();

    Factory.cleanUp();
    ImportedCalendarService.cleanUp(); // remove dep
    NotAssignmentFilter.cleanUp();
    NotVoidFilter.cleanUp();
    HelpUtil.cleanUp();
    ZeroFunctor.cleanUp();
    NameCellComponent.cleanUp();
    ScheduleService.cleanUp();
    PageSizes.cleanUp();
    ContextStore.cleanUp();
    CustomFieldsMapper.cleanUp(); // remove dep
  }