Package com.projity.datatype

Examples of com.projity.datatype.Duration


      Field endField = FieldDictionary.getInstance().getFieldFromId("Field.finish");
      Date start = (Date) getSummarizedValueForField(startField, node, nodeModel, context);
      Date end = (Date) getSummarizedValueForField(endField, node, nodeModel, context);

      double t = wc.compare(end.getTime(), start.getTime(), false);
      result = new Duration(Duration.getInstance(t / CalendarOption.getInstance().getMillisPerDay(), TimeUnit.DAYS));
      // TODO 8 IS A HACK REPLACE ALL THIS SECTION
    } else {
      if (nodeHasNonSummarizedValue(node, nodeModel)) {// if no summary
                                // or leaf
        result = getValue(object, context);
View Full Code Here


      typeCombo.setEnabled(!readOnly);
      lagTextField.setEnabled(!readOnly);
      removeButton.setEnabled(!readOnly);
    } else {
      try {
        Duration duration = (Duration) DurationFormat.getInstance().parseObject(lagTextField.getText());
        int type = ((Number)DependencyType.mapStringToValue(typeCombo.getSelectedItem().toString())).intValue();
       
       
//        dependency.setLag(duration.getEncodedMillis());
//        dependency.setDependencyType(type);
        DependencyService.getInstance().setFields(dependency,duration.getEncodedMillis(),type,this);
      } catch (ParseException e) {
        Alert.warn(Messages.getString("Message.invalidDuration"),this);
        return false;
      } catch (InvalidAssociationException e) {
        Alert.warn(e.getMessage(),this);
View Full Code Here

                                  // for undo
        // TODO this code is a hack and does not belong here.
        Dependency dependency = (Dependency) rowNode.getImpl();
        DependencyService dependencyService = DependencyService.getInstance();
        try {
          Duration duration = (Duration) ((col == 4) ? value : getValueAt(row, 4)); // TODO
                                                // can
                                                // not
                                                // assume
                                                // column
                                                // positions
          int type = ((Number) DependencyType.mapStringToValue((String) ((col == 3) ? value : getValueAt(row, 3)))).intValue();

          dependencyService.setFields(dependency, duration.getEncodedMillis(), type, this);
          dependencyService.update(dependency, this);
        } catch (InvalidAssociationException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
        }
View Full Code Here

    Integer type = (Integer) DependencyType.Format.getInstance().parseObject(string, pos);
   
    if (type == null)
      throw new ParseException(getErrorMessage(string), pos.getIndex());

    Duration duration;
    String durationPart = string.substring(pos.getIndex()).trim();

    if (durationPart.length() == 0) { // if a duration was entered, use it, otherwise 0
      duration = Duration.ZERO;
    } else {
      duration = (Duration) DurationFormat.getInstance().parseObject(string, pos);
      if (duration == null)
        throw new ParseException(getErrorMessage(string), pos.getIndex());
    }
    return Dependency.getInstanceparameters.isLeftAssociation() ? (HasDependencies)found : (HasDependencies)parameters.getThisObject(),
                    parameters.isLeftAssociation() ? (HasDependencies)parameters.getThisObject() : (HasDependencies)found,
                      type.intValue(),
                    duration.getEncodedMillis());
   
  }
View Full Code Here

      Field endField = FieldDictionary.getInstance().getFieldFromId("Field.finish");
      Date start = (Date) getSummarizedValueForField(startField, node, nodeModel, context);
      Date end = (Date) getSummarizedValueForField(endField, node, nodeModel, context);

      double t = wc.compare(end.getTime(), start.getTime(), false);
      result = new Duration(Duration.getInstance(t / CalendarOption.getInstance().getMillisPerDay(), TimeUnit.DAYS));
      // TODO 8 IS A HACK REPLACE ALL THIS SECTION
    } else {
      if (nodeHasNonSummarizedValue(node, nodeModel)) {// if no summary
                                // or leaf
        result = getValue(object, context);
View Full Code Here

    StringBuffer details = new StringBuffer();
    if (!DependencyType.isDefault(dependency.getDependencyType()) || hasLag)
      details.append(DependencyType.mapValueToString( new Integer(dependency.getDependencyType())));

    Duration duration = new Duration(dependency.getLag()); // use duration format to format duration
    if (hasLag) {
      details.append(DurationFormat.getSignedInstance().format(duration));
    }
    if (details.length() != 0) {
      if (parameters.isEncloseInBrackets())
View Full Code Here

        CommonSpreadSheetModel model=(CommonSpreadSheetModel)table.getModel();
        FontManager.setComponentFont(model.getCellProperties(model.getNode(row)),component);
    }
   
    if (value!=null&& value instanceof Duration){
      Duration duration=(Duration)value;
      component.setText(duration+"");
    }
   
    if (value instanceof String) component.setHorizontalAlignment(SwingConstants.LEFT);
    else component.setHorizontalAlignment(SwingConstants.RIGHT);
View Full Code Here

    public Object convert(Class type, Object value) throws ConversionException {
      if (value == null)
        return Duration.getInstanceFromDouble(null);
     
      if (value instanceof Number) {
        return new Duration(((Number)value).longValue());
      } else if (value instanceof Work) {
        return new Duration(((Work)value).longValue());
      } else if (value instanceof Duration) {
        return value;
      } else if (value instanceof String) {
        try {
          return DurationFormat.getInstance().parseObject((String) value);
View Full Code Here

TOP

Related Classes of com.projity.datatype.Duration

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.