Revision 41088
Added by Ioannis Diplas over 8 years ago
DataserieWidget.java | ||
---|---|---|
3 | 3 |
import java.util.ArrayList; |
4 | 4 |
|
5 | 5 |
import com.github.gwtbootstrap.client.ui.AccordionGroup; |
6 |
import com.github.gwtbootstrap.client.ui.Alert; |
|
6 | 7 |
import com.github.gwtbootstrap.client.ui.Button; |
7 | 8 |
import com.github.gwtbootstrap.client.ui.Form; |
8 | 9 |
import com.github.gwtbootstrap.client.ui.Image; |
9 | 10 |
import com.github.gwtbootstrap.client.ui.ListBox; |
11 |
import com.github.gwtbootstrap.client.ui.Paragraph; |
|
10 | 12 |
import com.github.gwtbootstrap.client.ui.RadioButton; |
11 | 13 |
import com.github.gwtbootstrap.client.ui.Tab; |
12 | 14 |
import com.github.gwtbootstrap.client.ui.TabPanel; |
13 | 15 |
import com.github.gwtbootstrap.client.ui.TextBox; |
14 | 16 |
import com.github.gwtbootstrap.client.ui.base.IconAnchor; |
17 |
import com.github.gwtbootstrap.client.ui.constants.AlertType; |
|
15 | 18 |
import com.github.gwtbootstrap.client.ui.constants.AlternateSize; |
16 | 19 |
import com.github.gwtbootstrap.client.ui.constants.ButtonType; |
17 | 20 |
import com.github.gwtbootstrap.client.ui.constants.IconSize; |
... | ... | |
40 | 43 |
import com.google.gwt.event.logical.shared.SelectionEvent; |
41 | 44 |
import com.google.gwt.event.logical.shared.SelectionHandler; |
42 | 45 |
import com.google.gwt.user.client.Timer; |
46 |
import com.google.gwt.user.client.Window; |
|
43 | 47 |
import com.google.gwt.user.client.ui.FlowPanel; |
44 | 48 |
import com.google.gwt.user.client.ui.Tree; |
45 | 49 |
import com.google.gwt.user.client.ui.TreeItem; |
... | ... | |
82 | 86 |
private ArrayList<FiltersPanel> filtersPanels = new ArrayList<FiltersPanel>(); |
83 | 87 |
private final Button applyChanges = new Button(); |
84 | 88 |
private final TextBox renameTextBox = new TextBox(); |
89 |
private Paragraph infoParagraph = new Paragraph(); |
|
85 | 90 |
|
86 | 91 |
private final Image enabled = new Image( |
87 | 92 |
"https://cdn2.iconfinder.com/data/icons/windows-8-metro-style/512/checked_checkbox.png"); |
... | ... | |
128 | 133 |
this.mainTabPanel = mainTabPanel; |
129 | 134 |
this.schemaFromServer = schemaFroAnswer; |
130 | 135 |
this.totalColumns = totalColumns; |
131 |
|
|
136 |
this.infoParagraph.setText("Selecting different types of data may result in a complicated chart"); |
|
137 |
this.infoParagraph.addStyleName("info-paragraph"); |
|
138 |
|
|
139 |
|
|
132 | 140 |
if (!isFromLoad) |
133 | 141 |
this.specialColumnCounter = ValuesOfFields.getInstance().getColumnsDataList().size(); |
134 | 142 |
else |
... | ... | |
214 | 222 |
.setHeading( |
215 | 223 |
"APPEARANCE FOR \""+singleColumn.asWidget().getTitle()+"\"" ); |
216 | 224 |
|
217 |
applyChanges.addStyleName("flashing-button-apply"); |
|
225 |
// applyChanges.addStyleName("flashing-button-apply");
|
|
218 | 226 |
|
219 | 227 |
} else {// if only contains whitespaces |
220 | 228 |
singleColumn.setHeading("untitled"); |
... | ... | |
370 | 378 |
public void designOptionsForDataserie(Tab whereToAttach, int certainColumn, |
371 | 379 |
final int numberOfCurrentColumn) { |
372 | 380 |
|
381 |
final Alert notFilledAlert = new Alert(); |
|
382 |
notFilledAlert.setType(AlertType.ERROR); |
|
383 |
notFilledAlert.setClose(false); |
|
384 |
notFilledAlert.setText("Please fill all the required fields."); |
|
385 |
notFilledAlert.setVisible(false); |
|
386 |
generalOptionsGroupPanel.add(notFilledAlert); |
|
387 |
|
|
373 | 388 |
FlowPanel overallPanel = new FlowPanel(); |
374 | 389 |
FlowPanel aggPanel = new FlowPanel(); |
375 | 390 |
final DropdownListWidget x_axisListBox = new DropdownListWidget(); |
... | ... | |
380 | 395 |
aggRadio.addStyleName("radio-button-accordion"); |
381 | 396 |
totalNumberRadio.addStyleName("radio-button-accordion"); |
382 | 397 |
|
383 |
|
|
384 |
typeOfChart.getListBox().getElement().getStyle().setWidth(90.0, Unit.PCT); |
|
385 |
tableListBox.getElement().getStyle().setWidth(90.0, Unit.PCT); |
|
386 |
splitBy.getListBox().getElement().getStyle().setWidth(90.0, Unit.PCT); |
|
387 |
x_axisListBox.getListBox().getElement().getStyle().setWidth(90.0, Unit.PCT); |
|
388 | 398 |
|
389 | 399 |
|
400 |
|
|
401 |
typeOfChart.getListBox().getElement().getStyle().setWidth(100.0, Unit.PCT); |
|
402 |
tableListBox.getElement().getStyle().setWidth(100.0, Unit.PCT); |
|
403 |
splitBy.getListBox().getElement().getStyle().setWidth(100.0, Unit.PCT); |
|
404 |
x_axisListBox.getListBox().getElement().getStyle().setWidth(100.0, Unit.PCT); |
|
405 |
|
|
406 |
|
|
390 | 407 |
totalNumberRadio.addClickHandler(new ClickHandler() { |
391 | 408 |
|
392 | 409 |
@Override |
... | ... | |
448 | 465 |
overallPanel.add(aggPanel); |
449 | 466 |
|
450 | 467 |
FormFieldSet finalFieldSet = new FormFieldSet("", overallPanel); |
451 |
generalOptionsForm.add(new FormFieldSet("Type of chart", typeOfChart.asWidget())); |
|
452 |
generalOptionsForm.add(new FormFieldSet("What do you want to see?", tableListBox)); |
|
468 |
generalOptionsForm.add(new FormFieldSet("Type of chart (*)", typeOfChart.asWidget()));
|
|
469 |
generalOptionsForm.add(new FormFieldSet("What do you want to see? (*)", tableListBox));
|
|
453 | 470 |
|
454 | 471 |
generalOptionsForm.add(finalFieldSet); |
455 | 472 |
|
456 |
generalOptionsForm.add(new FormFieldSet("How do you want to break down?", x_axisListBox.asWidget())); |
|
473 |
if(numberOfCurrentColumn>=1){ |
|
474 |
generalOptionsForm.add(new FormFieldSet("How do you want to break down? (*)", x_axisListBox.asWidget(),this.infoParagraph)); |
|
475 |
}else{ |
|
476 |
generalOptionsForm.add(new FormFieldSet("How do you want to break down? (*)", x_axisListBox.asWidget())); |
|
477 |
} |
|
478 |
|
|
457 | 479 |
aggregateListBox.setSize(2); |
458 | 480 |
aggregateListBox.addItem("avg of"); |
459 | 481 |
aggregateListBox.addItem("count of"); |
... | ... | |
501 | 523 |
} |
502 | 524 |
|
503 | 525 |
generalOptionsForm |
504 |
.add(new FormFieldSet("Further breakdown", splitBy.asWidget())); |
|
526 |
.add(new FormFieldSet("Further break down", splitBy.asWidget()));
|
|
505 | 527 |
splitBy.getMasterTree().addSelectionHandler( |
506 | 528 |
new SelectionHandler<TreeItem>() { |
507 | 529 |
|
... | ... | |
620 | 642 |
@Override |
621 | 643 |
public void onClick(ClickEvent event) { |
622 | 644 |
// TODO Auto-generated method stub |
623 |
applyChanges.setEnabled(false); |
|
624 |
applyChanges.removeStyleName("flashing-button-apply"); |
|
625 |
Generate.getInstance().getTheme1().addLoadHandler(new LoadHandler() { |
|
626 |
|
|
627 |
@Override |
|
628 |
public void onLoad(LoadEvent event) { |
|
629 |
applyChanges.setEnabled(true); |
|
630 |
} |
|
631 |
}); |
|
632 |
Generate.getInstance().generateURLs(ValuesOfFields.getInstance(),1); |
|
645 |
if(hasFilledAll(x_axisListBox,tableListBox,typeOfChart)){ |
|
646 |
notFilledAlert.setVisible(false); |
|
647 |
applyChanges.setEnabled(false); |
|
648 |
applyChanges.removeStyleName("flashing-button-apply"); |
|
649 |
Generate.getInstance().getTheme1().addLoadHandler(new LoadHandler() { |
|
650 |
|
|
651 |
@Override |
|
652 |
public void onLoad(LoadEvent event) { |
|
653 |
applyChanges.setEnabled(true); |
|
654 |
} |
|
655 |
}); |
|
656 |
Generate.getInstance().generateURLs(ValuesOfFields.getInstance(),1); |
|
657 |
}else{ |
|
658 |
notFilledAlert.setVisible(true); |
|
659 |
} |
|
633 | 660 |
} |
634 | 661 |
}); |
635 | 662 |
totalNumberRadio.setValue(true); |
... | ... | |
641 | 668 |
|
642 | 669 |
} |
643 | 670 |
|
671 |
public boolean hasFilledAll(DropdownListWidget x_axis,ListBox tableList, DropdownListWidget typeOfChart){ |
|
672 |
|
|
673 |
if(x_axis.getListBox().getSelectedItemText().equals("") || x_axis.getListBox().getSelectedItemText()==null){ |
|
674 |
return false; |
|
675 |
} |
|
676 |
|
|
677 |
if(tableList.getSelectedItemText().equals("") || tableList.getSelectedItemText() == null){ |
|
678 |
return false; |
|
679 |
} |
|
680 |
|
|
681 |
if(typeOfChart.getListBox().getSelectedItemText().equals("") || typeOfChart.getListBox().getSelectedItemText() == null){ |
|
682 |
return false; |
|
683 |
} |
|
684 |
|
|
685 |
return true; |
|
686 |
|
|
687 |
|
|
688 |
} |
|
689 |
|
|
690 |
|
|
691 |
|
|
644 | 692 |
public void addOptionsForTable(final ListBox tableListBox, |
645 | 693 |
final DropdownListWidget x_axisListBox, |
646 | 694 |
final DropdownListWidget y_axisListBox, |
... | ... | |
1013 | 1061 |
mainRoot.addItem(rootLine); |
1014 | 1062 |
mainRoot.addItem(rootArea); |
1015 | 1063 |
mainRoot.addItem(rootPie); |
1064 |
mainRoot.setAnimationEnabled(true); |
|
1016 | 1065 |
|
1017 | 1066 |
typeOfChart.setTreeOptions(mainRoot); |
1018 | 1067 |
|
... | ... | |
1021 | 1070 |
|
1022 | 1071 |
@Override |
1023 | 1072 |
public void onSelection(SelectionEvent<TreeItem> event) { |
1073 |
|
|
1024 | 1074 |
if (event.getSelectedItem().getChildCount() == 0) { |
1025 | 1075 |
String[] splitted = event.getSelectedItem() |
1026 | 1076 |
.getTitle().split("-"); |
... | ... | |
1036 | 1086 |
//Generate.getInstance().generateURLs( |
1037 | 1087 |
// ValuesOfFields.getInstance(), 1); |
1038 | 1088 |
applyChanges.addStyleName("flashing-button-apply"); |
1089 |
}else{ |
|
1090 |
if (comingFromSetState == 1 && prevOpenState) { |
|
1091 |
comingFromSetState++; |
|
1092 |
} |
|
1093 |
if (comingFromSetState != 2) { |
|
1094 |
comingFromSetState++; |
|
1095 |
event.getSelectedItem().setState( |
|
1096 |
!event.getSelectedItem().getState()); |
|
1097 |
prevOpenState = !event.getSelectedItem() |
|
1098 |
.getState(); |
|
1099 |
|
|
1100 |
} else { |
|
1101 |
comingFromSetState = 0; |
|
1102 |
prevOpenState = true; |
|
1103 |
} |
|
1039 | 1104 |
} |
1040 | 1105 |
} |
1041 | 1106 |
}); |
... | ... | |
1812 | 1877 |
TreeItem root = new TreeItem(); |
1813 | 1878 |
root.setText("more"); |
1814 | 1879 |
TreeItem noneItem = new TreeItem(); |
1815 |
noneItem.setText("none");
|
|
1880 |
noneItem.setText("--none--");
|
|
1816 | 1881 |
|
1817 | 1882 |
mainRoot.addItem(noneItem); |
1818 | 1883 |
|
Also available in: Unified diff