List of usage examples for com.vaadin.ui Window getParent
@Override
public HasComponents getParent()
From source file:ac.uk.icl.dell.vaadin.glycanbuilder.VaadinGlycanCanvas.java
License:Open Source License
public void appendNotationMenu(CustomMenuBar.MenuItem parent) { final HashMap<String, String> notationIndex = new HashMap<String, String>(); CustomMenuBar.Command notationChangeCommand = new CustomMenuBar.Command() { private static final long serialVersionUID = 5081687058270283137L; @Override// w w w. j a v a 2s . c o m public void menuSelected(CustomMenuBar.MenuItem selectedItem) { String notation = notationIndex.get(selectedItem.getText()); theCanvas.setNotation(notation); } }; parent.addItem("CFG notation", notationChangeCommand); notationIndex.put("CFG notation", GraphicOptions.NOTATION_CFG); parent.addItem("CFG black and white notation", notationChangeCommand); notationIndex.put("CFG black and white notation", GraphicOptions.NOTATION_CFGBW); parent.addItem("CFG with linkage placement notation", notationChangeCommand); notationIndex.put("CFG with linkage placement notation", GraphicOptions.NOTATION_CFGLINK); parent.addItem("UOXF notation", notationChangeCommand); notationIndex.put("UOXF notation", GraphicOptions.NOTATION_UOXF); parent.addItem("UOXFCOL notation", notationChangeCommand); notationIndex.put("UOXFCOL notation", GraphicOptions.NOTATION_UOXFCOL); parent.addItem("Text only notation", notationChangeCommand); notationIndex.put("Text only notation", GraphicOptions.NOTATION_TEXT); parent.addItem("Show Masses", new ThemeResource("icons/uncheckedbox.png"), new CustomMenuBar.Command() { private static final long serialVersionUID = 6140157670134115820L; @Override public void menuSelected(CustomMenuBar.MenuItem selectedItem) { //selectedItem.setIcon(arg0); boolean showMasses = theCanvas.theWorkspace.getGraphicOptions().SHOW_MASSES_CANVAS; if (showMasses) { theCanvas.theWorkspace.getGraphicOptions().SHOW_MASSES_CANVAS = false; selectedItem.setIcon(new ThemeResource("icons/uncheckedbox.png")); } else { theCanvas.theWorkspace.getGraphicOptions().SHOW_MASSES_CANVAS = true; selectedItem.setIcon(new ThemeResource("icons/checkbox.png")); } theCanvas.documentUpdated(); } }); parent.addItem("Show reducing end symbol", new ThemeResource("icons/uncheckedbox.png"), new CustomMenuBar.Command() { private static final long serialVersionUID = -5209359926737326181L; @Override public void menuSelected(CustomMenuBar.MenuItem selectedItem) { boolean showRedEnd = theCanvas.theWorkspace.getGraphicOptions().SHOW_REDEND_CANVAS; if (showRedEnd) { theCanvas.theWorkspace.getGraphicOptions().SHOW_REDEND_CANVAS = false; selectedItem.setIcon(new ThemeResource("icons/uncheckedbox.png")); } else { theCanvas.theWorkspace.getGraphicOptions().SHOW_REDEND_CANVAS = true; selectedItem.setIcon(new ThemeResource("icons/checkbox.png")); } theCanvas.documentUpdated(); } }); final Window massOptionsDialog = new Window() { private static final long serialVersionUID = -5094399884130705221L; @Override public void close() { setVisible(false); } }; massOptionsDialog.setResizable(false); //massOptionsDialog.setIcon(new ThemeResource("icons/massoptions.png")); massOptionsDialog.setCaption("Mass options"); MassOptionsDialog dialog = new MassOptionsDialog(theCanvas.theDoc.getStructures(), theCanvas.theWorkspace.getDefaultMassOptions()); dialog.addMassOptionListener(this); massOptionsDialog.addComponent(dialog); ((VerticalLayout) massOptionsDialog.getContent()).setComponentAlignment(dialog, Alignment.MIDDLE_CENTER); massOptionsDialog.setVisible(false); massOptionsDialog.center(); parent.addItem("Mass options", new CustomMenuBar.Command() { private static final long serialVersionUID = -589321392382766804L; @Override public void menuSelected(CustomMenuBar.MenuItem selectedItem) { if (massOptionsDialog.getParent() == null) { getWindow().addWindow(massOptionsDialog); } massOptionsDialog.setVisible(true); } }); massOptionsDialog.setSizeUndefined(); massOptionsDialog.getContent().setSizeUndefined(); }
From source file:com.bellkenz.modules.PersonalInformation.java
public ComponentContainer personalInformation() { employeeInformationDAO = new EmployeeInformationDAO(getEmployeeId()); employeePersonalInformation = new EmployeePersonalInformation(); GridLayout glayout = new GridLayout(5, 9); glayout.setSpacing(true);/*from w w w. j av a 2 s . co m*/ glayout.setMargin(true); final Panel imagePanel = new Panel(); imagePanel.setStyleName("light"); AbstractLayout panelLayout = (AbstractLayout) imagePanel.getContent(); panelLayout.setMargin(false); imagePanel.setSizeFull(); employeeImage = new Embedded(null, new ThemeResource("../myTheme/images/ronnie.jpg")); employeeImage.setImmediate(true); employeeImage.setWidth(90, Sizeable.UNITS_PIXELS); employeeImage.setHeight(90, Sizeable.UNITS_PIXELS); employeeImage.setStyleName("logo-img"); imagePanel.addComponent(employeeImage); glayout.addComponent(employeeImage, 0, 0, 0, 1); glayout.setComponentAlignment(imagePanel, Alignment.MIDDLE_CENTER); firstname = createTextField("Firstname: "); glayout.addComponent(firstname, 1, 0, 2, 0); final TextField middlename = createTextField("Middlename: "); glayout.addComponent(middlename, 3, 0); final TextField lastname = createTextField("Lastname: "); glayout.addComponent(lastname, 4, 0); final TextField houseNo = createTextField("No: "); houseNo.setWidth("40px"); glayout.addComponent(houseNo, 1, 1); final TextField street = createTextField("Street: "); street.setWidth("118"); glayout.addComponent(street, 2, 1); final TextField city = createTextField("City: "); glayout.addComponent(city, 3, 1); final TextField zipCode = createTextField("Zip Code:"); glayout.addComponent(zipCode, 4, 1); final TextField nickname = createTextField("Nickname: "); nickname.setWidth("90px"); glayout.addComponent(nickname, 0, 2); final TextField permanentAddress = createTextField("Permanent/Provincial Address: "); permanentAddress.setWidth("533px"); glayout.addComponent(permanentAddress, 1, 2, 4, 2); Button uploadPicture = new Button("Upload..."); uploadPicture.setWidth("100%"); uploadPicture.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (employeeId == null) { getWindow().showNotification("You did not select and Employee!", Window.Notification.TYPE_WARNING_MESSAGE); return; } Window uploadImage = new UploadImage(imagePanel, employeeImage, employeeId); uploadImage.setWidth("450px"); if (uploadImage.getParent() == null) { getWindow().addWindow(uploadImage); } uploadImage.setModal(true); uploadImage.center(); } }); glayout.addComponent(uploadPicture, 0, 3); final TextField landline = createTextField("Landline #: "); glayout.addComponent(landline, 1, 3, 2, 3); final TextField mobileNo = createTextField("Mobile #: "); glayout.addComponent(mobileNo, 3, 3); final TextField age = createTextField("Age: "); glayout.addComponent(age, 4, 3); final TextField emailAddress = createTextField("Email Address: "); glayout.addComponent(emailAddress, 1, 4, 2, 4); final PopupDateField dob = (PopupDateField) createDateField("Date of Birth: "); glayout.addComponent(dob, 3, 4); final TextField height = createTextField("Height: "); glayout.addComponent(height, 4, 4); final ComboBox civilStatus = new ComboBox("Civil Status: "); civilStatus.setWidth("100%"); dropDownBoxList.populateCivilStatusList(civilStatus); glayout.addComponent(civilStatus, 1, 5, 2, 5); final ComboBox gender = new ComboBox("Gender: "); gender.setWidth("100%"); dropDownBoxList.populateGenderList(gender); glayout.addComponent(gender, 3, 5); final TextField weight = createTextField("Weigth: "); glayout.addComponent(weight, 4, 5); final TextField driversLicenseNo = createTextField("Drivers License: "); glayout.addComponent(driversLicenseNo, 1, 6, 2, 6); final TextField restrictionCode = createTextField("Restriction Code: "); glayout.addComponent(restrictionCode, 3, 6); final TextField religion = createTextField("Religion: "); glayout.addComponent(religion, 4, 6); final ComboBox division = new ComboBox("Division: "); division.setWidth("100%"); dropDownBoxList.populateBranchComboBox(division); glayout.addComponent(division, 1, 7, 2, 7); final ComboBox department = dropDownBoxList.populateDepartment(new ComboBox()); department.setWidth("100%"); division.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (division.getValue() == null) { } else { divisionId = branchDAO.getBranchId(division.getValue().toString()); } } }); glayout.addComponent(department, 3, 7); final TextField position = createTextField("Position: "); glayout.addComponent(position, 4, 7); //glayout.setComponentAlignment(position, Alignment.BOTTOM_LEFT); Button transferButton = new Button("Transfer Employee"); transferButton.setWidth("100%"); transferButton.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (getEmployeeId() == null) { getWindow().showNotification("You did not select an Employee!", Window.Notification.TYPE_WARNING_MESSAGE); return; } Window subWindow = transferEmployee(getEmployeeId(), division, department, position); if (subWindow.getParent() == null) { getWindow().addWindow(subWindow); } subWindow.setModal(true); subWindow.center(); } }); glayout.addComponent(transferButton, 1, 8, 2, 8); glayout.setComponentAlignment(transferButton, Alignment.BOTTOM_CENTER); if (employeeId != null) { epiList = employeeInformationDAO.employeePersonalInformation(); for (EmployeePersonalInformation epi : epiList) { final byte[] image = epi.getImage(); if (image != null) { StreamResource.StreamSource imageSource = new StreamResource.StreamSource() { @Override public InputStream getStream() { return new ByteArrayInputStream(image); } }; StreamResource imageResource = new StreamResource(imageSource, epi.getFirstname() + ".jpg", getApplication()); imageResource.setCacheTime(0); employeeImage.setSource(imageResource); } firstname.setValue(epi.getFirstname()); middlename.setValue(epi.getMiddlename()); lastname.setValue(epi.getLastname()); houseNo.setValue(epi.getHouseNumber()); street.setValue(epi.getStreet()); city.setValue(epi.getStreet()); zipCode.setValue(epi.getZipCode()); nickname.setValue(epi.getNickname()); permanentAddress.setValue(epi.getPermanentAddress()); landline.setValue(epi.getLandlineNumber()); mobileNo.setValue(epi.getMobileNumber()); age.setValue(epi.getAge()); emailAddress.setValue(epi.getEmailAddress()); if (epi.getDob() != null) { dob.setValue(conUtil.parsingDate(epi.getDob())); } else { dob.setValue(null); } height.setValue(epi.getHeight()); if (epi.getCivilStatus() != null) { Object civilStatusId = civilStatus.addItem(); civilStatus.setItemCaption(civilStatusId, epi.getCivilStatus()); civilStatus.setValue(civilStatusId); } if (epi.getGender() != null) { Object genderId = gender.addItem(); gender.setItemCaption(genderId, epi.getGender()); gender.setValue(genderId); } weight.setValue(epi.getWeight()); driversLicenseNo.setValue(epi.getDriversLicense()); restrictionCode.setValue(epi.getRestrictionCode()); religion.setValue(epi.getReligion()); position.setValue(epi.getPosition()); Object divisionObjectId = division.addItem(); division.setItemCaption(divisionObjectId, epi.getDivision()); division.setValue(divisionObjectId); Object departmentObjectId = department.addItem(); department.setItemCaption(departmentObjectId, epi.getDepartment()); department.setValue(departmentObjectId); } } firstname.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { employeePersonalInformation.setFirstname(event.getProperty().getValue().toString()); } }); firstname.setImmediate(true); setInformation(employeePersonalInformation); return glayout; }
From source file:com.bellkenz.modules.PersonalInformation.java
public Window transferEmployee(final String employeeId, final ComboBox div, final ComboBox dept, final TextField post) { VerticalLayout vlayout = new VerticalLayout(); vlayout.setMargin(true);/*from w ww .j a va 2 s . c o m*/ vlayout.setSpacing(true); final Window subWindow = new Window("Transfer Employee", vlayout); subWindow.setWidth("200px"); final ComboBox division = new ComboBox("Division: "); division.setWidth("100%"); dropDownBoxList.populateBranchComboBox(division); subWindow.addComponent(division); final ComboBox department = dropDownBoxList.populateDepartment(new ComboBox()); department.setWidth("100%"); division.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (division.getValue() == null) { } else { divisionId = branchDAO.getBranchId(division.getValue().toString()); } } }); subWindow.addComponent(department); final TextField position = createTextField("Position: "); position.setWidth("100%"); subWindow.addComponent(position); final PopupDateField entryDate = (PopupDateField) createDateField("Date of Entry: "); subWindow.addComponent(entryDate); Button updateButton = new Button("UPDATE"); updateButton.setWidth("100%"); updateButton.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (division.getValue() == null) { getWindow().showNotification("Select Division!", Window.Notification.TYPE_WARNING_MESSAGE); return; } if (department.getValue() == null) { getWindow().showNotification("Select Department!", Window.Notification.TYPE_WARNING_MESSAGE); return; } if (position.getValue() == null || position.getValue().toString().trim().isEmpty()) { getWindow().showNotification("Enter Position!", Window.Notification.TYPE_WARNING_MESSAGE); return; } if (entryDate.getValue() == null) { getWindow().showNotification("Select Entry Date!", Window.Notification.TYPE_WARNING_MESSAGE); return; } List<EmployeePositionHistory> ephList = new ArrayList<EmployeePositionHistory>(); EmployeePositionHistory eph = new EmployeePositionHistory(); eph.setBranch(division.getValue().toString()); eph.setDepartment(department.getValue().toString()); eph.setPosition(position.getValue().toString().trim().toLowerCase()); eph.setEntryDate(conUtil.convertDateFormat(entryDate.getValue().toString())); ephList.add(eph); Integer deptId = departmentDAO.getDepartmentId(divisionId, department.getValue().toString()); Boolean result = employeeInformationDAO.transferEmployee(ephList, deptId); if (result) { Object divObjectId = div.addItem(); div.setItemCaption(divObjectId, division.getValue().toString()); div.setValue(divObjectId); Object deptObjectId = dept.addItem(); dept.setItemCaption(deptObjectId, department.getValue().toString()); dept.setValue(deptObjectId); post.setValue(position.getValue().toString().trim().toLowerCase()); (subWindow.getParent()).removeWindow(subWindow); } else { getWindow().showNotification("Cannot Transfer employee", Window.Notification.TYPE_ERROR_MESSAGE); } } }); subWindow.addComponent(updateButton); return subWindow; }
From source file:com.etest.connection.ErrorDBNotification.java
public static void showLoggedErrorOnWindow(String str) { Window sub = new Window("Logged ERROR"); sub.setWidth("500px"); sub.setHeight("300px"); if (sub.getParent() == null) { UI.getCurrent().addWindow(sub);//from ww w. ja va2 s.c o m } sub.setModal(true); Panel panel = new Panel(); panel.setSizeFull(); panel.setContent(new Label(str)); sub.setContent(panel); }
From source file:com.etest.view.testbank.CellCaseMainUI.java
HorizontalLayout getHlayout() {
HorizontalLayout hlayout = new HorizontalLayout();
hlayout.setSpacing(true);/*from w w w. j a va2 s . c o m*/
subject.setWidth("200px");
subject.addValueChangeListener((new CurriculumPropertyChangeListener(topic)));
hlayout.addComponent(subject);
hlayout.setComponentAlignment(subject, Alignment.MIDDLE_LEFT);
topic.setInputPrompt("Select a Topic..");
topic.addStyleName(ValoTheme.COMBOBOX_SMALL);
topic.setWidth("500px");
topic.addValueChangeListener((Property.ValueChangeEvent event) -> {
if (event.getProperty().getValue() == null) {
} else {
syllabusId = (int) event.getProperty().getValue();
populateDataTable();
}
});
hlayout.addComponent(topic);
hlayout.setComponentAlignment(topic, Alignment.MIDDLE_LEFT);
Button createCellBtn = new Button("CREATE");
createCellBtn.setWidthUndefined();
createCellBtn.setIcon(FontAwesome.OPENID);
createCellBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
createCellBtn.addStyleName(ValoTheme.BUTTON_SMALL);
createCellBtn.addClickListener((Button.ClickEvent event) -> {
Window sub = new CellCaseWindow(0);
if (sub.getParent() == null) {
UI.getCurrent().addWindow(sub);
}
sub.addCloseListener((Window.CloseEvent e) -> {
populateDataTable();
});
});
hlayout.addComponent(createCellBtn);
hlayout.setComponentAlignment(createCellBtn, Alignment.MIDDLE_LEFT);
return hlayout;
}
From source file:com.etest.view.testbank.cellitem.CellItemWindow.java
FormLayout buildForms() {
FormLayout form = new FormLayout();
form.setWidth("100%");
form.setMargin(true);// w w w . j av a 2 s .c om
form.setSpacing(true);
HorizontalLayout hlayout = new HorizontalLayout();
hlayout.setWidth("100%");
Button helpBtn = new Button("HELP");
helpBtn.setWidthUndefined();
helpBtn.setIcon(FontAwesome.TASKS);
helpBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
helpBtn.addStyleName(ValoTheme.BUTTON_SMALL);
helpBtn.addClickListener((Button.ClickEvent event) -> {
Window sub = new MultipleChoiceHelpViewer();
if (sub.getParent() == null) {
UI.getCurrent().addWindow(sub);
}
});
hlayout.addComponent(helpBtn);
hlayout.setComponentAlignment(helpBtn, Alignment.MIDDLE_RIGHT);
form.addComponent(hlayout);
bloomsTaxonomy.setCaption("Blooms Class: ");
bloomsTaxonomy.setWidth("30%");
form.addComponent(bloomsTaxonomy);
stem = new TextArea("Stem: ");
stem.setWidth("100%");
stem.setRows(5);
stem.setWordwrap(true);
form.addComponent(stem);
HorizontalLayout h1 = new HorizontalLayout();
h1.setCaption("Option A:");
h1.setWidth("100%");
h1.setSpacing(true);
optionA = new CommonTextField("add option A", null);
optionA.setWidth("500px");
h1.addComponent(optionA);
Button optionABtn = new CommonButton("OPTION A");
optionABtn.setWidth("120px");
optionABtn.addClickListener(updateOptionAndKeyListerner);
h1.addComponent(optionABtn);
h1.setComponentAlignment(optionABtn, Alignment.MIDDLE_RIGHT);
optionABtn.setVisible(isEdit());
form.addComponent(h1);
HorizontalLayout h2 = new HorizontalLayout();
h2.setCaption("Key A:");
h2.setWidth("100%");
h2.setSpacing(true);
keyA = new CommonTextField("Enter a Key for Option A", null);
keyA.setWidth("500px");
h2.addComponent(keyA);
Button keyABtn = new CommonButton("KEY A");
keyABtn.setWidth("120px");
keyABtn.addClickListener(updateOptionAndKeyListerner);
h2.addComponent(keyABtn);
h2.setComponentAlignment(keyABtn, Alignment.MIDDLE_RIGHT);
keyABtn.setVisible(isEdit());
form.addComponent(h2);
HorizontalLayout h3 = new HorizontalLayout();
h3.setCaption("Option B:");
h3.setWidth("100%");
h3.setSpacing(true);
optionB = new CommonTextField("add option B", null);
optionB.setWidth("500px");
h3.addComponent(optionB);
Button optionBBtn = new CommonButton("OPTION B");
optionBBtn.setWidth("120px");
optionBBtn.addClickListener(updateOptionAndKeyListerner);
h3.addComponent(optionBBtn);
h3.setComponentAlignment(optionBBtn, Alignment.MIDDLE_RIGHT);
optionBBtn.setVisible(isEdit());
form.addComponent(h3);
HorizontalLayout h4 = new HorizontalLayout();
h4.setCaption("Key B:");
h4.setWidth("100%");
h4.setSpacing(true);
keyB = new CommonTextField("Enter a Key for Option B", null);
keyB.setWidth("500px");
h4.addComponent(keyB);
Button keyBBtn = new CommonButton("KEY B");
keyBBtn.setWidth("120px");
keyBBtn.addClickListener(updateOptionAndKeyListerner);
h4.addComponent(keyBBtn);
h4.setComponentAlignment(keyBBtn, Alignment.MIDDLE_RIGHT);
keyBBtn.setVisible(isEdit());
form.addComponent(h4);
HorizontalLayout h5 = new HorizontalLayout();
h5.setCaption("Option C:");
h5.setWidth("100%");
h5.setSpacing(true);
optionC = new CommonTextField("add option C", null);
optionC.setWidth("500px");
h5.addComponent(optionC);
Button optionCBtn = new CommonButton("OPTION C");
optionCBtn.setWidth("120px");
optionCBtn.addClickListener(updateOptionAndKeyListerner);
h5.addComponent(optionCBtn);
h5.setComponentAlignment(optionCBtn, Alignment.TOP_RIGHT);
optionCBtn.setVisible(isEdit());
form.addComponent(h5);
HorizontalLayout h6 = new HorizontalLayout();
h6.setCaption("Key C:");
h6.setWidth("100%");
h6.setSpacing(true);
keyC = new CommonTextField("Enter a Key for Option C", null);
keyC.setWidth("500px");
h6.addComponent(keyC);
Button keyCBtn = new CommonButton("KEY C");
keyCBtn.setWidth("120px");
keyCBtn.addClickListener(updateOptionAndKeyListerner);
h6.addComponent(keyCBtn);
h6.setComponentAlignment(keyCBtn, Alignment.MIDDLE_RIGHT);
keyCBtn.setVisible(isEdit());
form.addComponent(h6);
HorizontalLayout h7 = new HorizontalLayout();
h7.setCaption("Option D:");
h7.setWidth("100%");
h7.setSpacing(true);
optionD = new CommonTextField("add option D", null);
optionD.setWidth("500px");
h7.addComponent(optionD);
Button optionDBtn = new CommonButton("OPTION D");
optionDBtn.setWidth("120px");
optionDBtn.addClickListener(updateOptionAndKeyListerner);
h7.addComponent(optionDBtn);
h7.setComponentAlignment(optionDBtn, Alignment.MIDDLE_RIGHT);
optionDBtn.setVisible(isEdit());
form.addComponent(h7);
HorizontalLayout h8 = new HorizontalLayout();
h8.setCaption("Key D:");
h8.setWidth("100%");
h8.setSpacing(true);
keyD = new CommonTextField("Enter a Key for Option D", null);
keyD.setWidth("500px");
h8.addComponent(keyD);
Button keyDBtn = new CommonButton("KEY D");
keyDBtn.setWidth("120px");
keyDBtn.addClickListener(updateOptionAndKeyListerner);
h8.addComponent(keyDBtn);
h8.setComponentAlignment(keyDBtn, Alignment.MIDDLE_RIGHT);
keyDBtn.setVisible(isEdit());
form.addComponent(h8);
HorizontalLayout h = new HorizontalLayout();
h.setWidth("100%");
Button save = new Button("SAVE");
save.setWidth("200px");
save.setIcon(FontAwesome.SAVE);
save.addStyleName(ValoTheme.BUTTON_PRIMARY);
save.addStyleName(ValoTheme.BUTTON_SMALL);
save.addClickListener(buttonClickListener);
Button remove = new Button("ARCHIVE/REMOVE ITEM?");
remove.setWidth("200px");
remove.setIcon(FontAwesome.ARCHIVE);
remove.addStyleName(ValoTheme.BUTTON_PRIMARY);
remove.addStyleName(ValoTheme.BUTTON_SMALL);
remove.addClickListener(buttonClickListener);
Button approve = new Button("APPROVE ITEM?");
approve.setWidth("200px");
approve.setIcon(FontAwesome.THUMBS_O_UP);
approve.addStyleName(ValoTheme.BUTTON_PRIMARY);
approve.addStyleName(ValoTheme.BUTTON_SMALL);
approve.addClickListener(buttonClickListener);
Button edit = new Button("UPDATE");
edit.setWidth("200px");
edit.setIcon(FontAwesome.SAVE);
edit.addStyleName(ValoTheme.BUTTON_PRIMARY);
edit.addStyleName(ValoTheme.BUTTON_SMALL);
edit.addClickListener(buttonClickListener);
if (getCellItemId() != 0) {
CellItem ci = cis.getCellItemById(getCellItemId());
bloomsTaxonomy.setValue(ci.getBloomsClassId());
bloomsTaxonomy.addValueChangeListener((Property.ValueChangeEvent event) -> {
isBloomsChanged = true;
});
stem.setValue(ci.getItem());
stem.addTextChangeListener((FieldEvents.TextChangeEvent event) -> {
if (!stem.getValue().trim().equals(event.getText().trim())) {
isStemChanged = true;
}
});
/**
* OPTION A
*/
optionA.setValue(ci.getOptionA());
isOptionAKeyExist = k.isKeyExist(getCellItemId(), ci.getOptionA());
if (isOptionAKeyExist) {
keyA.setValue(k.getItemKey(getCellItemId(), ci.getOptionA()));
}
keyA.setData(k.getItemKeyId(getCellItemId(), ci.getOptionA()));
/**
* OPTION B
*/
optionB.setValue(ci.getOptionB());
isOptionBKeyExist = k.isKeyExist(getCellItemId(), ci.getOptionB());
if (isOptionBKeyExist) {
keyB.setValue(k.getItemKey(getCellItemId(), ci.getOptionB()));
}
keyB.setData(k.getItemKeyId(getCellItemId(), ci.getOptionB()));
/**
* OPTION C
*/
optionC.setValue(ci.getOptionC());
isOptionCKeyExist = k.isKeyExist(getCellItemId(), ci.getOptionC());
if (isOptionCKeyExist) {
keyC.setValue(k.getItemKey(getCellItemId(), ci.getOptionC()));
}
keyC.setData(k.getItemKeyId(getCellItemId(), ci.getOptionC()));
/**
* OPTION D
*/
optionD.setValue(ci.getOptionD());
isOptionDKeyExist = k.isKeyExist(getCellItemId(), ci.getOptionD());
if (isOptionDKeyExist) {
keyD.setValue(k.getItemKey(getCellItemId(), ci.getOptionD()));
}
keyD.setData(k.getItemKeyId(getCellItemId(), ci.getOptionD()));
h.addComponent(remove);
h.setComponentAlignment(remove, Alignment.MIDDLE_RIGHT);
h.addComponent(approve);
h.setComponentAlignment(approve, Alignment.MIDDLE_RIGHT);
h.addComponent(edit);
h.setComponentAlignment(edit, Alignment.MIDDLE_RIGHT);
form.addComponent(h);
} else {
h.addComponent(save);
h.setComponentAlignment(save, Alignment.MIDDLE_RIGHT);
form.addComponent(h);
}
return form;
}
From source file:com.etest.view.tq.itemanalysis.FileUploadWindow.java
Button viewTableProportion() {
Button button = new Button("View Proportion Table");
button.setWidthUndefined();/*from w w w . j ava2 s.c o m*/
button.addStyleName(ValoTheme.BUTTON_LINK);
button.addClickListener((Button.ClickEvent event) -> {
Window sub = new ProportionDataTable(getStudentNoAndAnswer(), getUpperGroupStudentNo(),
getLowerGroupStudentNo(), tq.getCellItemIdByTQCoverageId(getTqCoverageId()), getTqCoverageId(),
getGroupTotalForProportion());
if (sub.getParent() == null) {
UI.getCurrent().addWindow(sub);
}
});
return button;
}
From source file:com.etest.view.tq.itemanalysis.FileUploadWindow.java
Button viewStudentsTotalScore() {
Button button = new Button("View Students Total Scores");
button.setWidthUndefined();/*from w w w . j ava 2 s . c o m*/
button.addStyleName(ValoTheme.BUTTON_LINK);
button.addClickListener((Button.ClickEvent event) -> {
Window sub = new StudentsTotalScoreWindow(getStudentNoAndTotalScore());
if (sub.getParent() == null) {
UI.getCurrent().addWindow(sub);
}
});
return button;
}
From source file:com.etest.view.tq.TQCoverageUI.java
public TQCoverageUI() { setSizeFull();/*w w w. ja v a 2 s. com*/ addComponent(buildTQCoverageForms()); addComponent(grid); footer = grid.appendFooterRow(); grid.addItemClickListener((ItemClickEvent event) -> { Object itemId = event.getItemId(); Item item = grid.getContainerDataSource().getItem(itemId); if (event.getPropertyId().toString().equals("Topic")) { Window sub = getTopicWindow(item); if (sub.getParent() == null) { UI.getCurrent().addWindow(sub); } } Window sub; if (event.getPropertyId().toString().contains("Pick")) { boolean isValueInTBNotZero = tq.isValueInTBNotZero(item, CommonUtilities.replaceStringPickToTB(event.getPropertyId())); if (!isValueInTBNotZero) { Notification.show("There are no Items in Test Bank!", Notification.Type.ERROR_MESSAGE); return; } else { sub = getPickWindow(item, CommonUtilities.replaceStringPickToTB(event.getPropertyId())); if (sub.getParent() == null) { UI.getCurrent().addWindow(sub); } sub.addCloseListener((Window.CloseEvent e) -> { if (tq.calculateTotalPickItemsPerTopic(grid, itemId) > CommonUtilities .convertStringToDouble(item.getItemProperty("Max Items").getValue().toString())) { item.getItemProperty(event.getPropertyId()).setValue(0); ShowErrorNotification.error("Running Total is greater than Max Items"); } else { item.getItemProperty("Running Total") .setValue(tq.calculateTotalPickItemsPerTopic(grid, itemId)); footer.getCell("Running Total").setText(String.valueOf(tq.calculateRunningTotal(grid))); } }); } } if (event.getPropertyId().toString().equals("Max Items")) { double value = (double) item.getItemProperty("Max Items").getValue(); sub = getMaxItemsWindow(item, value); if (sub.getParent() == null) { UI.getCurrent().addWindow(sub); } } }); grid.getColumn("remove") .setRenderer(new DeleteButtonValueRenderer((ClickableRenderer.RendererClickEvent event) -> { grid.getContainerDataSource().removeItem(event.getItemId()); populateGridFooter(); footer.getCell("Running Total").setText(String.valueOf(tq.calculateRunningTotal(grid))); })).setWidth(100); footer.getCell("Topic").setText("Total"); footer.setStyleName("align-center"); Button generateTQ = new Button("Generate TQ"); generateTQ.setWidth("300px"); generateTQ.addClickListener(buttonClickListener); addComponent(new Label("\n")); addComponent(generateTQ); setComponentAlignment(generateTQ, Alignment.MIDDLE_RIGHT); }
From source file:com.hris.connection.ErrorLoggedNotification.java
public static void showErrorLoggedOnWindow(String error, String className) { VerticalLayout v = new VerticalLayout(); v.setSizeFull();/* www . j a va 2 s. c om*/ v.setMargin(true); Window sub = new Window("ERROR MESSAGE!", v); sub.setWidth("500px"); if (sub.getParent() == null) { UI.getCurrent().addWindow(sub); } sub.setModal(true); Panel panel = new Panel(); panel.setSizeFull(); panel.setContent(new Label(error + " on \n" + className, ContentMode.HTML)); panel.getContent().setHeightUndefined(); sub.setContent(panel); sub.getContent().setHeightUndefined(); }