use of io.bssw.psip.ui.components.ScoreItem in project psip-automation by bssw-psip.
the class Assessment method createItemLayout.
private void createItemLayout(Item item) {
mainLayout.removeAll();
ScoreItem scoreItem = new ScoreItem(item);
String path = item.getCategory().getActivity().getPath() + "/" + item.getCategory().getPath() + "/" + item.getPath();
Item prevItem = activityService.getPrevItem(path);
Button button1 = UIUtils.createLargeButton(VaadinIcon.CHEVRON_CIRCLE_LEFT);
// FIXME: Don't hard code background
button1.getElement().getStyle().set("background", "#F3F5F7").set("font-size", "30px");
button1.getElement().addEventListener("click", e -> {
MainLayout.navigate(Assessment.class, prevItem.getCategory().getPath() + "/" + prevItem.getPath());
});
if (prevItem == null) {
button1.getElement().setEnabled(false);
}
Item nextItem = activityService.getNextItem(path);
Button button2 = UIUtils.createLargeButton(VaadinIcon.CHEVRON_CIRCLE_RIGHT);
// FIXME: Don't hard code background
button2.getElement().getStyle().set("background", "#F3F5F7").set("font-size", "30px");
button2.getElement().addEventListener("click", e -> {
MainLayout.navigate(Assessment.class, nextItem.getCategory().getPath() + "/" + nextItem.getPath());
});
if (nextItem == null) {
button2.getElement().setEnabled(false);
}
HorizontalLayout hz = new HorizontalLayout(button1, button2);
hz.setJustifyContentMode(JustifyContentMode.CENTER);
hz.setWidthFull();
Anchor anchor = new Anchor();
anchor.setText("Show me my assessment");
anchor.getElement().addEventListener("click", e -> MainLayout.navigate(Assessment.class, null));
HorizontalLayout hz2 = new HorizontalLayout(anchor);
hz2.setJustifyContentMode(JustifyContentMode.CENTER);
hz2.setWidthFull();
VerticalLayout footer = new VerticalLayout(hz, hz2);
footer.setMargin(false);
mainLayout.addAndExpand(scoreItem, footer);
}
Aggregations