@Override protected void resetFields() { logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Resetting the UI controls"); tfEnqNo.setReadOnly(false); tfEnqNo.setValue(""); cbEnqStatus.setValue(null); listEnqDtls = new ArrayList<SmsPurEnqDtlDM>(); tblSmsEnqDtl.removeAllItems(); cbBranch.setValue(branchId); cbBranch.setComponentError(null); lsVendorName.setValue(null); lsVendorName.setComponentError(null); dfDueDate.setValue(null); dfEnqDate.setValue(null); taEnqRem.setValue(""); taEnqDtlRem.setValue(""); dfEnqDate.setValue(new Date()); cbEnqStatus.setValue(cbEnqStatus.getItemIds().iterator().next()); cbUom.setReadOnly(true); dfDueDate.setValue(addDays(new Date(), 7)); }
@Override public void append(String suggestion) { setDirty(true); String value = (String) translated.getValue(); if (value == null) translated.setValue(suggestion); else { if (value.endsWith(" ")) // $NON-NLS-1$ translated.setValue(value + suggestion); else translated.setValue(value + " " + suggestion); // $NON-NLS-1$ } }
// MEngeset data dari FormData ke form private void setData(FormDeletion data) { // untuk kebutuhan edit inputDeletionDate.setValue(data.getDeletionDate()); information.setValue(data.getInformation()); inputGoodsQuantity.setValue(data.getQuantity()); inputGoodsSelect.setValue(data.getIdGoods()); this.deletionId = data.getDeletionId(); inputGoodsPrice.setValue(data.getPrice()); }
private Component buildNotes() { TextArea notes = new TextArea("Notes"); notes.setValue( "Remember to:\n· Zoom in and out in the Sales view\n· Filter the transactions and drag a set of them to the Reports tab\n· Create a new report\n· Change the schedule of the movie theater"); notes.setSizeFull(); notes.addStyleName(ValoTheme.TEXTAREA_BORDERLESS); Component panel = createContentWrapper(notes); panel.addStyleName("notes"); return panel; }
@Override public void resetForm() { inputUserName.setValue(""); inputName.setValue(""); inputTitle.setValue(""); inputAddress.setValue(""); inputEmployeeNum.setValue(""); inputPhoneNumber.setValue(""); inputPassword1.setValue(""); inputPassword2.setValue(""); inputSika.setValue(""); }
@Override public void setFormData(User data) { inputUserName.setValue(data.getUsername()); inputName.setValue(data.getName()); inputTitle.setValue(data.getTitle()); inputAddress.setValue(data.getAddress()); inputEmployeeNum.setValue(data.getEmployeeNum()); inputSika.setValue(data.getSika()); selectRole.setValue(data.getRole().getIdRole()); System.out.println(data.getRole().getRoleName()); inputPhoneNumber.setValue(data.getPhoneNumber()); changeButtonActivation(data.isActive()); }
@Override public void setFormData(DeletedGoods deletion) { this.deletionId = deletion.getIdDeletedGoods(); buttonSubmit.setCaption("Simpan Perubahan"); inputDeletionDate.setValue(deletion.getDeletionDate()); information.setValue(deletion.getInformation()); inputGoodsQuantity.setValue(deletion.getQuantity() + ""); inputGoodsSelect.setValue(deletion.getGoods().getIdGoods()); inputGoodsPrice.setValue(deletion.getPrice() + ""); System.out.println("deletionDate " + deletion.getDeletionDate()); System.out.println("inputGoodsQuantity " + deletion.getQuantity()); System.out.println("deletionDate " + deletion.getPrice()); }
@Override public Field getField(Object propertyId) { if (valueId.equals(propertyId)) { TextArea field = new TextArea(); field.setNullRepresentation(""); field.setValue(formField.getValue()); return field; } if (API.JSON_FORM.equals(propertyId)) { ReadOnly field = new ReadOnly(templateRef); field.setCaption("Форма"); return field; } return null; }
public void setInput(RegistrationRequestState requestState) { commentField.setValue(""); contentP.removeAllComponents(); this.requestState = requestState; List<AdminComment> comments = requestState.getAdminComments(); for (AdminComment comment : comments) { StringBuilder sb = new StringBuilder(); if (comment.isPublicComment()) sb.append(msg.getMessage("RequestCommentPanel.public")); else sb.append(msg.getMessage("RequestCommentPanel.internal")); sb.append(" ") .append(new SimpleDateFormat(Constants.SIMPLE_DATE_FORMAT).format(comment.getDate())); sb.append("\n\n").append(comment.getContents()); Label commentL = new Label(sb.toString(), ContentMode.PREFORMATTED); commentL.addStyleName(Styles.messageBox.toString()); contentP.addComponent(commentL); } }
@Override public void init() { LegacyWindow main = new LegacyWindow("Testing...."); setMainWindow(main); final VerticalLayout lo = new VerticalLayout(); lo.setSizeUndefined(); lo.setWidth("100%"); TextArea tf = new TextArea(); tf.setValue( "The textfield should fill the window." + "\n - Try to resize window\n - Try to push REdo button"); tf.setRows(10); tf.setWidth("100%"); lo.addComponent(tf); Window subWin = new Window("This window should initially be as wide as the caption", lo); main.addWindow(subWin); // subWin.setWidth("500px"); }
private void enqDtlresetFields() { logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Resetting the UI controls"); lsProduct.setValue(null); tfEnqQty.setValue("0"); taEnqDtlRem.setValue(""); cbUom.setReadOnly(false); cbUom.setValue(""); cbUom.setReadOnly(true); cbEnqDtlStatus.setValue(cbEnqDtlStatus.getItemIds().iterator().next()); cbUom.setComponentError(null); btnaddSpec.setCaption("Add"); tfEnqQty.setComponentError(null); }
private void editSmsPurDetail() { logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Editing the selected record"); hlUserInputLayout.setVisible(true); if (tblSmsEnqDtl.getValue() != null) { SmsPurEnqDtlDM purEnqDtlDM = beanPurEnqDtlDM.getItem(tblSmsEnqDtl.getValue()).getBean(); lsProduct.setValue(null); Long prodid = purEnqDtlDM.getProductId(); Collection<?> prodids = lsProduct.getItemIds(); for (Iterator<?> iterator = prodids.iterator(); iterator.hasNext(); ) { Object itemId = (Object) iterator.next(); BeanItem<?> item = (BeanItem<?>) lsProduct.getItem(itemId); // Get the actual bean and use the data ProductDM st = (ProductDM) item.getBean(); if (prodid != null && prodid.equals(st.getProdid())) { lsProduct.select(itemId); } } if (cbUom.getValue() != null) { cbUom.setReadOnly(false); cbUom.setValue(purEnqDtlDM.getProductUom()); cbUom.setReadOnly(true); } if (tfEnqQty.getValue() != null) { tfEnqQty.setValue(purEnqDtlDM.getEnquiryQty().toString()); } if (purEnqDtlDM.getRemarks() != null) { taEnqDtlRem.setValue(purEnqDtlDM.getRemarks().toString()); } if (purEnqDtlDM.getEnqDtlStaus() != null) { cbEnqDtlStatus.setValue(purEnqDtlDM.getEnqDtlStaus()); } } }
@HibernateSessionThreadLocalConstructor @SuppressWarnings("serial") public MapGameDesignPanel(GameDesignGlobals globs) { super(false, globs); Game g = Game.getTL(); TextArea titleTA; final Serializable uid = Mmowgli2UI.getGlobals().getUserID(); titleTA = (TextArea) addEditLine("Map Title", "Game.mapTitle", g, g.getId(), "MapTitle").ta; titleTA.setValue(g.getMapTitle()); titleTA.setRows(1); latTA = addEditLine("Map Initial Latitude", "Game.mmowgliMapLatitude"); boolean lastRO = latTA.isReadOnly(); latTA.setReadOnly(false); latTA.setValue("" + g.getMapLatitude()); latTA.setRows(1); latTA.setReadOnly(lastRO); latTA.addValueChangeListener( new Property.ValueChangeListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void valueChange(ValueChangeEvent event) { HSess.init(); try { String val = event.getProperty().getValue().toString(); double lat = Double.parseDouble(val); Game g = Game.getTL(); g.setMapLatitude(lat); Game.updateTL(); GameEventLogger.logGameDesignChangeTL("Map latitude", val, uid); } catch (Exception ex) { new Notification( "Parameter error", "<html>Check for proper decimal format.</br>New value not committed.", Notification.Type.WARNING_MESSAGE, true) .show(Page.getCurrent()); } HSess.close(); } }); lonTA = addEditLine("Map Initial Longitude", "Game.mmowgliMapLongitude"); lastRO = lonTA.isReadOnly(); lonTA.setReadOnly(false); lonTA.setValue("" + g.getMapLongitude()); lonTA.setRows(1); lonTA.setReadOnly(lastRO); lonTA.addValueChangeListener( new Property.ValueChangeListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void valueChange(ValueChangeEvent event) { // System.out.println("lon valueChange"); HSess.init(); try { String val = event.getProperty().getValue().toString(); double lon = Double.parseDouble(val); Game g = Game.getTL(); g.setMapLongitude(lon); Game.updateTL(); GameEventLogger.logGameDesignChangeTL("Map longitude", val, uid); } catch (Exception ex) { new Notification( "Parameter error", "<html>Check for proper decimal format.</br>New value not committed.", Notification.Type.WARNING_MESSAGE, true) .show(Page.getCurrent()); } HSess.close(); } }); zoomTA = addEditLine("Map Initial Zoom", "Game.mmowgliMapZoom"); lastRO = zoomTA.isReadOnly(); zoomTA.setReadOnly(false); zoomTA.setValue("" + g.getMapZoom()); zoomTA.setRows(1); zoomTA.setReadOnly(lastRO); zoomTA.addValueChangeListener( new Property.ValueChangeListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void valueChange(ValueChangeEvent event) { HSess.init(); try { String val = event.getProperty().getValue().toString(); int zoom = Integer.parseInt(val); Game g = Game.getTL(); g.setMapZoom(zoom); Game.updateTL(); GameEventLogger.logGameDesignChangeTL("Map zoom", val, uid); } catch (Exception ex) { new Notification( "Parameter error", "Check for proper integer format.</br>New value not committed.", Notification.Type.WARNING_MESSAGE, true) .show(Page.getCurrent()); } HSess.close(); } }); Button b; this.addComponentLine( b = new Button("Set to generic Mmowgli Map Defaults", new MapDefaultSetter())); b.setEnabled(!globs.readOnlyCheck(false)); }
/** * Gets the status of this file. * * @return status of this file. */ public TextArea getStatus() { TextArea area = null; try { Path repoPath = this.getHost().repository; Git git = Git.open(repoPath.toFile()); // // I would like to use absolutePath, but that seems to barf when // we try to relativize this if a full path is not given. // Path relativePath = repoPath.relativize(Paths.get(this.file.getPath())); Status status = git.status().addPath(relativePath.toString()).call(); if (logger.isDebugEnabled()) { logger.debug(this.file.getAbsolutePath()); logger.debug("Added: " + status.getAdded()); logger.debug("Changed: " + status.getChanged()); logger.debug("Conflicting: " + status.getConflicting()); logger.debug("Missing: " + status.getMissing()); logger.debug("Modified: " + status.getModified()); logger.debug("Removed: " + status.getRemoved()); logger.debug("Uncommitted: " + status.getUncommittedChanges()); logger.debug("Untracked: " + status.getUntracked()); logger.debug("Untracked folders; " + status.getUntrackedFolders()); } // // Are we a file or directory? // StringBuffer buffer = new StringBuffer(); int length = 0; if (this.file.isFile()) { if (status.getAdded().contains(relativePath.toString())) { buffer.append("Added" + "\n"); length++; } if (status.getChanged().contains(relativePath.toString())) { buffer.append("Changed" + "\n"); length++; } if (status.getConflicting().contains(relativePath.toString())) { buffer.append("Conflicting" + "\n"); length++; } if (status.getMissing().contains(relativePath.toString())) { buffer.append("Missing" + "\n"); length++; } if (status.getModified().contains(relativePath.toString())) { buffer.append("Modified" + "\n"); length++; } if (status.getRemoved().contains(relativePath.toString())) { buffer.append("Removed" + "\n"); length++; } if (status.getUncommittedChanges().contains(relativePath.toString())) { buffer.append("Uncommitted" + "\n"); length++; } if (status.getUntracked().contains(relativePath.toString())) { buffer.append("Untracked (New)" + "\n"); length++; } if (status.getUntrackedFolders().contains(relativePath.toString())) { buffer.append("Untracked Folders (New)" + "\n"); length++; } } else if (this.file.isDirectory()) { if (status.getUntracked().size() > 0) { buffer.append("Untracked (New)" + "\n"); length++; } if (status.getUntrackedFolders().size() > 0) { buffer.append("Untracked Folders (New)" + "\n"); length++; } } if (length > 0) { area = new TextArea(); area.setValue(buffer.toString().trim()); area.setWidth("100.0%"); area.setRows(length); area.setReadOnly(true); } } catch (IOException | NoWorkTreeException | GitAPIException e) { logger.error(e); } return area; }
@Override public void replace(String suggestion) { setDirty(true); translated.setValue(suggestion); }
// Method to edit the values from table into fields to update process private void editPurHdr() { logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Editing the selected record"); try { hlUserInputLayout.setVisible(true); if (tblMstScrSrchRslt.getValue() != null) { SmsPurEnqHdrDM enqHdrDM = beanPurEnqHdrDM.getItem(tblMstScrSrchRslt.getValue()).getBean(); enquiryId = enqHdrDM.getEnquiryId(); logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Selected enquiryId. Id -> " + enquiryId); logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Selected enquiryId. Id -> " + enquiryId); cbBranch.setValue(enqHdrDM.getBranchId()); tfEnqNo.setReadOnly(false); tfEnqNo.setValue(enqHdrDM.getEnquiryNo()); tfEnqNo.setReadOnly(true); dfEnqDate.setValue(enqHdrDM.getEnquiryDate()); dfDueDate.setValue(enqHdrDM.getDueDate()); for (EnquiryVendorDtlDM enquiryVendorDtlDM : serviceEnquiryVendorDtl.getpurchasevdrdtl(null, enquiryId, null)) { lsVendorName.select(enquiryVendorDtlDM.getVendorid().toString()); } if (enqHdrDM.getEnquiryStatus() != null) { cbEnqStatus.setValue(enqHdrDM.getEnquiryStatus()); } if (enqHdrDM.getEnqRemark() != null) { taEnqRem.setValue(enqHdrDM.getEnqRemark().toString()); } listEnqDtls = serviceSmsPurEnqDtl.getSmsPurEnqDtlList( null, enquiryId, null, (String) cbEnqDtlStatus.getValue()); } loadPurDtl(); comments = new SmsComments( vlTableForm, null, companyid, enquiryId, null, null, null, null, null, null, null, null, status, null); comments.loadsrch( true, null, null, enquiryId, null, null, null, null, null, null, null, null, null, null); } catch (Exception e) { logger.info(e.getMessage()); } }
private void buildView() { // main frame Panel pane = new Panel("Create New Password"); pane.setSizeUndefined(); // form layout mnth_sel = new NativeSelect("Birth Month"); mnth_sel.addItems( "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); mnth_sel.setValue("January"); mnth_sel.setMultiSelect(false); mnth_sel.setNullSelectionAllowed(false); mnth_sel.setImmediate(true); day_sel = new NativeSelect("Birth Day"); for (int i = 0; i < 31; i++) day_sel.addItem(i + 1); day_sel.setValue(1); day_sel.setMultiSelect(false); day_sel.setNullSelectionAllowed(false); day_sel.setImmediate(true); FormLayout form = new FormLayout(); form.setSizeUndefined(); form.addComponent(mnth_sel); form.addComponent(day_sel); // content layout info = new Label(); info.setSizeUndefined(); info.setValue("Please fill in all fields below"); question_txt = new TextArea("Security Question"); question_txt.setValue(emp.getRandomQuestion()); // query user for security question question_txt.setReadOnly(true); question_txt.setRows(2); question_txt.setWidth("20em"); ans_txt = new TextArea("Answer"); ans_txt.setRows(2); ans_txt.setWidth("20em"); Label gap = new Label(); gap.setHeight("1em"); submit = new Button("Continue"); submit.setDescription("Continue password creation!"); submit.setSizeFull(); submit.setStyleName("primary"); cancel = new Button("Cancel"); cancel.setDescription("Return to login screen!"); cancel.setSizeFull(); VerticalLayout content = new VerticalLayout(); content.setSizeUndefined(); content.setSpacing(true); content.setMargin(true); content.addComponent(info); content.setComponentAlignment(info, Alignment.MIDDLE_CENTER); content.addComponent(form); content.addComponent(question_txt); content.addComponent(ans_txt); content.addComponent(gap); content.addComponent(submit); content.addComponent(cancel); // add 'content' to 'main frame' pane.setContent(content); // root layout this.setMargin(true); this.addComponent(pane); this.setComponentAlignment(pane, Alignment.TOP_CENTER); // // user interaction // submit.addClickListener(event -> handleSubmit(event)); cancel.addClickListener(event -> handleCancel(event)); }
/** Set all components to default status. */ public void resetComponents() { textAreaSentence.setValue(""); textAreaSentence.setInputPrompt("Please insert a sentence here."); // buttonAnnotate.setEnabled(false); listSelectAnnotation.removeAllItems(); }