private void hideTotals() { txtBudget.setVisible(false); txtActual.setVisible(false); txtPaid.setVisible(false); txtBalance.setVisible(false); txtPercent.setVisible(false); lblTotals.setVisible(false); lblBudget.setVisible(false); lblActual.setVisible(false); lblPaid.setVisible(false); lblBalance.setVisible(false); lblPercent.setVisible(false); }
private void setDueDateTextBoxVisibility(int condition) { if (condition == BoardsFilter.DATE_CONDITION_BETWEEN) { dueDateToBox.setVisible(true); } else { dueDateToBox.setVisible(false); } if (condition == BoardsFilter.DATE_CONDITION_UNSET || condition == BoardsFilter.DATE_CONDITION_ONLY_WITHOUT) { dueDateToBox.setVisible(false); dueDateFromBox.setVisible(false); } else { dueDateFromBox.setVisible(true); } }
private void turnNameFieldIntoLabel() { String name = patternNameField.getText(); if (name.equalsIgnoreCase(DEFAULT_PATTERN_NAME)) { name = ""; } arrowImage.setVisible(true); patternNameField.setVisible(false); if (name.equals("")) { GWTServiceLookup.getSearchService().deleteSavedSearch(currentSearchId, blackHoleCallback); currentSearchId = 0; starImage.setUrl(STAR_OFF_URL); } else { // NOTE: currently do not support updated a saved search pattern if (currentSearchId == 0) { String pattern = autoCompletePatternField.getText(); createSavedSearch(name, pattern); } else { updateSavedSearchName(currentSearchId, name); } patternNameLabel.setText(elipse(name)); patternNameLabel.setVisible(true); starImage.setUrl(STAR_ON_URL); } }
@Override public void init() { initWidget(uiBinder.createAndBindUi(this)); boundWidgets = new Widget[] { starsListBox, extraTextBox, extraListBox, number, name, length, grade, text, fa }; starsListBox.addItem(""); starsListBox.addItem("*"); starsListBox.addItem("**"); starsListBox.addItem("***"); type = ((XmlSimpleModel) this.getModel()).getXml().getNodeName(); if (type.equals("climb")) extraListBox.setVisible(false); else { WidgetUtil.setVisible(lengthSpan, false); extraTextBox.setVisible(false); extraListBox.addItem(""); extraListBox.addItem("(SDS)"); extraListBox.addItem("(Stand)"); extraListBox.addItem("(Hang)"); extraListBox.addItem("(Highball)"); extraListBox.addItem("(Highball, Stand)"); extraListBox.addItem("(Highball, SDS)"); } super.init(); }
/** * auto put a name and password in, and submit for testing/debugging * * <p>!!!! Remove me later - for testing */ public void autoLogin(String key, String password) { drawLoading(); tbConsumerKey.setText(key); tbConsumerSecret.setVisible(false); tbConsumerSecretPass.setVisible(true); tbConsumerSecretPass.setText(password); fireChange(EventManager.LOGIN); }
private void setupPatternNameField() { patternNameField.setStyleName("patternNameField"); patternNameField.setVisible(false); PatternNameFieldEventHandler handler = new PatternNameFieldEventHandler(); patternNameField.addKeyPressHandler(handler); patternNameField.addClickHandler(handler); patternNameField.addBlurHandler(handler); }
public DeleteContentPopup() { super(false); add(binder.createAndBindUi(this)); this.setGlassEnabled(true); h3Panel.setVisible(false); lblRemoving.setVisible(false); lblRemoving.getElement().getStyle().setMargin(26, Unit.PX); txtConfirmAction.setVisible(false); setButtonVisibility(true); setElementId(); txtConfirmAction.addKeyUpHandler(new ValidateConfirmText()); txtConfirmAction.getElement().getStyle().setColor("#515151"); txtConfirmAction.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { if (!txtConfirmAction.getText().isEmpty()) { if (txtConfirmAction .getText() .toLowerCase() .equalsIgnoreCase(i18n.GL1175().toLowerCase())) { txtConfirmAction.setText(""); txtConfirmAction.getElement().getStyle().setColor("#000000"); } } } }); txtConfirmAction.addBlurHandler( new BlurHandler() { @Override public void onBlur(BlurEvent event) { if (txtConfirmAction.getText().isEmpty()) { txtConfirmAction.getElement().getStyle().setColor("#515151"); } } }); StringUtil.setAttributes(txtConfirmAction, true); btnNegitive.setText(StringUtil.generateMessage(i18n.GL0142())); btnNegitive.getElement().setAttribute("alt", StringUtil.generateMessage(i18n.GL0142())); btnNegitive.getElement().setAttribute("title", StringUtil.generateMessage(i18n.GL0142())); btnPositive.setText(StringUtil.generateMessage(i18n.GL0190())); btnPositive.getElement().setAttribute("alt", StringUtil.generateMessage(i18n.GL0190())); btnPositive.getElement().setAttribute("title", StringUtil.generateMessage(i18n.GL0190())); /*lblDeleteText.setText(i18n.GL2189()); StringUtil.setAttributes(lblDeleteText.getElement(), "lblDeleteText", null, "lblDeleteText");*/ Window.enableScrolling(false); AppClientFactory.fireEvent(new SetHeaderZIndexEvent(98, false)); this.center(); }
public void setDeleteValidate(String deleteCode) { isValidate = true; this.deleteCode = deleteCode; txtConfirmAction.setVisible(true); btnPositive.setEnabled(false); btnPositive.getElement().addClassName("disabled"); }
@UiHandler("uploadBundleUploadButton") void clickUploadBundleUploadButton(ClickEvent event) { uploadBundleUploadButton.setEnabled(false); if (checkBundleFormValid()) { uploadResultTextBox.setVisible(false); showUploadProgressForBundle(true); presenter.uploadBundle( uploadBundleNameTextBox.getText(), uploadBundleClassNameTextBox.getText()); } }
private void checkInputLabel_secret() { if (getConsumerSecret().length() == 0) { tbConsumerSecret.setVisible(true); tbConsumerSecretPass.setVisible(false); } }
private void changePasswordInput() { tbConsumerSecretPass.setEnabled(true); tbConsumerSecret.setVisible(false); tbConsumerSecretPass.setVisible(true); tbConsumerSecretPass.setFocus(true); }
private void drawLoginInputs() { // default tbConsumerSecret.setVisible(true); tbConsumerSecretPass.setVisible(false); // reset ui pUi.clear(); cbRemberMe.setText("Remember Me"); hAccountCreate = new Hyperlink("Create Account", "account_Create"); tbConsumerKey.setTitle(inputLabel_ConsumerKey); tbConsumerSecret.setTitle(inputLabel_consumerSecret); tbConsumerSecretPass.setTitle(inputLabel_consumerSecret); // hide loading by default hideLoading(); // main login inputs HorizontalPanel ploginItems = new HorizontalPanel(); ploginItems.setWidth("100%"); ploginItems.add(tbConsumerKey); ploginItems.add(tbConsumerSecret); ploginItems.add(tbConsumerSecretPass); ploginItems.add(bLogin); // login options HorizontalPanel pOptions = new HorizontalPanel(); // pOptions.setSpacing(4); pOptions.add(cbRemberMe); pOptions.add(hForgotPassword); pOptions.add(hAccountCreate); VerticalPanel vp = new VerticalPanel(); vp.setWidth("100%"); vp.add(ploginItems); vp.add(pOptions); // TODO - move this to a floating overlay vp.add(pError); pUi.add(vp); drawInputLabel_key(); drawInputLabel_secret(); tbConsumerKey.addStyleName("login-Ui-InputConsumerKey"); tbConsumerSecret.addStyleName("login-Ui-InputConsumerSecret"); tbConsumerSecretPass.addStyleName("login-Ui-InputConsumerSecret"); pOptions.setCellHorizontalAlignment(hForgotPassword, HorizontalPanel.ALIGN_RIGHT); pOptions.setCellHorizontalAlignment(hAccountCreate, HorizontalPanel.ALIGN_RIGHT); pOptions.setCellVerticalAlignment(hForgotPassword, VerticalPanel.ALIGN_BOTTOM); pOptions.setCellVerticalAlignment(hAccountCreate, VerticalPanel.ALIGN_BOTTOM); pOptions.addStyleName("login-Ui-InputOptions"); pOptions.setWidth("100%"); // vp.addStyleName("test1"); // pOptions.addStyleName("test2"); }
private void turnNameLabelIntoField() { patternNameField.setText(patternNameLabel.getText()); patternNameField.setVisible(true); patternNameLabel.setVisible(false); patternNameField.setFocus(true); }
private void createComponent() { hlBack = new Anchor("<<back"); hlBack.addClickHandler(this); vPanel.add(hlBack); ProjectItems projectItems = currentUser.getProjectItems(); if (projectItems.getProjectItemCount() == 0) { vPanel.add(new HTML("You are not subscribed to any projects.")); } else { vPanel.add(form); lbProjects = new ListBox(false); lbProjects.addChangeHandler(this); vPanel.setSize("1000px", "500px"); table.setCellSpacing(5); table.setCellPadding(0); table.setWidth("100%"); tbName.setWidth("300px"); // tbDescription.setWidth("300px"); txtFileNotes.setHeight("75px"); upload.setName("uploadFormElement"); // fileUpload.setName("fileuploadFormElement"); tbName.setName("name"); tbDescription.setName("description"); txtFileNotes.setName("notes"); lbProjects.setName("projectDetails"); btnSubmit.addClickHandler(this); txtWarnings.setStylePrimaryName("warnings"); txtWarningDesc.setStylePrimaryName("warnings"); txtFileNotes.setCharacterWidth(50); tbName.setMaxLength(50); // tbDescription.setMaxLength(255); // tbDescription.setText(""); txtLogin = new TextBox(); txtLogin.setName("user"); txtLogin.setVisible(false); txtProject = new TextBox(); txtProject.setName("projectName"); txtProject.setVisible(false); int projectId = currentUser.getPreferredProjectId(); for (int i = 0; i < projectItems.getProjectItemCount(); i++) { ProjectItem item = projectItems.getProjectItem(i); lbProjects.addItem(item.getProjectName(), String.valueOf(item.getProjectId())); if (projectId > 0) { if (projectId == item.getProjectId()) { lbProjects.setItemSelected(i, true); } } else { lbProjects.setItemSelected(0, true); } } table.setText(0, 0, ""); table.setWidget(0, 1, txtWarnings); table.setText(1, 0, ""); table.setWidget(1, 1, txtWarningDesc); table.setWidget(2, 0, new HTML("<b>Name:</b> ")); table.setWidget(2, 1, tbName); table.setWidget(3, 0, new HTML("<b>File:</b> ")); table.setWidget(3, 1, upload); // table.setWidget(4, 0, new HTML("<b>Description:</b> ")); // table.setWidget(4, 1, fileUpload); table.setWidget(5, 0, new HTML("<b>Project:</b> ")); table.setWidget(5, 1, lbProjects); table.setWidget(6, 0, new HTML("<b>Notes:</b> ")); table.setWidget(6, 1, txtFileNotes); table.setWidget(7, 1, btnSubmit); table.setWidget(7, 2, txtLogin); table.setWidget(7, 3, txtProject); table.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setVerticalAlignment(2, 0, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(3, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setVerticalAlignment(3, 0, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(4, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setVerticalAlignment(4, 0, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(5, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setVerticalAlignment(5, 0, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(6, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setVerticalAlignment(6, 0, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(7, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setVerticalAlignment(7, 0, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT); table.getCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_LEFT); table.getCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(2, 1, HasHorizontalAlignment.ALIGN_LEFT); table.getCellFormatter().setVerticalAlignment(2, 1, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(3, 1, HasHorizontalAlignment.ALIGN_LEFT); table.getCellFormatter().setVerticalAlignment(3, 1, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(4, 1, HasHorizontalAlignment.ALIGN_LEFT); table.getCellFormatter().setVerticalAlignment(4, 1, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(5, 1, HasHorizontalAlignment.ALIGN_LEFT); table.getCellFormatter().setVerticalAlignment(5, 1, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(6, 1, HasHorizontalAlignment.ALIGN_LEFT); table.getCellFormatter().setVerticalAlignment(6, 1, HasVerticalAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(7, 1, HasHorizontalAlignment.ALIGN_LEFT); table.getCellFormatter().setVerticalAlignment(7, 1, HasVerticalAlignment.ALIGN_TOP); form.add(table); form.setAction(UPLOAD_ACTION_URL); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setMethod(FormPanel.METHOD_POST); form.addSubmitHandler( new FormPanel.SubmitHandler() { public void onSubmit(SubmitEvent event) { // This event is fired just before the form is submitted. We can // take this opportunity to perform validation. String fileName1 = upload.getFilename().trim(); // String fileName2 = fileUpload.getFilename().trim(); // System.out.println("File1: " + fileName1); if (fileName1.length() == 0 && tbName.getText().length() == 0) { txtWarnings.setHTML("*Please upload a file."); txtWarningDesc.setHTML("*Please enter the Job name."); event.cancel(); } if ((fileName1.length() == 0) && tbName.getText().length() != 0) { txtWarnings.setText(""); txtWarningDesc.setText(""); txtWarnings.setHTML("*Please upload a file."); event.cancel(); } if ((!(fileName1.length() == 0)) && tbName.getText().length() == 0) { txtWarnings.setText(""); txtWarningDesc.setText(""); txtWarnings.setHTML("*Please enter the Job name."); event.cancel(); } } }); form.addSubmitCompleteHandler( new FormPanel.SubmitCompleteHandler() { public void onSubmitComplete(SubmitCompleteEvent event) { txtFileNotes.setText(""); txtWarningDesc.setText(""); String sessionID = Cookies.getCookie("sid"); if (sessionID != null) { String result = event.getResults(); System.out.println("UploadJob Result: " + result); // Log.info("Result: " + result); String[] results = result.split("~"); /*for(int i = 0; i < results.length; i++) { System.out.println(results[i]); try { jobId = Integer.parseInt(results[0]); } catch(NumberFormatException e) { e.printStackTrace(); } }*/ int jobId = -1; try { jobId = Integer.parseInt(results[0]); } catch (NumberFormatException e) { e.printStackTrace(); } // Code modified if (jobId == 0) { txtWarnings.setHTML(results[1]); } // Code modified // txtWarnings.setHTML(results[1]); else { if (currentUser.getUsertype().equalsIgnoreCase("user")) { History.newItem("userJobList"); } else { if (tab == 0) { History.newItem("adminJobList"); } else { History.newItem("jobList"); } // AdminPage adminPage = new AdminPage(tab); // RootPanel.get("content").add(adminPage); } } } else { Login login = new Login(); login.displayLoginBox(); } } }); } }
public StateEditarPerfil(EstradaSolidariaServiceAsync estradaSolidariaService, String[] result) { this.estradaService = estradaSolidariaService; this.idSessaoAberta = EstradaSolidaria.getIdSessaoAberta(); this.dadosUsuario = result; Resources resources = GWT.create(Resources.class); AbsolutePanel absolutePanel_EditarPerfil = new AbsolutePanel(); absolutePanel_EditarPerfil.setStylePrimaryName("painelPerfil3"); initWidget(absolutePanel_EditarPerfil); absolutePanel_EditarPerfil.setSize("873px", "433px"); Label lblEditarPerfil = new Label("Editar Perfil"); lblEditarPerfil.setStyleName("gwt-LabelEstradaSolidaria2"); absolutePanel_EditarPerfil.add(lblEditarPerfil, 183, 10); AbsolutePanel absolutePanel_1 = new AbsolutePanel(); absolutePanel_EditarPerfil.add(absolutePanel_1, 54, 48); absolutePanel_1.setSize("812px", "375px"); Label lblNewLabel = new Label("Login:"******"Editar"); absolutePanel_1.add(txtBtnEditarLogin, 84, 32); textBoxNovoLogin = new TextBox(); textBoxNovoLogin.addKeyPressHandler( new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { lblMensagemDeErroLogin.setVisible(false); } }); absolutePanel_1.add(textBoxNovoLogin, 145, 32); textBoxNovoLogin.setVisible(false); txtbtnLoginOk = new TextButton("OK"); txtbtnLoginOk.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { editarLoginGUI(idSessaoAberta, textBoxNovoLogin.getText()); } }); absolutePanel_1.add(txtbtnLoginOk, 306, 32); txtbtnLoginOk.setVisible(false); Label lblSenha = new Label("Senha:"); absolutePanel_1.add(lblSenha, 473, 10); TextButton txtbtnAlterarSenha = new TextButton("Alterar senha"); txtbtnAlterarSenha.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { DialogBox newDialog = new DialogBoxAlterarSenha(estradaService); newDialog.center(); newDialog.show(); } }); absolutePanel_1.add(txtbtnAlterarSenha, 473, 32); Label lblNome = new Label("Nome:"); absolutePanel_1.add(lblNome, 10, 85); lblNomeusuario = new Label(dadosUsuario[2]); absolutePanel_1.add(lblNomeusuario, 74, 85); TextButton btnEditarNome = new TextButton("Editar"); absolutePanel_1.add(btnEditarNome, 85, 107); textBoxNovoNome = new TextBox(); textBoxNovoNome.addKeyPressHandler( new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { lblMensagemDeErroNome.setVisible(false); } }); absolutePanel_1.add(textBoxNovoNome, 145, 107); textBoxNovoNome.setVisible(false); txtbtnNomeOk = new TextButton("OK"); txtbtnNomeOk.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { editarNomeGUI(idSessaoAberta, textBoxNovoNome.getText()); } }); absolutePanel_1.add(txtbtnNomeOk, 306, 107); txtbtnNomeOk.setVisible(false); Label lblEmail = new Label("Email:"); absolutePanel_1.add(lblEmail, 10, 164); lblEmaildousuario = new Label(dadosUsuario[4]); absolutePanel_1.add(lblEmaildousuario, 74, 164); TextButton btnEditarEmail = new TextButton("Editar"); absolutePanel_1.add(btnEditarEmail, 85, 184); textBoxNovoEmail = new TextBox(); textBoxNovoEmail.addKeyPressHandler( new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { lblMensagemDeErroEmail.setVisible(false); } }); absolutePanel_1.add(textBoxNovoEmail, 145, 184); textBoxNovoEmail.setVisible(false); txtbtnEmailOk = new TextButton("OK"); txtbtnEmailOk.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { editarEmailGUI(idSessaoAberta, textBoxNovoEmail.getText()); } }); absolutePanel_1.add(txtbtnEmailOk, 306, 184); txtbtnEmailOk.setVisible(false); Label lblEndereo = new Label("Endereço:"); absolutePanel_1.add(lblEndereo, 9, 243); lblEnderecodousuario = new Label(dadosUsuario[3]); absolutePanel_1.add(lblEnderecodousuario, 74, 243); TextButton btnEditarEndereco = new TextButton("Editar"); absolutePanel_1.add(btnEditarEndereco, 85, 265); textBoxNovoEndereco = new TextBox(); textBoxNovoEndereco.addKeyPressHandler( new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { lblMensagemDeErroEndereco.setVisible(false); } }); absolutePanel_1.add(textBoxNovoEndereco, 145, 265); textBoxNovoEndereco.setVisible(false); txtbtnEnderecoOk = new TextButton("OK"); txtbtnEnderecoOk.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { editarEnderecoGUI(idSessaoAberta, textBoxNovoEndereco.getText()); } }); absolutePanel_1.add(txtbtnEnderecoOk, 306, 265); txtbtnEnderecoOk.setVisible(false); FileUpload fileUpload = new FileUpload(); absolutePanel_1.add(fileUpload, 473, 319); fileUpload.setSize("330px", "22px"); Image image = new Image(resources.getGenericUserImage()); absolutePanel_1.add(image, 473, 174); image.setSize("126px", "139px"); lblMensagemDeErroLogin = new Label("erro login"); lblMensagemDeErroLogin.setStyleName("gwt-LabelEstradaSolidaria5"); absolutePanel_1.add(lblMensagemDeErroLogin, 145, 62); lblMensagemDeErroLogin.setVisible(false); lblMensagemDeErroNome = new Label("erro nome"); lblMensagemDeErroNome.setStyleName("gwt-LabelEstradaSolidaria5"); absolutePanel_1.add(lblMensagemDeErroNome, 145, 141); lblMensagemDeErroNome.setVisible(false); lblMensagemDeErroEmail = new Label("erro email"); lblMensagemDeErroEmail.setStyleName("gwt-LabelEstradaSolidaria5"); absolutePanel_1.add(lblMensagemDeErroEmail, 145, 218); lblMensagemDeErroEmail.setVisible(false); lblMensagemDeErroEndereco = new Label("erro endereco"); lblMensagemDeErroEndereco.setStyleName("gwt-LabelEstradaSolidaria5"); absolutePanel_1.add(lblMensagemDeErroEndereco, 145, 297); lblMensagemDeErroEndereco.setVisible(false); btnEditarEndereco.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { textBoxNovoEndereco.setVisible(true); txtbtnEnderecoOk.setVisible(true); } }); btnEditarEmail.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { textBoxNovoEmail.setVisible(true); txtbtnEmailOk.setVisible(true); } }); btnEditarNome.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { textBoxNovoNome.setVisible(true); txtbtnNomeOk.setVisible(true); } }); txtBtnEditarLogin.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { textBoxNovoLogin.setVisible(true); txtbtnLoginOk.setVisible(true); } }); }
/** @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); }