Hi Johannes,
here is a small sample I made. Just open and close the Window by click on the green Button. You will see it took a second. If you now, press the red button to set the gantt invisible and now open and close the Dialog, you will see it is faster.
Wait one second to get the Dialog opened, will not be a problem, but if I work a longer time in my Browser it will take more and more time to have Windows opened.
If you check your Task-Manager, you will see that your Browser needs also a lot of CPU Power, while open and close just that small Window. The CPU will also go up, if you just move your mouse in the gantt view.
final Gantt gantt = new Gantt();
gantt.setSizeFull();
gantt.setEndDate(DateUtils.addDays(new Date(), 365));
gantt.setMovableSteps(false);
gantt.setResizableSteps(false);
gantt.setResponsive(false);
gantt.setStartDate( new Date() );
gantt.setEndDate( new Date() );
for(int i=0; i < 250; i++){
Step stepWithSubSteps = new Step(null, CaptionMode.HTML);
stepWithSubSteps.setCaption(“”+i);
for(int x=0; x < 50; x++){
SubStep subStep = new SubStep();
subStep.setCaption(“”+x);
Calendar calendar = new GregorianCalendar();
calendar.clear();
calendar.set(Calendar.WEEK_OF_YEAR, x);
calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
calendar.set(Calendar.YEAR, Calendar.getInstance().get(Calendar.YEAR));
subStep.setStartDate(calendar.getTime());
subStep.setEndDate(DateUtils.addDays(calendar.getTime(), 7));
gantt.setStartDate( new Date(Math.min(gantt.getStartDate().getTime(), subStep.getStartDate())) );
gantt.setEndDate( new Date(Math.max(gantt.getEndDate().getTime(), subStep.getEndDate())) );
stepWithSubSteps.addSubStep(subStep);
}
gantt.addStep(stepWithSubSteps);
}
BeanItemContainer container = new BeanItemContainer(Step.class);
Table table = new Table(null, container);
table.setSortEnabled(false);
table.setBuffered(false);
table.setSizeFull();
table.setSelectable(false);
container.addAll(gantt.getSteps());
table.setVisibleColumns(“caption”);
gantt.setVerticalScrollDelegateTarget(table);
table.setColumnWidth(null, 500);
GridLayout layout = new GridLayout(1, 3);
layout.addComponent(getHeader(), 0, 0);
HorizontalLayout hl = new HorizontalLayout(table, gantt);
hl.setExpandRatio(gantt, 1.0F);
hl.setSizeFull();
layout.addComponent(hl, 0, 2);
layout.setSizeFull();
setCompositionRoot(layout);
Button button=new Button();
button.setStyleName(ValoTheme.BUTTON_FRIENDLY);
button.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event) {
Window wnd = new Window(“Window”);
wnd.setWidth(“200px”);
wnd.setHeight(“200px”);
wnd.center();
wnd.setModal(true);
wnd.setClosable(true);
GridLayout layout = new GridLayout(1, 1);
final TextField textfield = new TextField(“ABC”);
textfield.setWidth(“100%”);
textfield.focus();
layout.setMargin(true);
layout.addComponent(textfield, 0, 0);
layout.setSizeFull();
wnd.setContent(layout);
UI.getCurrent().addWindow( wnd );
}
});
Button button2=new Button();
button2.setStyleName(ValoTheme.BUTTON_DANGER);
button2.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event) {
gantt.setVisible(!gantt.isVisible());
}
});
layout.addComponent(new HorizontalLayout(button, button2), 0, 1);
layout.setRowExpandRatio(2, 1F);
setCompositionRoot(layout);
Thanks Dennis