List of usage examples for com.vaadin.ui Notification show
public static Notification show(String caption, Type type)
From source file:com.piccritic.website.post.CreatePost.java
@Override public void uploadSucceeded(SucceededEvent event) { // Show the uploaded file in the image viewer confirm.setEnabled(true);//w w w.jav a2 s . c o m image.setVisible(true); image.setSource(new FileResource(receiver.getFile())); Notification.show("Image Saved", Type.TRAY_NOTIFICATION); upload.setButtonCaption(null); }
From source file:com.piccritic.website.post.CreatePost.java
/** * Validates data and asks back-end to upload post. * /* w ww.j a v a 2 s.c o m*/ * @param event */ private void confirmUpload(Button.ClickEvent event) { try { title.validate(); description.validate(); post.setDescription(description.getValue()); post.setTitle(title.getValue()); post.setLicense(license.getValue()); Collection<String> tagCollection = tags.getTags(); Set<Tag> tagSet = new HashSet<Tag>(); for (String t : tagCollection) { Tag tag = new Tag(); tag.setTag(t); //Set<Post> posts = tag.getPosts(); //posts.add(post); //tag.setPosts(posts); tagservice.insertTag(tag); tagSet.add(tag); } post.setTags(tagSet); if (service != null) { Album defaultAlbum = service.getDefaultAlbum(LoginService.getHandle()); post.setAlbum(defaultAlbum); Post created = service.createPost(post); Set<Post> posts = new HashSet<>(); posts.add(post); defaultAlbum.setPosts(posts); service.updateAlbum(post.getAlbum()); if (created != null) { Notification.show("Post Uploaded", Type.TRAY_NOTIFICATION); close(); String postLocation = "#!post/" + post.getPath(); UI.getCurrent().getPage().setLocation(postLocation); UI.getCurrent().getPage().reload(); } } Notification.show("Could not create post.", Type.WARNING_MESSAGE); } catch (PostException | AlbumException | TagException e) { upload.interruptUpload(); Notification.show(e.getMessage(), Type.WARNING_MESSAGE); } }
From source file:com.piccritic.website.post.ViewPost.java
@Override public void enter(ViewChangeEvent event) { PostServiceInterface service = MasterService.postService; post = service.getPost(event.getParameters()); if (post == null) { Notification.show("Error 404" + event.getParameters(), Type.ERROR_MESSAGE); return;//from w ww . j ava 2s . c o m } commentForm.setPost(post); image.setCaption(post.getTitle()); image.setSource(new FileResource(new File(post.getPath()))); image.setSizeFull(); postDescription.setValue(post.getDescription()); license.setCaption(post.getLicense().getLicenseType()); if (event.getParameters().matches("users/" + LoginService.getHandle() + "/.*")) { addComponent(delete); delete.addClickListener(e -> { try { service.deletePost(post); Notification.show("Post deleted successfuly", Type.TRAY_NOTIFICATION); } catch (PostException | CommentException | VoteException e1) { Notification.show(e1.getLocalizedMessage(), Type.WARNING_MESSAGE); } }); addComponent(edit); edit.addClickListener(e -> { UI.getCurrent().addWindow(new CreatePost(LoginService.getHandle(), post)); }); } if (LoginService.getLoginStatus() == LoginStatus.LOGGED_IN) { addComponent(commentForm); } try { comments = fs.getComments(post); } catch (PostException e) { e.printStackTrace(); } for (Comment comment : comments) { CommentComponent commentComponent = new CommentComponent(comment, fs, us); addComponent(commentComponent); } }
From source file:com.piccritic.website.user.UserForm.java
public void save(Button.ClickEvent e) { saveUser();/*from ww w .j a va 2s . c o m*/ String status; if (!password.getValue().equals(confirmPass.getValue())) { Notification.show(passwordMatch, Type.WARNING_MESSAGE); return; } if ((!newProfile && !password.getValue().isEmpty()) && password.getValue().length() < 8) { Notification.show(passwordLength, Type.WARNING_MESSAGE); return; } try { if (newProfile) { status = MasterService.userService.create(critic, password.getValue()); } else { status = MasterService.userService.update(critic, password.getValue()); } } catch (UserException ue) { Notification.show(ue.getLocalizedMessage(), Type.WARNING_MESSAGE); return; } Notification.show(status, Type.TRAY_NOTIFICATION); closeWindow(); }
From source file:com.piccritic.website.user.UserForm.java
public void cancel(Button.ClickEvent e) { Notification.show(cancelNotif, Type.TRAY_NOTIFICATION); closeWindow(); }
From source file:com.pms.component.ganttchart.DemoUI.java
License:Apache License
private void createGantt() { gantt = new Gantt(); gantt.setWidth(100, Sizeable.Unit.PERCENTAGE); gantt.setHeight(500, Sizeable.Unit.PIXELS); gantt.setResizableSteps(true);//from w w w .ja va 2 s. co m gantt.setMovableSteps(true); gantt.addAttachListener(ganttAttachListener); Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); gantt.setStartDate(cal.getTime()); cal.add(Calendar.YEAR, 1); gantt.setEndDate(cal.getTime()); cal.setTime(new Date()); Step step1 = new Step("First step"); step1.setDescription("Description tooltip"); step1.setStartDate(cal.getTime().getTime()); cal.add(Calendar.MONTH, 2); step1.setEndDate(cal.getTime().getTime()); Step step2 = new Step("Second step"); step2.setDescription("Description tooltip for second step"); cal.add(Calendar.DATE, 1); step2.setStartDate(cal.getTime().getTime()); cal.add(Calendar.MONTH, 4); step2.setEndDate(cal.getTime().getTime()); step2.setPredecessor(step1); Step step3 = new Step("Third step"); step3.setDescription("<b>HTML</b> <i>content</i> is <u>supported</u> in tooltips."); cal.add(Calendar.DATE, 1); step3.setStartDate(cal.getTime().getTime()); cal.add(Calendar.MONTH, 12); step3.setEndDate(cal.getTime().getTime()); step3.setPredecessor(step2); Step step4 = new Step("Fourth step"); step4.setDescription("Tooltip is <b>VTooltip</b>. <p>Looks same for all Vaadin components."); step4.setStartDate(step2.getStartDate()); step4.setEndDate(step2.getEndDate()); step4.setPredecessor(step1); Step stepWithSubSteps = new Step("Step with sub-steps"); stepWithSubSteps.setDescription("Tooltip for Step with sub-steps"); cal.setTime(new Date(step1.getStartDate())); cal.add(Calendar.DATE, 7); SubStep subStep1 = new SubStep("Sub-step A"); subStep1.setDescription("Tooltip for Sub-step A"); subStep1.setBackgroundColor("A8D9DD"); subStep1.setStartDate(step1.getStartDate()); subStep1.setEndDate(cal.getTime()); SubStep subStep2 = new SubStep("Sub-step B"); subStep2.setDescription("Tooltip for Sub-step B"); subStep2.setBackgroundColor("A8D9BB"); subStep2.setStartDate(cal.getTime()); cal.add(Calendar.MONTH, 1); subStep2.setEndDate(cal.getTime()); SubStep subStep3 = new SubStep("Sub-step C"); subStep3.setDescription("Tooltip for Sub-step C"); subStep3.setBackgroundColor("A8D999"); subStep3.setStartDate(cal.getTime()); cal.add(Calendar.MONTH, 1); subStep3.setEndDate(step1.getEndDate()); stepWithSubSteps.addSubStep(subStep1); stepWithSubSteps.addSubStep(subStep2); stepWithSubSteps.addSubStep(subStep3); gantt.addStep(step1); gantt.addStep(step2); gantt.addStep(step3); gantt.addStep(step4); gantt.addStep(stepWithSubSteps); String[] colors = new String[] { "11FF11", "33FF33", "55FF55", "77FF77", "99FF99", "BBFFBB", "DDFFDD" }; cal.setTime(new Date()); for (int i = 0; i < 10; i++) { Step step = new Step("Step " + i); step.setStartDate(cal.getTime().getTime()); cal.add(Calendar.DATE, 14); step.setEndDate(cal.getTime().getTime()); step.setBackgroundColor(colors[i % colors.length]); gantt.addStep(step); } gantt.addClickListener(new Gantt.ClickListener() { @Override public void onGanttClick(Gantt.ClickEvent event) { openStepEditor(event.getStep()); } }); gantt.addMoveListener(new Gantt.MoveListener() { @Override public void onGanttMove(MoveEvent event) { Date start = new Date(event.getStartDate()); Date end = new Date(event.getEndDate()); dateFormat.setTimeZone(gantt.getTimeZone()); Notification.show("Moved " + event.getStep().getCaption() + " to Start Date: " + dateFormat.format(start) + " End Date: " + dateFormat.format(end), Type.TRAY_NOTIFICATION); } }); gantt.addResizeListener(new Gantt.ResizeListener() { @Override public void onGanttResize(ResizeEvent event) { Date start = new Date(event.getStartDate()); Date end = new Date(event.getEndDate()); dateFormat.setTimeZone(gantt.getTimeZone()); Notification.show("Resized " + event.getStep().getCaption() + " to Start Date: " + dateFormat.format(start) + " End Date: " + dateFormat.format(end), Type.TRAY_NOTIFICATION); } }); }
From source file:com.pms.component.ganttchart.GanttChart.java
License:Apache License
private void createGantt(Project project) { gantt = new Gantt(); gantt.setWidth(100, Sizeable.Unit.PERCENTAGE); gantt.setHeight(400, Sizeable.Unit.PIXELS); gantt.setResizableSteps(true);/*w w w . j a v a 2 s . c om*/ gantt.setMovableSteps(true); gantt.addAttachListener(ganttAttachListener); Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); gantt.setStartDate(cal.getTime()); cal.add(Calendar.YEAR, 1); gantt.setEndDate(cal.getTime()); cal.setTime(new Date()); Step step1 = new Step("First step"); step1.setDescription("Description tooltip"); step1.setStartDate(cal.getTime().getTime()); cal.add(Calendar.MONTH, 2); step1.setEndDate(cal.getTime().getTime()); Step step2 = new Step("Second step"); step2.setDescription("Description tooltip for second step"); cal.add(Calendar.DATE, 1); step2.setStartDate(cal.getTime().getTime()); cal.add(Calendar.MONTH, 4); step2.setEndDate(cal.getTime().getTime()); step2.setPredecessor(step1); Step step3 = new Step("Third step"); step3.setDescription("<b>HTML</b> <i>content</i> is <u>supported</u> in tooltips."); cal.add(Calendar.DATE, 1); step3.setStartDate(cal.getTime().getTime()); cal.add(Calendar.MONTH, 12); step3.setEndDate(cal.getTime().getTime()); step3.setPredecessor(step2); Step step4 = new Step("Fourth step"); step4.setDescription("Tooltip is <b>VTooltip</b>. <p>Looks same for all Vaadin components."); step4.setStartDate(step2.getStartDate()); step4.setEndDate(step2.getEndDate()); step4.setPredecessor(step1); Step stepWithSubSteps = new Step("Step with sub-steps"); stepWithSubSteps.setDescription("Tooltip for Step with sub-steps"); cal.setTime(new Date(step1.getStartDate())); cal.add(Calendar.DATE, 7); SubStep subStep1 = new SubStep("Sub-step A"); subStep1.setDescription("Tooltip for Sub-step A"); subStep1.setBackgroundColor("A8D9DD"); subStep1.setStartDate(step1.getStartDate()); subStep1.setEndDate(cal.getTime()); SubStep subStep2 = new SubStep("Sub-step B"); subStep2.setDescription("Tooltip for Sub-step B"); subStep2.setBackgroundColor("A8D9BB"); subStep2.setStartDate(cal.getTime()); cal.add(Calendar.MONTH, 1); subStep2.setEndDate(cal.getTime()); SubStep subStep3 = new SubStep("Sub-step C"); subStep3.setDescription("Tooltip for Sub-step C"); subStep3.setBackgroundColor("A8D999"); subStep3.setStartDate(cal.getTime()); cal.add(Calendar.MONTH, 1); subStep3.setEndDate(step1.getEndDate()); stepWithSubSteps.addSubStep(subStep1); stepWithSubSteps.addSubStep(subStep2); stepWithSubSteps.addSubStep(subStep3); gantt.addStep(step1); gantt.addStep(step2); gantt.addStep(step3); gantt.addStep(step4); gantt.addStep(stepWithSubSteps); String[] colors = new String[] { "11FF11", "33FF33", "55FF55", "77FF77", "99FF99", "BBFFBB", "DDFFDD" }; cal.setTime(new Date()); for (int i = 0; i < 10; i++) { Step step = new Step("Step " + i); step.setStartDate(cal.getTime().getTime()); cal.add(Calendar.DATE, 14); step.setEndDate(cal.getTime().getTime()); step.setBackgroundColor(colors[i % colors.length]); gantt.addStep(step); } gantt.addClickListener(new Gantt.ClickListener() { @Override public void onGanttClick(Gantt.ClickEvent event) { openStepEditor(event.getStep()); } }); gantt.addMoveListener(new Gantt.MoveListener() { @Override public void onGanttMove(MoveEvent event) { Date start = new Date(event.getStartDate()); Date end = new Date(event.getEndDate()); dateFormat.setTimeZone(gantt.getTimeZone()); Notification.show("Moved " + event.getStep().getCaption() + " to Start Date: " + dateFormat.format(start) + " End Date: " + dateFormat.format(end), Type.TRAY_NOTIFICATION); } }); gantt.addResizeListener(new Gantt.ResizeListener() { @Override public void onGanttResize(ResizeEvent event) { Date start = new Date(event.getStartDate()); Date end = new Date(event.getEndDate()); dateFormat.setTimeZone(gantt.getTimeZone()); Notification.show("Resized " + event.getStep().getCaption() + " to Start Date: " + dateFormat.format(start) + " End Date: " + dateFormat.format(end), Type.TRAY_NOTIFICATION); } }); }
From source file:com.pms.component.ganttchart.scheduletask.TaskGanntChart.java
License:Apache License
private void createGantt(Project project) { gantt = new Gantt(); gantt.setWidth(100, Sizeable.Unit.PERCENTAGE); gantt.setHeight(460, Sizeable.Unit.PIXELS); gantt.setResizableSteps(true);//from w w w .j a v a 2s .c o m gantt.setMovableSteps(true); gantt.addAttachListener(ganttAttachListener); Calendar cal = Calendar.getInstance(); Date date = new Date(); date.setYear(2015); date.setMonth(0); date.setDate(5); // date.setTime(0); cal.setTime(date); cal.set(Calendar.HOUR, 0); gantt.setStartDate(cal.getTime()); cal.add(Calendar.DATE, 360); gantt.setEndDate(cal.getTime()); cal.setTime(date); gantt.setYearsVisible(false); gantt.setMonthsVisible(false); gantt.setResolution(org.tltv.gantt.client.shared.Resolution.Week); gantt.setReadOnly(true); /* UserStoryDAO userStoryDAO =(UserStoryDAO)DashboardUI.context.getBean("UserStory"); List<Task> taskList = new ArrayList<Task>(); taskList.addAll(userStoryDAO.getUserStoryTaskList(userStory)); List<Task> priority1Tasks = new ArrayList<Task>(); List<Task> priority2Tasks = new ArrayList<Task>(); List<Task> priority3Tasks = new ArrayList<Task>(); List<Task> priority4Tasks = new ArrayList<Task>(); List<Task> priority5Tasks = new ArrayList<Task>(); for (Task task : taskList) { switch (task.getPriority()) { case 1: priority1Tasks.add(task); break; case 2: priority2Tasks.add(task); break; case 3: priority3Tasks.add(task); break; case 4: priority4Tasks.add(task); break; case 5: priority5Tasks.add(task); break; } } String[] colors = new String[] { "11FF11", "33FF33", "55FF55", "77FF77", "99FF99", "BBFFBB", "DDFFDD" }; cal.setTime(new Date()); for (Task task1 : priority1Tasks) { Step step = new Step(task1.getName()); step.setStartDate(cal.getTime().getTime()); cal.add(Calendar.DATE, 14); step.setEndDate(cal.getTime().getTime()); step.setBackgroundColor(colors[10 % colors.length]); gantt.addStep(step); } for (Task task1 : priority2Tasks) { Step step = new Step(task1.getName()); step.setStartDate(cal.getTime().getTime()); cal.add(Calendar.DATE, 14); step.setEndDate(cal.getTime().getTime()); step.setBackgroundColor(colors[10 % colors.length]); gantt.addStep(step); } for (Task task1 : priority3Tasks) { Step step = new Step(task1.getName()); step.setStartDate(cal.getTime().getTime()); cal.add(Calendar.DATE, 14); step.setEndDate(cal.getTime().getTime()); step.setBackgroundColor(colors[10 % colors.length]); gantt.addStep(step); } for (Task task1 : priority4Tasks) { Step step = new Step(task1.getName()); step.setStartDate(cal.getTime().getTime()); cal.add(Calendar.DATE, 14); step.setEndDate(cal.getTime().getTime()); step.setBackgroundColor(colors[10 % colors.length]); gantt.addStep(step); } for (Task task1 : priority5Tasks) { Step step = new Step(task1.getName()); step.setStartDate(cal.getTime().getTime()); cal.add(Calendar.DATE, 14); step.setEndDate(cal.getTime().getTime()); step.setBackgroundColor(colors[10 % colors.length]); gantt.addStep(step); } */ //this prioritize task because otherwise working userstory can be null PrioritizeUserStories prioritizeUserStories = new PrioritizeUserStories(); Map userStorieMap = prioritizeUserStories.getPrioritizeUserStoryMap(project); PrioritizeTasks prioritizeTasks = new PrioritizeTasks(); UserStoryDAO userStoryDAO = (UserStoryDAO) DashboardUI.context.getBean("UserStory"); UserStory userStory = userStoryDAO.getCurrentWorkingUserStory(project); Map taskMap = prioritizeTasks.getPrioritizeTaskMap(userStory); Step previosStep = null; System.out.println(taskMap.toString()); Iterator it = taskMap.entrySet().iterator(); while (it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); //System.out.println(pair.getKey() + " = " + pair.getValue()); it.remove(); Task task1 = (Task) pair.getValue(); Step step1 = new Step(task1.getName()); step1.setDescription(task1.getName()); step1.setStartDate(cal.getTime().getTime()); cal.add(Calendar.DATE, Integer.parseInt(task1.getEstimateTime()) * 7); step1.setEndDate(cal.getTime().getTime()); //Change color of background according to state of task if (task1.getState().equals("initial")) { step1.setBackgroundColor("#A9F5F2"); } else if (task1.getState().equals("working")) { step1.setBackgroundColor("#D0F5A9"); } else if (task1.getState().equals("done")) { step1.setBackgroundColor("#F5D0A9"); } if (previosStep == null) { gantt.addStep(step1); previosStep = step1; } else { step1.setPredecessor(previosStep); gantt.addStep(step1); previosStep = step1; } } gantt.addClickListener(new Gantt.ClickListener() { @Override public void onGanttClick(Gantt.ClickEvent event) { openStepEditor(event.getStep()); } }); gantt.addMoveListener(new Gantt.MoveListener() { @Override public void onGanttMove(MoveEvent event) { Date start = new Date(event.getStartDate()); Date end = new Date(event.getEndDate()); dateFormat.setTimeZone(gantt.getTimeZone()); Notification.show("Moved " + event.getStep().getCaption() + " to Start Date: " + dateFormat.format(start) + " End Date: " + dateFormat.format(end), Type.TRAY_NOTIFICATION); } }); gantt.addResizeListener(new Gantt.ResizeListener() { @Override public void onGanttResize(ResizeEvent event) { Date start = new Date(event.getStartDate()); Date end = new Date(event.getEndDate()); dateFormat.setTimeZone(gantt.getTimeZone()); Notification.show("Resized " + event.getStep().getCaption() + " to Start Date: " + dateFormat.format(start) + " End Date: " + dateFormat.format(end), Type.TRAY_NOTIFICATION); } }); }
From source file:com.pms.component.ganttchart.scheduletask.UserStoryGanntChart.java
License:Apache License
private void createGantt(Project project) { gantt = new Gantt(); gantt.setWidth(100, Sizeable.Unit.PERCENTAGE); gantt.setHeight(460, Sizeable.Unit.PIXELS); gantt.setResizableSteps(true);// w ww . j a v a 2 s . c o m gantt.setMovableSteps(true); gantt.addAttachListener(ganttAttachListener); Calendar cal = Calendar.getInstance(); Date date = new Date(); date.setYear(2015); date.setMonth(0); date.setDate(5); // date.setTime(0); cal.setTime(date); cal.set(Calendar.HOUR, 0); gantt.setStartDate(cal.getTime()); cal.add(Calendar.DATE, 105); gantt.setEndDate(cal.getTime()); cal.setTime(date); gantt.setYearsVisible(false); gantt.setMonthsVisible(false); gantt.setResolution(org.tltv.gantt.client.shared.Resolution.Week); gantt.setReadOnly(true); PrioritizeUserStories prioritizeUserStories = new PrioritizeUserStories(); Map userStorieMap = prioritizeUserStories.getPrioritizeUserStoryMap(project); Step previosStep = null; System.out.println(userStorieMap.toString()); Iterator it = userStorieMap.entrySet().iterator(); while (it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); UserStory userStory = (UserStory) pair.getValue(); //System.out.println(pair.getKey() + " = " + pair.getValue()); it.remove(); Step step1 = new Step(((UserStory) pair.getValue()).getName()); step1.setDescription(((UserStory) pair.getValue()).getName()); step1.setStartDate(cal.getTime()); cal.add(Calendar.DATE, 7); step1.setEndDate(cal.getTime()); if (userStory.getState().equals("initial")) { step1.setBackgroundColor("#A9F5F2"); } else if (userStory.getState().equals("working")) { step1.setBackgroundColor("#D0F5A9"); } else if (userStory.getState().equals("done")) { step1.setBackgroundColor("#F5D0A9"); } if (previosStep == null) { gantt.addStep(step1); previosStep = step1; } else { step1.setPredecessor(previosStep); gantt.addStep(step1); previosStep = step1; } } gantt.addClickListener(new Gantt.ClickListener() { @Override public void onGanttClick(Gantt.ClickEvent event) { openStepEditor(event.getStep()); } }); gantt.addMoveListener(new Gantt.MoveListener() { @Override public void onGanttMove(MoveEvent event) { Date start = new Date(event.getStartDate()); Date end = new Date(event.getEndDate()); dateFormat.setTimeZone(gantt.getTimeZone()); Notification.show("Moved " + event.getStep().getCaption() + " to Start Date: " + dateFormat.format(start) + " End Date: " + dateFormat.format(end), Type.TRAY_NOTIFICATION); } }); gantt.addResizeListener(new Gantt.ResizeListener() { @Override public void onGanttResize(ResizeEvent event) { Date start = new Date(event.getStartDate()); Date end = new Date(event.getEndDate()); dateFormat.setTimeZone(gantt.getTimeZone()); Notification.show("Resized " + event.getStep().getCaption() + " to Start Date: " + dateFormat.format(start) + " End Date: " + dateFormat.format(end), Type.TRAY_NOTIFICATION); } }); }
From source file:com.pms.component.member.taskganntchart.TaskGanttChart.java
License:Apache License
private void createGantt(Project project) { gantt = new Gantt(); gantt.setWidth(100, Sizeable.Unit.PERCENTAGE); gantt.setHeight(400, Sizeable.Unit.PIXELS); gantt.setResizableSteps(false);/* ww w. j a v a 2 s.c o m*/ gantt.setMovableSteps(true); gantt.addAttachListener(ganttAttachListener); //gantt.setYearsVisible(false); gantt.setMonthsVisible(false); Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); gantt.setStartDate(cal.getTime()); cal.add(Calendar.HOUR, 80); gantt.setEndDate(cal.getTime()); cal.setTime(new Date()); final TaskDAO taskDAO = (TaskDAO) DashboardUI.context.getBean("Task"); UserStoryDAO userStoryDAO = (UserStoryDAO) DashboardUI.context.getBean("UserStory"); UserStory userStory = userStoryDAO.getCurrentWorkingUserStory(project); List<Task> taskMap = null; //taskDAO.getAllTasksForUSerStory(userStory); if (userStory != null) { taskMap = taskDAO.getAllTasksForUSerStory(userStory); Step previosStep = null; //System.out.println(taskMap.toString()); long startTime = 0; for (int i = 0; i < taskMap.size(); i++) { Task task1 = taskMap.get(i); Step step1 = new Step(task1.getAssignedTo()); step1.setDescription(task1.getName()); if (i == 0) { startTime = cal.getTime().getTime(); } //System.out.println("Start Time : " + (startTime+Integer.parseInt(task1.getStartTime())*3600*1000) +"/ Start Hour : " +(startTime+Integer.parseInt(task1.getStartTime())*3600*1000)/3600000); //System.out.println("Get Start Time : "+task1.getStartTime()); //System.out.println("Get Estimate Time : "+task1.getEstimateTime()); step1.setStartDate(startTime + Integer.parseInt(task1.getStartTime()) * 3600 * 1000); cal.add(Calendar.HOUR, Integer.parseInt(task1.getEstimateTime())); step1.setEndDate(startTime + Integer.parseInt(task1.getStartTime()) * 3600 * 1000 + Integer.parseInt(task1.getEstimateTime()) * 3600 * 1000);//cal.getTime().getTime() //System.out.println("End Time : "+startTime+Integer.parseInt(task1.getStartTime())*3600*1000 + Integer.parseInt(task1.getEstimateTime())*3600*1000 +"/End Hour : " + (startTime+Integer.parseInt(task1.getStartTime())*3600*1000 + Integer.parseInt(task1.getEstimateTime())*3600*1000)/3600000); //Change color of background according to state of task if (task1.getState().equals("initial")) { step1.setBackgroundColor("#A9F5F2"); } else if (task1.getState().equals("working")) { step1.setBackgroundColor("#D0F5A9"); } else if (task1.getState().equals("done")) { step1.setBackgroundColor("#F5D0A9"); } if (task1.isCr()) step1.setBackgroundColor("#F5073B"); if (previosStep == null) { gantt.addStep(step1); previosStep = step1; } else { step1.setPredecessor(previosStep); gantt.addStep(step1); previosStep = step1; } } } gantt.addMoveListener(new Gantt.MoveListener() { @Override public void onGanttMove(Gantt.MoveEvent event) { Date start = new Date(event.getStartDate()); Date end = new Date(event.getEndDate()); dateFormat.setTimeZone(gantt.getTimeZone()); Notification.show("Moved " + event.getStep().getCaption() + " to Start Date: " + dateFormat.format(start) + " End Date: " + dateFormat.format(end), Notification.Type.TRAY_NOTIFICATION); } }); }