/* (non-Javadoc) * @see gwtupload.client.Uploader#onFinishUpload() */ @Override protected void onFinishUpload() { super.onFinishUpload(); if (getStatus() == Status.REPEATED) { getStatusWidget().setError(getI18NConstants().uploaderAlreadyDone()); } getStatusWidget().setStatus(Status.UNINITIALIZED); reuse(); assignNewNameToFileInput(); for (Widget i : formWidgets) { if (i instanceof Hidden) { Hidden h = (Hidden) i; if (h.getValue().startsWith(fileInputPrefix)) { h.setValue(getInputName()); } } } getFileInput().getWidget().setVisible(true); if (button != null) { setEnabledButton(true); button.removeStyleName("changed"); if (!autoSubmit) { button.setVisible(true); } } if (autoSubmit) { getFileInput().setText(i18nStrs.uploaderBrowse()); } }
/** {@inheritDoc} */ @Override public void setPrefix(String prefix) { prefixHeader.setText(prefix); deletePrefixLabel.setText("Delete prefix " + prefix + ":"); deleteButton.setText("Delete " + prefix); uploadPrefix.setValue(prefix); settingsPrefix.setValue(prefix); }
private void removeHiddens() { if (hiddens != null) { for (Hidden hidden : hiddens) { hidden.removeFromParent(); } hiddens = null; } }
private void BuildList(String Filter) { Iterator<Entry<String, pojoMethod>> it = this.methodList.entrySet().iterator(); int i = 0; this._MenuStack.clear(); this._MenuStack.removeAllRows(); // this._MenuStack.setHeight(height) // We need to set Height of the parent panel dynamically based on the number of items // We need to add a hidden field with a unique id while (it.hasNext()) { // Use of final to allow access to it in the clickHandlers final int index = i; // This keeps track of which item we are looking at Entry<String, pojoMethod> tmpEntry = it.next(); final pojoMethod tmpMethod = tmpEntry.getValue(); // String comp1 = tmpMethod.getMethodName().toLowerCase(); String comp2 = Filter.toLowerCase(); if (comp1.contains(comp2)) { final Label titleLabel = new Label(); titleLabel.setText(tmpMethod.getMethodName()); titleLabel.addStyleName("menuMethodName"); final int _i = i; // _edit.setStyleName("btnEditMethod"); titleLabel.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { // set selected style/should shuffle as well setActiveMenu(tmpMethod.getMethodID()); eventBus.fireEvent( new DragEvent(titleLabel.getText(), "EditMethod", index, (IPojo) tmpMethod)); } }); // this._MenuStack.setWidget(i,0,tmpItem.asWidget()); this._MenuStack.setWidget(i, 0, titleLabel); // this._MenuStack.setWidget(i,1,_edit); Hidden tmpHidden = new Hidden(); tmpHidden.setValue(tmpMethod.getMethodID()); this._MenuStack.setWidget(i, 1, tmpHidden); _MenuStack.getFlexCellFormatter() .getElement(i, 0) .setAttribute("style", "border-right:Solid 1px #ccc;"); // _MenuStack.getFlexCellFormatter().getElement(i, 1).setAttribute("style", // "padding-left:5px;"); i++; } } _MenuStack.setCellPadding(0); _MenuStack.setCellSpacing(0); int newHeight = _MenuStack.getRowCount() * 30; this._MenuStack.setHeight(newHeight + "px"); }
/* * (non-Javadoc) * @see monbulk.shared.view.iMenuWidget#setActiveMenu(java.lang.String) * * */ @Override public final void setActiveMenu(String activeItem) { int count = this._MenuStack.getRowCount(); int i = 0; // GWT.log("SetActiveMenu Called" + activeItem + count); while (i < count) { Hidden tmpItem = (Hidden) this._MenuStack.getWidget(i, 1); /// GWT.log("ItemFound:" + tmpItem.getText() + activeItem + tmpItem.getText().length() + // activeItem.length()); GWT.log("Item collected is: " + tmpItem.getValue()); if (tmpItem != null) { if (tmpItem.getValue().contains(activeItem) && tmpItem.getValue().length() == activeItem.length()) { _MenuStack.getFlexCellFormatter() .getElement(i, 0) .setAttribute("style", "font-weight:bold;color:#345484;"); // _MenuStack.getFlexCellFormatter().getElement(i, 1).setAttribute("style", // "padding-left:5px;background-color:#345484;"); // d _MenuStack.getFlexCellFormatter().getElement(i, 2).setAttribute("style", // "background-color:#345484;"); GWT.log("ItemFound:" + activeItem); } else { GWT.log("Item reset is " + tmpItem.getValue()); _MenuStack.getFlexCellFormatter() .getElement(i, 0) .setAttribute("style", "font-weight:normal;"); // _MenuStack.getFlexCellFormatter().getElement(i, 1).setAttribute("style", // "padding-left:5px;"); // _MenuStack.getFlexCellFormatter().getElement(i, 2).setAttribute("style", ""); } } // tmpItem.setActive(activeItem); i++; } }
public AttachmentsEditorView() { initWidget(uiBinder.createAndBindUi(this)); attachmentForm.setEncoding(FormPanel.ENCODING_MULTIPART); attachmentForm.setMethod(FormPanel.METHOD_POST); attachment.setName("attachment0"); attachmentDescription.setName("description0"); hiddenTaskHandle.setName(AttachmentUploadUtil.TASK_HANDLE_FORM_NAME); attachmentSubmitButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { attachmentForm.submit(); } }); }
public ViewHTMLRenderDialog(String html) { // Set the dialog box's caption. setText(LocaleMessages.LANG.information()); // Enable animation. setAnimationEnabled(false); // Enable glass background. setGlassEnabled(true); // Label label = new Label("Consulta enviada al servidor"); final Hidden user = new Hidden(); final Hidden password = new Hidden(); user.setName("user"); user.setValue(ApplicationContext.getAuth().getUser()); password.setValue(ApplicationContext.getAuth().getPass()); password.setName("password"); Button ok = new Button(LocaleMessages.LANG.accept()); ok.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { ViewHTMLRenderDialog.this.hide(); } }); VerticalPanel panel = new VerticalPanel(); HTMLPanel htmlPanel = new HTMLPanel(html); panel.setHeight("500px"); panel.setWidth("800px"); panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); panel.add(htmlPanel); panel.add(ok); panel.add(user); panel.add(password); final FormPanel form = new FormPanel(); form.setAction("BPMConsoleApp/complete"); form.setHeight("475px"); form.setWidth("800px"); form.addSubmitHandler( new FormPanel.SubmitHandler() { @Override public void onSubmit(SubmitEvent event) { // This event is fired just before the form is submitted. // We can take this opportunity to perform validation. // event.cancel(); } }); form.addSubmitCompleteHandler( new FormPanel.SubmitCompleteHandler() { @Override public void onSubmitComplete(SubmitCompleteEvent event) { // When the form submission is successfully completed, // this event is fired. Assuming the service returned // a response of type text/html, we can get the result // here. // Window.alert(event.getResults()); } }); form.add(panel); setWidget(form); }
public void setTask(Task task) { hiddenTaskHandle.setValue(AttachmentUploadUtil.createTaskHandleValue(task.getTaskHandle())); }
@Override public void setValueHiddenTaskValue(String createTaskHandleValue) { hiddenTaskHandle.setValue(createTaskHandleValue); }
/* * (non-Javadoc) * @see monbulk.shared.Services.MethodService.MethodServiceHandler#onReadMethodList(java.util.ArrayList) */ @Override public void onReadMethodList(ArrayList<pojoMethod> arrMethods) { try { Iterator<pojoMethod> it = arrMethods.iterator(); SearchWidget _SearchWidget = new SearchWidget(this); this._searchPanel.add(_SearchWidget.getHeaderWidget()); int i = 0; while (it.hasNext()) { // Use of final to allow access to it in the clickHandlers final int index = i; // This keeps track of which item we are looking at final pojoMethod tmpMethod = it.next(); this.methodList.put(tmpMethod.getMethodID(), tmpMethod); final Label titleLabel = new Label(); titleLabel.setText(tmpMethod.getMethodName()); titleLabel.addStyleName("menuMethodName"); // titleLabel.setWidth("150px"); // PushButton _clone = new PushButton(); // _clone.setStyleName("btnCloneMethod"); // _clone.addClickHandler(new ClickHandler() // { // @Override // public void onClick(ClickEvent event) { // setActiveMenu(titleLabel.getText()); // eventBus.fireEvent(new // DragEvent(titleLabel.getText(),"CloneMethod",index,(IPojo)tmpMethod)); // // } // // }); /// PushButton _edit = new PushButton(); // _edit.setStyleName("btnEditMethod"); titleLabel.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { // set selected style/should shuffle as well setActiveMenu(tmpMethod.getMethodID()); eventBus.fireEvent( new DragEvent(titleLabel.getText(), "EditMethod", index, (IPojo) tmpMethod)); } }); // this._MenuStack.setWidget(i,0,tmpItem.asWidget()); this._MenuStack.setWidget(i, 0, titleLabel); // this._MenuStack.setWidget(i,1,_edit); Hidden tmpHidden = new Hidden(); tmpHidden.setValue(tmpMethod.getMethodID()); this._MenuStack.setWidget(i, 1, tmpHidden); if (tmpMethod.getMethodName().length() > 38) { _MenuStack.getFlexCellFormatter().setStyleName(i, 0, "long"); } _MenuStack.getFlexCellFormatter().getElement(i, 0).setAttribute("style", ""); // _MenuStack.getFlexCellFormatter().getElement(i, 1).setAttribute("style", // "padding-left:5px;"); i++; } _MenuStack.setCellPadding(0); _MenuStack.setCellSpacing(0); } catch (Exception ex) { GWT.log( "Error occurs @ MethodList.onReadMethodList" + ex.getMessage() + ex.getStackTrace().toString()); } }
/** @param repositoryFile */ public ImportDialog(RepositoryFile repositoryFile, boolean allowAdvancedDialog) { super( Messages.getString("import"), Messages.getString("ok"), Messages.getString("cancel"), false, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ form = new FormPanel(); form.addSubmitHandler( new SubmitHandler() { @Override public void onSubmit(SubmitEvent se) { // if no file is selected then do not proceed okButton.setEnabled(false); cancelButton.setEnabled(false); MantleApplication.showBusyIndicator( Messages.getString("pleaseWait"), Messages.getString("importInProgress")); } }); form.addSubmitCompleteHandler( new SubmitCompleteHandler() { @Override public void onSubmitComplete(SubmitCompleteEvent sce) { MantleApplication.hideBusyIndicator(); okButton.setEnabled(false); cancelButton.setEnabled(true); ImportDialog.this.hide(); String result = sce.getResults(); if (result.length() > 5) { HTML messageTextBox = null; if (result.contains("INVALID_MIME_TYPE") == true) { messageTextBox = new HTML(Messages.getString("uploadInvalidFileTypeQuestion", result)); } else { logWindow(result, Messages.getString("importLogWindowTitle")); } if (messageTextBox != null) { PromptDialogBox dialogBox = new PromptDialogBox( Messages.getString("uploadUnsuccessful"), Messages.getString("close"), null, true, true); dialogBox.setContent(messageTextBox); dialogBox.center(); } } // if mantle_isBrowseRepoDirty=true: do getChildren call // if mantle_isBrowseRepoDirty=false: use stored fileBrowserModel in // myself.get("cachedData") setBrowseRepoDirty(Boolean.TRUE); // BISERVER-9319 Refresh browse perspective after import final GenericEvent event = new GenericEvent(); event.setEventSubType("ImportDialogEvent"); EventBusUtil.EVENT_BUS.fireEvent(event); } }); VerticalPanel rootPanel = new VerticalPanel(); VerticalPanel spacer = new VerticalPanel(); spacer.setHeight("10px"); rootPanel.add(spacer); Label fileLabel = new Label(Messages.getString("file") + ":"); final TextBox importDir = new TextBox(); rootPanel.add(fileLabel); okButton.setEnabled(false); final TextBox fileTextBox = new TextBox(); fileTextBox.setHeight("26px"); fileTextBox.setEnabled(false); // We use an fileNameOverride because FileUpload can only handle US character set reliably. final Hidden fileNameOverride = new Hidden("fileNameOverride"); final FileUpload upload = new FileUpload(); upload.setName("fileUpload"); ChangeHandler fileUploadHandler = new ChangeHandler() { @Override public void onChange(ChangeEvent event) { fileTextBox.setText(upload.getFilename()); if (!"".equals(importDir.getValue())) { // Set the fileNameOverride because the fileUpload object can only reliably transmit // US-ASCII // character set. See RFC283 section 2.3 for details String fileNameValue = upload.getFilename().replaceAll("\\\\", "/"); fileNameValue = fileNameValue.substring(fileNameValue.lastIndexOf("/") + 1); fileNameOverride.setValue(fileNameValue); okButton.setEnabled(true); } else { okButton.setEnabled(false); } } }; upload.addChangeHandler(fileUploadHandler); upload.setVisible(false); HorizontalPanel fileUploadPanel = new HorizontalPanel(); fileUploadPanel.add(fileTextBox); fileUploadPanel.add(new HTML(" ")); Button browseButton = new Button(Messages.getString("browse") + "..."); browseButton.setStyleName("pentaho-button"); fileUploadPanel.add(browseButton); browseButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { setRetainOwnershipState(); jsClickUpload(upload.getElement()); } }); rootPanel.add(fileUploadPanel); rootPanel.add(upload); applyAclPermissions.setName("applyAclPermissions"); applyAclPermissions.setValue(Boolean.FALSE); applyAclPermissions.setFormValue("false"); applyAclPermissions.setEnabled(true); applyAclPermissions.setVisible(false); final CheckBox overwriteAclPermissions = new CheckBox(Messages.getString("overwriteAclPermissions"), true); overwriteAclPermissions.setName("overwriteAclPermissions"); applyAclPermissions.setValue(Boolean.FALSE); applyAclPermissions.setFormValue("false"); overwriteAclPermissions.setEnabled(true); overwriteAclPermissions.setVisible(false); final Hidden overwriteFile = new Hidden("overwriteFile"); overwriteFile.setValue("true"); final Hidden logLevel = new Hidden("logLevel"); logLevel.setValue("ERROR"); final Hidden retainOwnership = new Hidden("retainOwnership"); retainOwnership.setValue("true"); rootPanel.add(applyAclPermissions); rootPanel.add(overwriteAclPermissions); rootPanel.add(overwriteFile); rootPanel.add(logLevel); rootPanel.add(retainOwnership); rootPanel.add(fileNameOverride); spacer = new VerticalPanel(); spacer.setHeight("4px"); rootPanel.add(spacer); DisclosurePanel disclosurePanel = new DisclosurePanel(Messages.getString("advancedOptions")); disclosurePanel.getHeader().setStyleName("gwt-Label"); disclosurePanel.setVisible(allowAdvancedDialog); HorizontalPanel mainPanel = new HorizontalPanel(); mainPanel.add(new HTML(" ")); VerticalPanel disclosureContent = new VerticalPanel(); HTML replaceLabel = new HTML(Messages.getString("fileExists")); replaceLabel.setStyleName("gwt-Label"); disclosureContent.add(replaceLabel); final CustomListBox overwriteFileDropDown = new CustomListBox(); final CustomListBox filePermissionsDropDown = new CustomListBox(); DefaultListItem replaceListItem = new DefaultListItem(Messages.getString("replaceFile")); replaceListItem.setValue("true"); overwriteFileDropDown.addItem(replaceListItem); DefaultListItem doNotImportListItem = new DefaultListItem(Messages.getString("doNotImport")); doNotImportListItem.setValue("false"); overwriteFileDropDown.addItem(doNotImportListItem); overwriteFileDropDown.setVisibleRowCount(1); disclosureContent.add(overwriteFileDropDown); spacer = new VerticalPanel(); spacer.setHeight("4px"); disclosureContent.add(spacer); HTML filePermissionsLabel = new HTML(Messages.getString("filePermissions")); filePermissionsLabel.setStyleName("gwt-Label"); disclosureContent.add(filePermissionsLabel); DefaultListItem usePermissionsListItem = new DefaultListItem(Messages.getString("usePermissions")); usePermissionsListItem.setValue("false"); filePermissionsDropDown.addItem( usePermissionsListItem); // If selected set "overwriteAclPermissions" to // false. DefaultListItem retainPermissionsListItem = new DefaultListItem(Messages.getString("retainPermissions")); retainPermissionsListItem.setValue("true"); filePermissionsDropDown.addItem( retainPermissionsListItem); // If selected set "overwriteAclPermissions" to // true. final ChangeListener filePermissionsHandler = new ChangeListener() { @Override public void onChange(Widget sender) { String value = filePermissionsDropDown.getSelectedItem().getValue().toString(); applyAclPermissions.setValue(Boolean.valueOf(value)); applyAclPermissions.setFormValue(value); overwriteAclPermissions.setFormValue(value); overwriteAclPermissions.setValue(Boolean.valueOf(value)); setRetainOwnershipState(); } }; filePermissionsDropDown.addChangeListener(filePermissionsHandler); filePermissionsDropDown.setVisibleRowCount(1); disclosureContent.add(filePermissionsDropDown); spacer = new VerticalPanel(); spacer.setHeight("4px"); disclosureContent.add(spacer); HTML fileOwnershipLabel = new HTML(Messages.getString("fileOwnership")); fileOwnershipLabel.setStyleName("gwt-Label"); disclosureContent.add(fileOwnershipLabel); retainOwnershipDropDown.addChangeListener( new ChangeListener() { @Override public void onChange(Widget sender) { String value = retainOwnershipDropDown.getSelectedItem().getValue().toString(); retainOwnership.setValue(value); } }); DefaultListItem keepOwnershipListItem = new DefaultListItem(Messages.getString("keepOwnership")); keepOwnershipListItem.setValue("true"); retainOwnershipDropDown.addItem(keepOwnershipListItem); DefaultListItem assignOwnershipListItem = new DefaultListItem(Messages.getString("assignOwnership")); assignOwnershipListItem.setValue("false"); retainOwnershipDropDown.addItem(assignOwnershipListItem); retainOwnershipDropDown.setVisibleRowCount(1); disclosureContent.add(retainOwnershipDropDown); spacer = new VerticalPanel(); spacer.setHeight("4px"); disclosureContent.add(spacer); ChangeListener overwriteFileHandler = new ChangeListener() { @Override public void onChange(Widget sender) { String value = overwriteFileDropDown.getSelectedItem().getValue().toString(); overwriteFile.setValue(value); } }; overwriteFileDropDown.addChangeListener(overwriteFileHandler); HTML loggingLabel = new HTML(Messages.getString("logging")); loggingLabel.setStyleName("gwt-Label"); disclosureContent.add(loggingLabel); final CustomListBox loggingDropDown = new CustomListBox(); loggingDropDown.addChangeListener( new ChangeListener() { public void onChange(Widget sender) { String value = loggingDropDown.getSelectedItem().getValue().toString(); logLevel.setValue(value); } }); DefaultListItem noneListItem = new DefaultListItem(Messages.getString("none")); noneListItem.setValue("ERROR"); loggingDropDown.addItem(noneListItem); DefaultListItem shortListItem = new DefaultListItem(Messages.getString("short")); shortListItem.setValue("WARN"); loggingDropDown.addItem(shortListItem); DefaultListItem debugListItem = new DefaultListItem(Messages.getString("verbose")); debugListItem.setValue("TRACE"); loggingDropDown.addItem(debugListItem); loggingDropDown.setVisibleRowCount(1); disclosureContent.add(loggingDropDown); mainPanel.add(disclosureContent); disclosurePanel.setContent(mainPanel); rootPanel.add(disclosurePanel); importDir.setName("importDir"); importDir.setText(repositoryFile.getPath()); importDir.setVisible(false); rootPanel.add(importDir); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setMethod(FormPanel.METHOD_POST); setFormAction(); form.add(rootPanel); setContent(form); }
public Header(String userName, String userIdS, String logoutUrl) { initWidget(binder.createAndBindUi(this)); userNickname.setText(userName); userId.setDefaultValue(userIdS); signOutLink.setHref(logoutUrl); }
/** * Set limit for uploaded file in Kbytes * * @param length allowed file size (Kbytes) */ public void setMaxUploadFileSize(int length) { hiddenSizeField.setValue(length + ""); }