Java Code Examples for org.tltv.gantt.client.shared.SubStep#setDescription()

The following examples show how to use org.tltv.gantt.client.shared.SubStep#setDescription() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractGhantChartManagerImpl.java    From cia with Apache License 2.0 6 votes vote down vote up
/**
 * Adds the view generic role member to step.
 *
 * @param stepName
 *            the step name
 * @param step
 *            the step
 * @param assignments
 *            the assignments
 * @param stepMapping
 *            the step mapping
 */
private void addViewGenericRoleMemberToStep(final String stepName, final Step step, final List<T> assignments,
		final StepMapping<T> stepMapping) {

	for (final T assignmentData : assignments) {

		String subStepName = "";

		if (stepMapping.getRoleCode(assignmentData) != null) {
			subStepName = new StringBuilder().append(stepMapping.getFirstName(assignmentData))
					.append(CONTENT_SEPARATOR).append(stepMapping.getLastName(assignmentData))
					.append(PARTY_START_TAG).append(stepMapping.getParty(assignmentData)).append(PARTY_END_TAG)
					.toString();
		}

		final SubStep sameRoleSubStep = new SubStep(stepName + '.' + subStepName,CaptionMode.HTML);
		sameRoleSubStep.setDescription(stepName + '.' + subStepName);			
		sameRoleSubStep.setBackgroundColor(stepMapping.getBackgroundColor(assignmentData));

		sameRoleSubStep.setStartDate(stepMapping.getFromDate(assignmentData).getTime());
		sameRoleSubStep.setEndDate(stripDatesAfterCurrentDate(stepMapping.getToDate(assignmentData)).getTime());

		step.addSubStep(sameRoleSubStep);
	}
}
 
Example 2
Source File: DemoUI.java    From gantt with Apache License 2.0 5 votes vote down vote up
private SubStep addSubStep(final NativeSelect parentStepSelect, AbstractStep dataSource) {
    SubStep subStep = new SubStep();
    subStep.setCaption(dataSource.getCaption());
    subStep.setCaptionMode(dataSource.getCaptionMode());
    subStep.setStartDate(dataSource.getStartDate());
    subStep.setEndDate(dataSource.getEndDate());
    subStep.setBackgroundColor(dataSource.getBackgroundColor());
    subStep.setDescription(dataSource.getDescription());
    subStep.setProgress(dataSource.getProgress());
    subStep.setShowProgress(dataSource.isShowProgress());
    subStep.setStyleName(dataSource.getStyleName());
    ((Step) parentStepSelect.getValue()).addSubStep(subStep);
    return subStep;
}
 
Example 3
Source File: StorageAdminPanel.java    From sensorhub with Mozilla Public License 2.0 4 votes vote down vote up
protected Gantt buildGantt(IRecordStorageModule<?> storage, IRecordStoreInfo recordInfo)
{
    double[] timeRange = storage.getRecordsTimeRange(recordInfo.getName());
    timeRange[0] -= 3600;
    timeRange[1] += 3600;
    
    Gantt gantt = new Gantt();
    gantt.setWidth(100, Unit.PERCENTAGE);
    gantt.setHeight(130, Unit.PIXELS);
    gantt.setResizableSteps(false);
    gantt.setMovableSteps(false);
    gantt.setStartDate(new Date((long)(timeRange[0]*1000)));
    gantt.setEndDate(new Date((long)(timeRange[1]*1000)));        
    gantt.setYearsVisible(false);
    gantt.setTimelineMonthFormat("MMMM yyyy");
    gantt.setResolution(Resolution.Hour);
    
    Step dataTimeRange = new Step(getPrettyName(recordInfo.getRecordDescription()));
    dataTimeRange.setBackgroundColor("FFFFFF");
    dataTimeRange.setStartDate((long)(timeRange[0]*1000));
    dataTimeRange.setEndDate((long)(timeRange[1]*1000));
            
    // add periods when data is actually available
    Iterator<double[]> clusterTimes = storage.getRecordsTimeClusters(recordInfo.getName());
    while (clusterTimes.hasNext())
    {
        timeRange = clusterTimes.next();
        SubStep clusterPeriod = new SubStep();
        clusterPeriod.setStartDate((long)(timeRange[0]*1000));
        clusterPeriod.setEndDate((long)(timeRange[1]*1000));
        dataTimeRange.addSubStep(clusterPeriod);
        
        clusterPeriod.setDescription(
                new DateTimeFormat().formatIso(timeRange[0], 0) + " / " +
                new DateTimeFormat().formatIso(timeRange[1], 0)
        );
    }        
    
    gantt.addStep(dataTimeRange);
    
    gantt.addClickListener(new Gantt.ClickListener() {
        private static final long serialVersionUID = 1L;
        public void onGanttClick(org.tltv.gantt.Gantt.ClickEvent event) {
            System.out.println("click");
        }
    });
    
    return gantt;
}