private void onNameChanged(InputEvent e) { String value = e.getValue(); Textbox box = (Textbox) e.getTarget(); String lastName, firstName; if (box == lastNameBox) { lastName = value; firstName = firstNameBox.getValue(); } else { lastName = lastNameBox.getValue(); firstName = value; } labelBox.setValue(lastName + ", " + firstName); }
/** * *********************************************************** Search * *********************************************************** */ @Listen("onClick = #searchBtn") public void search() { String searchTerm = searchBox.getValue(); List<Node> nodes = nodeDao.matchByLabel("%" + searchTerm + "%"); ListModelList<Node> nodeModel = new ListModelList<Node>(nodes); nodeList.setModel(nodeModel); nodeList.setItemRenderer(new NodeRenderer()); footer.setLabel(nodes.size() + " nodes found."); }
private void doStoreInitValues() { oldVar_textboxTIdossPermohonanId = textbox_TIdossPermohonanId.getValue(); oldVar_textboxNamaPemohon = textbox_NamaPemohon.getValue(); oldVar_textboxBagianPemohon = textbox_BagianPemohon.getValue(); oldVar_textboxNamaManager = textbox_NamaManager.getValue(); oldVar_textboxNamaGm = textbox_NamaGm.getValue(); oldVar_textboxNikPemohon = textbox_NikPemohon.getValue(); oldVar_textboxNikManager = textbox_NikManager.getValue(); oldVar_textboxNikGm = textbox_NikGm.getValue(); oldVar_readonly = radio_readonly.getValue(); oldVar_readwrite = radio_readwrite.getValue(); oldVar_aplikasi = radio_aplikasi.getValue(); oldVar_lainlain = radio_lainlain.getValue(); oldVar_textboxLainlain = textbox_Lainlain.getValue(); // oldVar_cepat = cepat.getValue(); oldVar_textbox_DetailPermohonan = textbox_DetailPermohonan.getValue(); }
private void doWriteComponentsToBean(TPermohonan tPermohonan, Mttr mttr) { // tPermohonan.setT_idoss_permohonan_id(textbox_TIdossPermohonanId.getValue()); tPermohonan.setNama_pemohon(textbox_NamaPemohon.getValue()); tPermohonan.setBagian_pemohon(textbox_BagianPemohon.getValue()); Timestamp ts = new Timestamp(java.util.Calendar.getInstance().getTimeInMillis()); tPermohonan.setTgl_permohonan(ts); tPermohonan.setNik_pemohon(textbox_NikPemohon.getValue()); tPermohonan.setNama_manager(textbox_NamaManager.getValue()); tPermohonan.setNik_manager(textbox_NikManager.getValue()); tPermohonan.setNama_gm(textbox_NamaGm.getValue()); tPermohonan.setNik_gm(textbox_NikGm.getValue()); tPermohonan.setDetail_permohonan(textbox_DetailPermohonan.getValue()); if (getUploadMedia() != null) { tPermohonan.setUploadStream(getUploadMedia().getStreamData()); } tPermohonan.setTarget_mulai_digunakan(ts); String lain = textbox_Lainlain.getValue(); tPermohonan.setLain_lain_desc(lain); // radio_lainlain.setValue(lain); Radio type = radiogroupType_permohonan.getSelectedItem(); tPermohonan.setType_permohonan(type.getValue()); tPermohonan.setLain_lain_desc(textbox_Lainlain.getValue()); tPermohonan.setUpdated_divisi(ts); tPermohonan.setUpdated_gm(ts); tPermohonan.setUpdated_manager(ts); tPermohonan.setUpdated_pemohon(ts); Radio dampak = radiogroup_Dampak.getSelectedItem(); tPermohonan.setDampak(dampak.getValue()); Radio prioritas = radiogroup_Prioritas.getSelectedItem(); tPermohonan.setUrgensi(prioritas.getValue()); tPermohonan.setCreated_user(getUserWorkspace().getUserSession().getUserName()); tPermohonan.setUpdated_user(getUserWorkspace().getUserSession().getUserName()); if (intbox_target.getValue() != null) { int target = intbox_target.getValue(); long too = setTarget(target); Timestamp tanggalnya = new Timestamp(too); mttr.setTarget(too); mttr.setTarget2(Integer.toString(target)); } }
/** * *********************************************************** Create * *********************************************************** */ @SuppressWarnings("rawtypes") private void onNodeTypeChanged() { ListModelList typeModel = (ListModelList) typeBox.getModel(); Set selections = typeModel.getSelection(); if (selections.isEmpty()) return; String selection = (String) selections.iterator().next(); logger.info("Node type set to: " + selection); Map<String, String> ntd = GeneralUtil.getNodeDescriptionByLabel(ntds, selection); String nodeType = ntd.get("type"); if (nodeType.equals(Constants.NODE_TYPE_USER)) { firstNameRow.setVisible(true); firstNameBox.setConstraint("no empty"); lastNameRow.setVisible(true); lastNameBox.setConstraint("no empty"); midNameRow.setVisible(true); } else { firstNameRow.setVisible(false); firstNameBox.setConstraint(""); lastNameRow.setVisible(false); lastNameBox.setConstraint(""); midNameRow.setVisible(false); } }
private void doWriteBeanToComponents(TPermohonan tPermohonan, TVerifikasi tVerifikasi) { textbox_TIdossPermohonanId.setValue(getPermohonanService().getPermohonanID()); textbox_NamaPemohon.setValue(getUserWorkspace().getUserSession().getEmployeeName()); textbox_BagianPemohon.setValue(getUserWorkspace().getUserSession().getDepartment()); tPermohonan = setBoss(tPermohonan, getUserWorkspace().getUserSession().getEmployeeNo()); textbox_NamaManager.setValue(tPermohonan.getNama_manager()); textbox_NamaGm.setValue(tPermohonan.getNama_gm()); textbox_NikPemohon.setValue(getUserWorkspace().getUserSession().getEmployeeNo()); textbox_NikManager.setValue(tPermohonan.getNik_manager()); textbox_NikGm.setValue(tPermohonan.getNik_gm()); Timestamp ts = new Timestamp(java.util.Calendar.getInstance().getTimeInMillis()); datebox_Tanggal.setValue(ts); // int indexPlks = 0; // ListModel listPlks = listbox_NamaPelaksana.getModel(); // for (int i = 0; i < listPlks.getSize(); i++) { // VHrEmployeePelaksana np = (VHrEmployeePelaksana) listPlks.getElementAt(i); // if (np.getEmployee_no().equals(tVerifikasi.getNik_pelaksana())) indexPlks = i; // } // listbox_NamaPelaksana.setSelectedIndex(indexPlks); }
private boolean isValidatedFlow() throws InterruptedException { if (textbox_DetailPermohonan.getValue().length() < 1) { Messagebox.show("Silakan isi deskripsi"); return false; } // String role = getUserWorkspace().getUserSession().getEmployeeRole(); if (getUserWorkspace().getUserSession().getEmployeeRole().contains(1532)) { if (listbox_NamaPelaksana.getSelectedItem() == null) { Messagebox.show("Silakan pilih nama pelaksana"); return false; } if (listbox_NamaPelaksana.getSelectedItem().getLabel().equalsIgnoreCase("Silakan pilih")) { Messagebox.show("Silakan pilih nama pelaksana"); return false; } if (intbox_target.getValue() == null) { Messagebox.show("Silakan isikan target selesai"); return false; } } if (radio_readonly.isSelected()) { if (getUploadMedia() == null) { Messagebox.show("Type permohonan Read Only -> silakan lampirkan file"); return false; } } else if (radio_readwrite.isSelected()) { if (getUploadMedia() == null) { Messagebox.show("Type permohonan Read Write -> silakan lampirkan file"); return false; } } else if (radio_aplikasi.isSelected()) { return true; } else if (radio_lainlain.isSelected()) { return true; } return true; }
/// Search Data and add to array @Listen("onClick = #btnsave") public void btnsave_Clicked(Event event) { int a = 0, bc = 0, closs = 0; for (Store e : Store.findAllStores()) { Textbox txtid = (Textbox) find(getPage(), "#idproduct").get(0); if ((Integer.parseInt(txtid.getText())) == e.getIdproduct()) { checksamesell(e.getNameproduct()); if (checksame == true) { int oldqty = qty.get(posarray); int modernqty = oldqty + Integer.parseInt(idqty.getValue()); qty.remove(posarray); qty.add(posarray, modernqty); int medernprice = e.getPrice() * modernqty; price.remove(posarray); price.add(posarray, medernprice); checksame = false; break; } else { idpro.add(Integer.parseInt(idproduct.getValue())); nameproduct.add(e.getNameproduct()); qty.add(Integer.parseInt(idqty.getValue())); unitprice.add(e.getPrice()); bc = e.getPrice(); a = Integer.parseInt(idqty.getValue()); closs = a * bc; price.add(closs); namecus.add((String) Sessions.getCurrent().getAttribute("name")); pointcount++; break; } } } Textbox txtid = (Textbox) find(getPage(), "#idproduct").get(0); Textbox txtqty = (Textbox) find(getPage(), "#idqty").get(0); txtid.setValue(null); txtqty.setValue(null); showgrid(); }
/** * *************************************************** Helper methods * *************************************************** */ private Node createNode() throws InterruptedException { Comboitem item = typeBox.getSelectedItem(); if (item == null) { Messagebox.show("Node type is required."); return null; } String nodeType = GeneralUtil.getNodeDescriptionByLabel(ntds, item.getLabel()).get("type"); String firstName = firstNameBox.getValue().trim(); String lastName = lastNameBox.getValue().trim(); String midName = midNameBox.getValue().trim(); String label = labelBox.getValue().trim(); String username; if (nodeType.equals(Constants.NODE_TYPE_USER)) { if (firstName.isEmpty()) { Messagebox.show("First Name is required."); return null; } else if (firstName.length() > 80) { Messagebox.show("First Name cannot be longer than 80."); return null; } else if (GeneralUtil.containSpecialCharacter(firstName)) { Messagebox.show("First Name cannot contain special characters."); return null; } if (lastName.isEmpty()) { Messagebox.show("Last Name is required."); return null; } else if (lastName.length() > 80) { Messagebox.show("Last Name cannot be longer than 80."); return null; } else if (GeneralUtil.containSpecialCharacter(lastName)) { Messagebox.show("Last Name cannot contain special characters."); return null; } username = firstName.replace(" ", "_") + "__" + lastName.replace(" ", "_"); } else { if (label.isEmpty()) { Messagebox.show("Label is required."); return null; } else if (label.length() > 255) { Messagebox.show("Label cannot be longer than 255."); return null; } username = GeneralUtil.replaceSpecialCharacter(label, "_").replace(" ", "_"); } if (nodeDao.findByUsername(username) != null) { Messagebox.show("Username: "******" has already been used."); return null; } Survey survey = surveyDao.findById(1L); Node node = new Node(); node.setType(nodeType); node.setUsername(username); node.setLabel(label); if (nodeType.equals(Constants.NODE_TYPE_USER)) { node.setFirstName(firstName); node.setLastName(lastName); node.setMidName(midName); } String defaultPassword = survey.getAttribute(Constants.SURVEY_DEFAULT_PASSWORD); if (defaultPassword == null) { defaultPassword = "******"; } if (defaultPassword.equals("rAnDoM")) { RandomString rs = new RandomString(8); defaultPassword = rs.nextString(); } node.setPassword(defaultPassword); node.setAttribute( Constants.NODE_LOGIN_MODE, survey.getAttribute(Constants.SURVEY_DEFAULT_LOGIN_MODE)); // role node.getRoles().add(roleDao.findByName(Constants.ROLE_USER)); // groups Set<Group> groups = new HashSet<Group>(); AbstractQuestionRelation p = (AbstractQuestionRelation) getParent(); groups.addAll(p.getQuestion().getAvailableGroups()); groups.add(groupDao.findByName(Constants.GROUP_ALL)); if (nodeType.equals(Constants.NODE_TYPE_USER)) { groups.add(groupDao.findByName(Constants.GROUP_USER)); } else { String groupName = Constants.GROUP_NODE_TYPE_PREFIX + nodeType; Group group = groupDao.findByName(groupName); if (group == null) { group = new Group(); group.setName(groupName); groupDao.save(group); logger.info("created new group: " + group.getName()); } groups.add(group); } node.setGroups(groups); // save nodeDao.save(node); logger.debug("Node created: " + username); return node; }