List of usage examples for com.google.gwt.user.client.ui FlexTable getFlexCellFormatter
public FlexCellFormatter getFlexCellFormatter()
From source file:org.freemedsoftware.gwt.client.widget.PatientInfoBar.java
License:Open Source License
@SuppressWarnings("unchecked") public FlexTable loadCoverageInfo(Object data) { HashMap<String, String>[] hashMaps = (HashMap<String, String>[]) data; FlexTable coverageInfoTable = new FlexTable(); coverageInfoTable.setBorderWidth(1); Label coverageInfolbl = new Label(_("Coverage Info")); coverageInfolbl.setStyleName(AppConstants.STYLE_LABEL_NORMAL_BOLD); coverageInfoTable.setWidget(0, 0, coverageInfolbl); coverageInfoTable.getFlexCellFormatter().setColSpan(0, 0, hashMaps.length + 1); coverageInfoTable.getFlexCellFormatter().setHorizontalAlignment(0, 0, HorizontalPanel.ALIGN_CENTER); coverageInfoTable.getRowFormatter().setStyleName(1, AppConstants.STYLE_HEADER_PANEL); int row = 2;//w w w.java 2 s. c om coverageInfoTable.getFlexCellFormatter().setHorizontalAlignment(0, 0, HorizontalPanel.ALIGN_CENTER); coverageInfoTable.setWidget(row, 0, new Label(_("Insurance Company"))); row++; coverageInfoTable.setWidget(row, 0, new Label(_("Group - Plan Name"))); row++; coverageInfoTable.setWidget(row, 0, new Label(_("Insurance ID Number"))); row++; coverageInfoTable.setWidget(row, 0, new Label(_("Insurance Group Number"))); row++; coverageInfoTable.setWidget(row, 0, new Label(_("Start Date"))); row++; coverageInfoTable.setWidget(row, 0, new Label(_("Relationship to Insured"))); row++; coverageInfoTable.setWidget(row, 0, new Label(_("Copay"))); row++; coverageInfoTable.setWidget(row, 0, new Label(_("Deductable"))); row = 1; int col = 1; for (int i = 0; i < hashMaps.length; i++) { HashMap<String, String> retrieveData = hashMaps[i]; coverageInfoTable.setWidget(row++, col, new Label(_("Coverage") + "#" + (i + 1))); coverageInfoTable.setWidget(row++, col, new Label(retrieveData.get("insco"))); coverageInfoTable.setWidget(row++, col, new Label(retrieveData.get("covplanname"))); coverageInfoTable.setWidget(row++, col, new Label(retrieveData.get("covpatinsno"))); coverageInfoTable.setWidget(row++, col, new Label(retrieveData.get("covpatgrpno"))); coverageInfoTable.setWidget(row++, col, new Label(retrieveData.get("coveffdt"))); coverageInfoTable.setWidget(row++, col, new Label(PatientCoverages.returnRelationshipToInsured(retrieveData.get("covrel")))); coverageInfoTable.setWidget(row++, col, new Label(retrieveData.get("covcopay"))); coverageInfoTable.setWidget(row++, col, new Label(retrieveData.get("covdeduct"))); col++; row = 1; } return coverageInfoTable; }
From source file:org.freemedsoftware.gwt.client.widget.PatientInfoBar.java
License:Open Source License
public FlexTable loadAuthInfo(Object data) { @SuppressWarnings("unchecked") HashMap<String, String>[] hashMaps = (HashMap<String, String>[]) data; FlexTable authInfoTable = new FlexTable(); authInfoTable.setBorderWidth(1);/* w w w .j a v a 2s. c o m*/ Label authInfolbl = new Label(_("Authorization Info")); authInfolbl.setStyleName(AppConstants.STYLE_LABEL_NORMAL_BOLD); authInfoTable.setWidget(0, 0, authInfolbl); authInfoTable.getFlexCellFormatter().setColSpan(0, 0, hashMaps.length + 1); authInfoTable.getFlexCellFormatter().setHorizontalAlignment(0, 0, HorizontalPanel.ALIGN_CENTER); authInfoTable.getRowFormatter().setStyleName(1, AppConstants.STYLE_HEADER_PANEL); int row = 2; authInfoTable.getFlexCellFormatter().setHorizontalAlignment(0, 0, HorizontalPanel.ALIGN_CENTER); authInfoTable.setWidget(row, 0, new Label(_("Starting Date") + ":")); row++; authInfoTable.setWidget(row, 0, new Label(_("Ending Date") + ":")); row++; authInfoTable.setWidget(row, 0, new Label(_("Authorization Number"))); row++; authInfoTable.setWidget(row, 0, new Label(_("Authorization Provider"))); row++; authInfoTable.setWidget(row, 0, new Label(_("Authorizing Insurance Company"))); row++; authInfoTable.setWidget(row, 0, new Label(_("Number of Visits"))); row++; authInfoTable.setWidget(row, 0, new Label(_("Used Visits"))); row = 1; int col = 1; for (int i = 0; i < hashMaps.length; i++) { HashMap<String, String> retrieveData = hashMaps[i]; authInfoTable.setWidget(row++, col, new Label(_("Autoriztion") + "#" + (i + 1))); authInfoTable.setWidget(row++, col, new Label(retrieveData.get("authdtbegin"))); authInfoTable.setWidget(row++, col, new Label(retrieveData.get("authdtend"))); authInfoTable.setWidget(row++, col, new Label(retrieveData.get("authnum"))); authInfoTable.setWidget(row++, col, new Label(retrieveData.get("provider"))); authInfoTable.setWidget(row++, col, new Label(retrieveData.get("insco"))); authInfoTable.setWidget(row++, col, new Label(retrieveData.get("authvisits"))); authInfoTable.setWidget(row++, col, new Label(retrieveData.get("authvisitsused"))); row = 1; } return authInfoTable; }
From source file:org.gss_project.gss.web.client.CredentialsDialog.java
License:Open Source License
/** * The widget constructor./*from ww w .j a v a2s . co m*/ */ public CredentialsDialog(final MessagePanel.Images images) { // Set the dialog's caption. setText("User Credentials"); setAnimationEnabled(true); // A VerticalPanel that contains the 'about' label and the 'OK' button. VerticalPanel outer = new VerticalPanel(); Configuration conf = (Configuration) GWT.create(Configuration.class); String service = conf.serviceName(); String path = Window.Location.getPath(); String baseUrl = GWT.getModuleBaseURL(); String homeUrl = baseUrl.substring(0, baseUrl.indexOf(path)); String webdavUrl = homeUrl + conf.webdavUrl(); String tokenNote = conf.tokenTTLNote(); // Create the text and set a style name so we can style it with CSS. HTML text = new HTML("<p>These are the user credentials that are " + "required for interacting with " + service + ". You can copy" + " and paste the username and password in the WebDAV client " + "in order to use " + service + " through the WebDAV " + "interface, at:<br/> " + webdavUrl + "<br/>" + tokenNote + "</p>"); text.setStyleName("gss-AboutText"); text.setWidth(WIDTH_TEXT); outer.add(text); FlexTable table = new FlexTable(); table.setText(0, 0, "Username"); table.setText(1, 0, "Password"); table.setText(2, 0, "Token"); TextBox username = new TextBox(); final GSS app = GSS.get(); username.setText(app.getCurrentUserResource().getUsername()); username.setReadOnly(true); username.setWidth(WIDTH_FIELD); username.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { GSS.enableIESelection(); ((TextBox) event.getSource()).selectAll(); GSS.preventIESelection(); } }); table.setWidget(0, 1, username); passwordBox = new TextBox(); passwordBox.setText(app.getWebDAVPassword()); passwordBox.setReadOnly(true); passwordBox.setWidth(WIDTH_FIELD); passwordBox.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { GSS.enableIESelection(); ((TextBox) event.getSource()).selectAll(); GSS.preventIESelection(); } }); table.setWidget(1, 1, passwordBox); TextBox tokenBox = new TextBox(); tokenBox.setText(app.getToken()); tokenBox.setReadOnly(true); tokenBox.setWidth(WIDTH_FIELD); tokenBox.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { GSS.enableIESelection(); ((TextBox) event.getSource()).selectAll(); GSS.preventIESelection(); } }); table.setWidget(2, 1, tokenBox); table.getFlexCellFormatter().setStyleName(0, 0, "props-labels"); table.getFlexCellFormatter().setStyleName(0, 1, "props-values"); table.getFlexCellFormatter().setStyleName(1, 0, "props-labels"); table.getFlexCellFormatter().setStyleName(1, 1, "props-values"); table.getFlexCellFormatter().setStyleName(2, 0, "props-labels"); table.getFlexCellFormatter().setStyleName(2, 1, "props-values"); outer.add(table); // Create the 'OK' button, along with a listener that hides the dialog // when the button is clicked. Button confirm = new Button("Close", new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); } }); outer.add(confirm); outer.setCellHorizontalAlignment(confirm, HasHorizontalAlignment.ALIGN_CENTER); // Create the 'Reset password' button, along with a listener that hides // the dialog when the button is clicked. Button resetPassword = new Button("Reset Password", new ClickHandler() { @Override public void onClick(ClickEvent event) { ConfirmResetPasswordDialog dlg = new ConfirmResetPasswordDialog(images); dlg.center(); } }); outer.add(resetPassword); outer.setCellHorizontalAlignment(resetPassword, HasHorizontalAlignment.ALIGN_CENTER); outer.setSpacing(8); setWidget(outer); }
From source file:org.gss_project.gss.web.client.FilePropertiesDialog.java
License:Open Source License
/** * The widget's constructor.//from w w w. j a va 2 s .co m * * @param images the dialog's ImageBundle * @param groups * @param bodies */ public FilePropertiesDialog(final Images images, final List<GroupResource> groups, List<FileResource> bodies, String _userFullName) { // Set the dialog's caption. setText("File properties"); file = (FileResource) GSS.get().getCurrentSelection(); userFullName = _userFullName; permList = new PermissionsList(images, file.getPermissions(), file.getOwner()); GWT.log("FILE PERMISSIONS:" + file.getPermissions()); // Outer contains inner and buttons. final VerticalPanel outer = new VerticalPanel(); final FocusPanel focusPanel = new FocusPanel(outer); // Inner contains generalPanel and permPanel. inner = new DecoratedTabPanel(); inner.setAnimationEnabled(true); final VerticalPanel generalPanel = new VerticalPanel(); final VerticalPanel permPanel = new VerticalPanel(); final HorizontalPanel buttons = new HorizontalPanel(); final HorizontalPanel permButtons = new HorizontalPanel(); final HorizontalPanel permForAll = new HorizontalPanel(); final HorizontalPanel pathPanel = new HorizontalPanel(); final VerticalPanel verPanel = new VerticalPanel(); final HorizontalPanel vPanel = new HorizontalPanel(); final HorizontalPanel vPanel2 = new HorizontalPanel(); versioned.setValue(file.isVersioned()); versioned.getElement().setId("filePropertiesDialog.chechBox.versioned"); inner.add(generalPanel, "General"); inner.add(permPanel, "Sharing"); inner.add(verPanel, "Versions"); inner.selectTab(0); final Label fileNameNote = new Label("Please note that slashes ('/') are not allowed in file names.", true); fileNameNote.setVisible(false); fileNameNote.setStylePrimaryName("gss-readForAllNote"); final FlexTable generalTable = new FlexTable(); generalTable.setText(0, 0, "Name"); generalTable.setText(1, 0, "Folder"); generalTable.setText(2, 0, "Owner"); generalTable.setText(3, 0, "Last modified"); generalTable.setText(4, 0, "Tags"); name.setWidth("100%"); name.setText(file.getName()); name.getElement().setId("filePropertiesDialog.textBox.name"); generalTable.setWidget(0, 1, name); name.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { if (name.getText().contains("/")) fileNameNote.setVisible(true); else fileNameNote.setVisible(false); } }); if (file.getFolderName() != null) generalTable.setText(1, 1, file.getFolderName()); else generalTable.setText(1, 1, "-"); generalTable.setWidget(0, 2, fileNameNote); generalTable.setText(2, 1, userFullName); final DateTimeFormat formatter = DateTimeFormat.getFormat("d/M/yyyy h:mm a"); generalTable.setText(3, 1, formatter.format(file.getModificationDate())); // Get the tags. StringBuffer tagsBuffer = new StringBuffer(); Iterator i = file.getTags().iterator(); while (i.hasNext()) { String tag = (String) i.next(); tagsBuffer.append(tag).append(", "); } if (tagsBuffer.length() > 1) tagsBuffer.delete(tagsBuffer.length() - 2, tagsBuffer.length() - 1); initialTagText = tagsBuffer.toString(); tags.setWidth("100%"); tags.getElement().setId("filePropertiesDialog.textBox.tags"); tags.setText(initialTagText); generalTable.setWidget(4, 1, tags); generalTable.getFlexCellFormatter().setStyleName(0, 0, "props-labels"); generalTable.getFlexCellFormatter().setStyleName(1, 0, "props-labels"); generalTable.getFlexCellFormatter().setStyleName(2, 0, "props-labels"); generalTable.getFlexCellFormatter().setStyleName(3, 0, "props-labels"); generalTable.getFlexCellFormatter().setStyleName(4, 0, "props-labels"); generalTable.getFlexCellFormatter().setStyleName(0, 1, "props-values"); generalTable.getFlexCellFormatter().setStyleName(1, 1, "props-values"); generalTable.getFlexCellFormatter().setStyleName(2, 1, "props-values"); generalTable.getFlexCellFormatter().setStyleName(3, 1, "props-values"); generalTable.getFlexCellFormatter().setStyleName(4, 1, "props-values"); generalTable.setCellSpacing(4); // Create the 'OK' button, along with a listener that hides the dialog // when the button is clicked. final Button ok = new Button("OK", new ClickHandler() { @Override public void onClick(ClickEvent event) { if (name.getText().contains("/")) fileNameNote.setVisible(true); else { fileNameNote.setVisible(false); accept(); closeDialog(); } } }); ok.getElement().setId("filePropertiesDialog.button.ok"); buttons.add(ok); buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER); // Create the 'Cancel' button, along with a listener that hides the // dialog when the button is clicked. final Button cancel = new Button("Cancel", new ClickHandler() { @Override public void onClick(ClickEvent event) { closeDialog(); } }); cancel.getElement().setId("filePropertiesDialog.button.cancel"); buttons.add(cancel); buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER); buttons.setSpacing(8); buttons.addStyleName("gss-TabPanelBottom"); generalPanel.add(generalTable); // Asynchronously retrieve the tags defined by this user. DeferredCommand.addCommand(new Command() { @Override public void execute() { updateTags(); } }); DisclosurePanel allTags = new DisclosurePanel("All tags"); allTagsContent = new FlowPanel(); allTagsContent.setWidth("100%"); allTags.setContent(allTagsContent); generalPanel.add(allTags); generalPanel.setSpacing(4); final Button add = new Button("Add Group", new ClickHandler() { @Override public void onClick(ClickEvent event) { PermissionsAddDialog dlg = new PermissionsAddDialog(groups, permList, false); dlg.center(); } }); add.getElement().setId("filePropertiesDialog.button.addGroup"); permButtons.add(add); permButtons.setCellHorizontalAlignment(add, HasHorizontalAlignment.ALIGN_CENTER); final Button addUser = new Button("Add User", new ClickHandler() { @Override public void onClick(ClickEvent event) { PermissionsAddDialog dlg = new PermissionsAddDialog(groups, permList, true); dlg.center(); } }); add.getElement().setId("filePropertiesDialog.button.addUser"); permButtons.add(addUser); permButtons.setCellHorizontalAlignment(addUser, HasHorizontalAlignment.ALIGN_CENTER); permButtons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER); permButtons.setSpacing(8); permButtons.addStyleName("gss-TabPanelBottom"); final Label readForAllNote = new Label("When this option is enabled, the file will be readable" + " by everyone. By checking this option, you are certifying that you have the right to " + "distribute this file and that it does not violate the Terms of Use.", true); readForAllNote.setVisible(false); readForAllNote.setStylePrimaryName("gss-readForAllNote"); readForAll = new CheckBox(); readForAll.getElement().setId("filePropertiesDialog.checkBox.public"); readForAll.setValue(file.isReadForAll()); readForAll.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { readForAllNote.setVisible(readForAll.getValue()); } }); permPanel.add(permList); permPanel.add(permButtons); // Only show the read for all permission if the user is the owner. if (file.getOwner().equals(GSS.get().getCurrentUserResource().getUsername())) { permForAll.add(new Label("Public")); permForAll.add(readForAll); permForAll.setSpacing(8); permForAll.addStyleName("gss-TabPanelBottom"); permForAll.add(readForAllNote); permPanel.add(permForAll); } TextBox path = new TextBox(); path.setWidth("100%"); path.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { GSS.enableIESelection(); ((TextBox) event.getSource()).selectAll(); GSS.preventIESelection(); } }); path.setText(file.getUri()); path.getElement().setId("filePropertiesDialog.textBox.link"); path.setTitle( "Use this link for sharing the file via e-mail, IM, etc. (crtl-C/cmd-C to copy to system clipboard)"); path.setWidth("100%"); path.setReadOnly(true); pathPanel.setWidth("100%"); pathPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); pathPanel.add(new Label("Link")); pathPanel.setSpacing(8); pathPanel.addStyleName("gss-TabPanelBottom"); pathPanel.add(path); permPanel.add(pathPanel); VersionsList verList = new VersionsList(this, images, bodies); verPanel.add(verList); vPanel.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER); vPanel.setSpacing(8); vPanel.addStyleName("gss-TabPanelBottom"); vPanel.add(new Label("Versioned")); vPanel.add(versioned); verPanel.add(vPanel); vPanel2.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER); vPanel2.setSpacing(8); vPanel2.addStyleName("gss-TabPanelBottom"); Button removeVersionsButton = new Button(AbstractImagePrototype.create(images.delete()).getHTML(), new ClickHandler() { @Override public void onClick(ClickEvent event) { ConfirmationDialog confirm = new ConfirmationDialog( "Really " + "remove all previous versions?", "Remove") { @Override public void cancel() { } @Override public void confirm() { FilePropertiesDialog.this.closeDialog(); removeAllOldVersions(); } }; confirm.center(); } }); HTML removeAllVersion = new HTML("<span>Remove all previous versions?</span>"); vPanel2.add(removeAllVersion); vPanel2.add(removeVersionsButton); verPanel.add(vPanel2); if (!file.isVersioned()) vPanel2.setVisible(false); outer.add(inner); outer.add(buttons); outer.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER); outer.addStyleName("gss-TabPanelBottom"); focusPanel.setFocus(true); setWidget(outer); }
From source file:org.gss_project.gss.web.client.FilesPropertiesDialog.java
License:Open Source License
/** * The widget's constructor.//from w w w .ja va 2s . c o m * * @param _files */ public FilesPropertiesDialog(final List<FileResource> _files) { super(); files = _files; int versionedNum = 0; for (FileResource fr : files) if (fr.isVersioned()) versionedNum++; Boolean versioned = null; if (versionedNum == 0) versioned = false; if (versionedNum == files.size()) versioned = true; initialVersioned = versioned; versionedCheck = new TristateCheckBox(versioned); // Set the dialog's caption. setText("Files properties"); // Outer contains inner and buttons. final VerticalPanel outer = new VerticalPanel(); final FocusPanel focusPanel = new FocusPanel(outer); // Inner contains generalPanel and permPanel. inner = new DecoratedTabPanel(); inner.setAnimationEnabled(true); final VerticalPanel generalPanel = new VerticalPanel(); final HorizontalPanel buttons = new HorizontalPanel(); final VerticalPanel verPanel = new VerticalPanel(); final HorizontalPanel vPanel = new HorizontalPanel(); inner.add(generalPanel, "General"); inner.add(verPanel, "Versions"); inner.selectTab(0); final FlexTable generalTable = new FlexTable(); generalTable.setText(0, 0, String.valueOf(files.size()) + " files selected"); generalTable.setText(1, 0, "Folder"); generalTable.setText(2, 0, "Tags"); FileResource firstFile = files.get(0); if (firstFile.getFolderName() != null) generalTable.setText(1, 1, firstFile.getFolderName()); else generalTable.setText(1, 1, "-"); // Find if tags are identical List<String> tagsList = files.get(0).getTags(); List<String> tagss; for (int i = 1; i < files.size(); i++) { tagss = files.get(i).getTags(); if (tagsList.size() != tagss.size() || !tagsList.containsAll(tagss)) { tagsList = null; break; } } // Get the tags. StringBuffer tagsBuffer = new StringBuffer(); if (tagsList == null) tagsBuffer.append(MULTIPLE_VALUES_TEXT); else { Iterator i = tagsList.iterator(); while (i.hasNext()) { String tag = (String) i.next(); tagsBuffer.append(tag).append(", "); } if (tagsBuffer.length() > 1) tagsBuffer.delete(tagsBuffer.length() - 2, tagsBuffer.length() - 1); } initialTagText = tagsBuffer.toString(); tags.setText(initialTagText); tags.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { if (MULTIPLE_VALUES_TEXT.equals(tags.getText())) tags.setText(""); } }); generalTable.setWidget(2, 1, tags); generalTable.getFlexCellFormatter().setStyleName(0, 0, "props-labels"); generalTable.getFlexCellFormatter().setColSpan(0, 0, 2); generalTable.getFlexCellFormatter().setStyleName(1, 0, "props-labels"); generalTable.getFlexCellFormatter().setStyleName(2, 0, "props-labels"); generalTable.getFlexCellFormatter().setStyleName(0, 1, "props-values"); generalTable.getFlexCellFormatter().setStyleName(1, 1, "props-values"); generalTable.getFlexCellFormatter().setStyleName(2, 1, "props-values"); generalTable.setCellSpacing(4); // Create the 'OK' button, along with a listener that hides the dialog // when the button is clicked. final Button ok = new Button("OK", new ClickHandler() { @Override public void onClick(ClickEvent event) { accept(); closeDialog(); } }); buttons.add(ok); buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER); // Create the 'Cancel' button, along with a listener that hides the // dialog when the button is clicked. final Button cancel = new Button("Cancel", new ClickHandler() { @Override public void onClick(ClickEvent event) { closeDialog(); } }); buttons.add(cancel); buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER); buttons.setSpacing(8); buttons.addStyleName("gss-TabPanelBottom"); generalPanel.add(generalTable); // Asynchronously retrieve the tags defined by this user. DeferredCommand.addCommand(new Command() { @Override public void execute() { updateTags(); } }); DisclosurePanel allTags = new DisclosurePanel("All tags"); allTagsContent = new FlowPanel(); allTags.setContent(allTagsContent); generalPanel.add(allTags); generalPanel.setSpacing(4); vPanel.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER); vPanel.setSpacing(8); vPanel.addStyleName("gss-TabPanelBottom"); vPanel.add(new Label("Versioned")); vPanel.add(versionedCheck); verPanel.add(vPanel); outer.add(inner); outer.add(buttons); outer.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER); outer.addStyleName("gss-TabPanelBottom"); focusPanel.setFocus(true); setWidget(outer); }
From source file:org.gss_project.gss.web.client.FolderPropertiesDialog.java
License:Open Source License
/** * The widget's constructor.//from w ww .j a va 2s . c o m * * @param images the image icons from the file properties dialog * @param _create true if the dialog is displayed for creating a new * sub-folder of the selected folder, false if it is displayed * for modifying the selected folder */ public FolderPropertiesDialog(Images images, boolean _create, final List<GroupResource> _groups, String _userFullname) { setAnimationEnabled(true); // Enable IE selection for the dialog (must disable it upon closing it) GSS.enableIESelection(); create = _create; folder = ((RestResourceWrapper) GSS.get().getTreeView().getSelection()).getResource(); permList = new PermissionsList(images, folder.getPermissions(), folder.getOwner()); groups = _groups; // Use this opportunity to set the dialog's caption. if (create) setText("Create folder"); else setText("Folder properties"); // Outer contains inner and buttons VerticalPanel outer = new VerticalPanel(); // Inner contains generalPanel and permPanel inner = new DecoratedTabPanel(); inner.setAnimationEnabled(true); VerticalPanel generalPanel = new VerticalPanel(); VerticalPanel permPanel = new VerticalPanel(); final HorizontalPanel permForAll = new HorizontalPanel(); final HorizontalPanel pathPanel = new HorizontalPanel(); HorizontalPanel buttons = new HorizontalPanel(); HorizontalPanel permButtons = new HorizontalPanel(); inner.add(generalPanel, "General"); if (!create) inner.add(permPanel, "Sharing"); inner.selectTab(0); final Label folderNameNote = new Label("Please note that slashes ('/') are not allowed in folder names.", true); folderNameNote.setVisible(false); folderNameNote.setStylePrimaryName("gss-readForAllNote"); FlexTable generalTable = new FlexTable(); generalTable.setText(0, 0, "Name"); generalTable.setText(1, 0, "Parent"); generalTable.setText(2, 0, "Creator"); generalTable.setText(3, 0, "Last modified"); folderName.setText(create ? "" : folder.getName()); folderName.getElement().setId("folderPropertiesDialog.textBox.name"); generalTable.setWidget(0, 1, folderName); folderName.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { if (folderName.getText().contains("/")) folderNameNote.setVisible(true); else folderNameNote.setVisible(false); } }); if (create) generalTable.setText(1, 1, folder.getName()); else if (folder.getParentName() == null) generalTable.setText(1, 1, "-"); else generalTable.setText(1, 1, folder.getParentName()); generalTable.setWidget(0, 2, folderNameNote); generalTable.setText(2, 1, folder.getOwner()); DateTimeFormat formatter = DateTimeFormat.getFormat("d/M/yyyy h:mm a"); if (folder.getModificationDate() != null) generalTable.setText(3, 1, formatter.format(folder.getModificationDate())); generalTable.getFlexCellFormatter().setStyleName(0, 0, "props-labels"); generalTable.getFlexCellFormatter().setStyleName(1, 0, "props-labels"); generalTable.getFlexCellFormatter().setStyleName(2, 0, "props-labels"); generalTable.getFlexCellFormatter().setStyleName(3, 0, "props-labels"); generalTable.getFlexCellFormatter().setStyleName(0, 1, "props-values"); generalTable.getFlexCellFormatter().setStyleName(1, 1, "props-values"); generalTable.getFlexCellFormatter().setStyleName(2, 1, "props-values"); generalTable.getFlexCellFormatter().setStyleName(3, 1, "props-values"); generalTable.setCellSpacing(4); // Create the 'Create/Update' button, along with a listener that hides the dialog // when the button is clicked and quits the application. String okLabel; if (create) okLabel = "Create"; else okLabel = "Update"; Button ok = new Button(okLabel, new ClickHandler() { @Override public void onClick(ClickEvent event) { if (folderName.getText().contains("/")) folderNameNote.setVisible(true); else { folderNameNote.setVisible(false); createOrUpdateFolder(); closeDialog(); } } }); ok.getElement().setId("folderPropertiesDialog.button.ok"); buttons.add(ok); buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER); // Create the 'Cancel' button, along with a listener that hides the // dialog // when the button is clicked. Button cancel = new Button("Cancel", new ClickHandler() { @Override public void onClick(ClickEvent event) { closeDialog(); } }); cancel.getElement().setId("folderPropertiesDialog.button.cancel"); buttons.add(cancel); buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER); buttons.setSpacing(8); buttons.addStyleName("gss-TabPanelBottom"); Button add = new Button("Add Group", new ClickHandler() { @Override public void onClick(ClickEvent event) { PermissionsAddDialog dlg = new PermissionsAddDialog(groups, permList, false); dlg.center(); } }); add.getElement().setId("folderPropertiesDialog.button.addGroup"); permButtons.add(add); permButtons.setCellHorizontalAlignment(add, HasHorizontalAlignment.ALIGN_CENTER); Button addUser = new Button("Add User", new ClickHandler() { @Override public void onClick(ClickEvent event) { PermissionsAddDialog dlg = new PermissionsAddDialog(groups, permList, true); dlg.center(); } }); addUser.getElement().setId("folderPropertiesDialog.button.addUser"); permButtons.add(addUser); permButtons.setCellHorizontalAlignment(addUser, HasHorizontalAlignment.ALIGN_CENTER); permButtons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER); permButtons.setSpacing(8); permButtons.addStyleName("gss-TabPanelBottom"); final Label readForAllNote = new Label("When this option is enabled, the folder will be readable" + " by everyone. By checking this option, you are certifying that you have the right to " + "distribute this folder's contents and that it does not violate the Terms of Use.", true); readForAllNote.setVisible(false); readForAllNote.setStylePrimaryName("gss-readForAllNote"); readForAll = new CheckBox(); readForAll.getElement().setId("folderPropertiesDialog.checkBox.public"); readForAll.setValue(folder.isReadForAll()); readForAll.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { readForAllNote.setVisible(readForAll.getValue()); } }); generalPanel.add(generalTable); permPanel.add(permList); permPanel.add(permButtons); // Only show the read for all permission if the user is the owner. if (folder.getOwner().equals(GSS.get().getCurrentUserResource().getUsername())) { permForAll.add(new Label("Public")); permForAll.add(readForAll); permForAll.setSpacing(8); permForAll.addStyleName("gss-TabPanelBottom"); permForAll.add(readForAllNote); permPanel.add(permForAll); } TextBox path = new TextBox(); path.getElement().setId("folderPropertiesDialog.textBox.link"); path.setWidth("100%"); path.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { GSS.enableIESelection(); ((TextBox) event.getSource()).selectAll(); GSS.preventIESelection(); } }); path.setText(folder.getUri()); path.setTitle( "Use this link for sharing the folder via e-mail, IM, etc. (crtl-C/cmd-C to copy to system clipboard)"); path.setWidth("100%"); path.setReadOnly(true); pathPanel.setWidth("100%"); pathPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); pathPanel.add(new Label("Link")); pathPanel.setSpacing(8); pathPanel.addStyleName("gss-TabPanelBottom"); pathPanel.add(path); permPanel.add(pathPanel); outer.add(inner); outer.add(buttons); outer.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER); outer.addStyleName("gss-TabPanelBottom"); setWidget(outer); /*if (create) folderName.setFocus(true); else ok.setFocus(true);*/ }
From source file:org.gss_project.gss.web.client.PermissionsAddDialog.java
License:Open Source License
public PermissionsAddDialog(List<GroupResource> _groups, PermissionsList _permList, boolean _userAdd) { groups = _groups;/*from www .ja v a 2 s.co m*/ userAdd = _userAdd; permList = _permList; groupBox.getElement().setId("addPermission.dropDown"); suggestBox.getElement().setId("addPermission.textBox"); read.getElement().setId("addPermission.read"); write.getElement().setId("addPermission.write"); modifyACL.getElement().setId("addpermission.modify"); for (GroupResource group : _groups) groupBox.addItem(group.getName(), group.getName()); final VerticalPanel panel = new VerticalPanel(); final HorizontalPanel buttons = new HorizontalPanel(); setWidget(panel); final FlexTable permTable = new FlexTable(); permTable.setText(0, 0, "Users/Groups"); permTable.setText(0, 1, "Read"); permTable.setText(0, 2, "Write"); permTable.setText(0, 3, "Modify Access"); permTable.getFlexCellFormatter().setStyleName(0, 0, "props-toplabels"); permTable.getFlexCellFormatter().setStyleName(0, 1, "props-toplabels"); permTable.getFlexCellFormatter().setStyleName(0, 2, "props-toplabels"); permTable.getFlexCellFormatter().setStyleName(0, 3, "props-toplabels"); if (userAdd) { suggestBox.getTextBox().addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { if (selectedUser != null && selectedUser.endsWith("@")) updateSuggestions(); } }); suggestBox.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { // Ignore the arrow keys. int keyCode = event.getNativeKeyCode(); if (keyCode == KeyCodes.KEY_UP || keyCode == KeyCodes.KEY_DOWN || keyCode == KeyCodes.KEY_LEFT || keyCode == KeyCodes.KEY_RIGHT) return; if (keyCode == KeyCodes.KEY_ESCAPE) { suggestBox.hideSuggestionList(); return; } String text = suggestBox.getText().trim(); // Avoid useless queries for keystrokes that do not modify // the text. if (text.equals(selectedUser)) return; selectedUser = text; // Go to the server only if the user typed the @ character. if (selectedUser.endsWith("@")) updateSuggestions(); } }); permTable.setWidget(1, 0, suggestBox); } else permTable.setWidget(1, 0, groupBox); permTable.setWidget(1, 1, read); permTable.setWidget(1, 2, write); permTable.setWidget(1, 3, modifyACL); permTable.getFlexCellFormatter().setStyleName(1, 0, "props-labels"); permTable.getFlexCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_CENTER); permTable.getFlexCellFormatter().setHorizontalAlignment(1, 2, HasHorizontalAlignment.ALIGN_CENTER); permTable.getFlexCellFormatter().setHorizontalAlignment(1, 3, HasHorizontalAlignment.ALIGN_CENTER); panel.add(permTable); final Button ok = new Button("OK", new ClickHandler() { @Override public void onClick(ClickEvent event) { addPermission(); hide(); } }); ok.getElement().setId("addPermission.button.ok"); buttons.add(ok); buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER); // Create the 'Cancel' button, along with a listener that hides the // dialog // when the button is clicked. final Button cancel = new Button("Cancel", new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); } }); cancel.getElement().setId("addPermission.button.cancel"); buttons.add(cancel); buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER); buttons.setSpacing(8); buttons.addStyleName("gss-TabPanelBottom"); panel.add(buttons); panel.addStyleName("gss-TabPanelBottom"); }
From source file:org.gwm.samples.gwmdemo.client.MultiDesktopsScenarii.java
License:Apache License
public void runScenarii() { GFrame window = new DefaultGFrame(""); window.setWidth(1200);//from ww w . j ava2 s.com window.setHeight(600); GDesktopPane desk1 = new DefaultGDesktopPane(); desk1.setTheme("default"); GDesktopPane desk2 = new DefaultGDesktopPane(); desk2.setTheme("sky"); GInternalFrame f1desk1 = new DefaultGInternalFrame("Google"); f1desk1.setUrl("http://www.google.com"); desk1.addFrame(f1desk1); f1desk1.setVisible(true); f1desk1.setSize(500, 400); GInternalFrame f2desk1 = new DefaultGInternalFrame("GWT Official Web Site"); f2desk1.setUrl("http://code.google.com/webtoolkit/"); desk1.addFrame(f2desk1); f2desk1.setVisible(true); f2desk1.setSize(500, 400); GInternalFrame f1desk2 = new DefaultGInternalFrame("Yahoo"); f1desk2.setUrl("http://www.yahoo.com"); desk2.addFrame(f1desk2); f1desk2.setVisible(true); f1desk2.setSize(500, 400); GInternalFrame f2desk2 = new DefaultGInternalFrame("MSN"); f2desk2.setUrl("http://www.gwtwindowmanager.org"); desk2.addFrame(f2desk2); f2desk2.setVisible(true); f2desk2.setSize(500, 400); FlexTable desktopsContainer = new FlexTable(); desktopsContainer.setBorderWidth(1); desktopsContainer.setSize("100%", "100%"); Button goBackBtn = new Button("Go Back to the demo menu"); goBackBtn.addClickListener(new ClickListener() { public void onClick(Widget source) { GwmDemo.reset(); } }); Button resetScenarii = new Button("Reload Sample"); resetScenarii.addClickListener(new ClickListener() { public void onClick(Widget source) { runScenarii(); } }); desktopsContainer.setWidget(0, 0, goBackBtn); desktopsContainer.setWidget(0, 1, resetScenarii); desktopsContainer.setWidget(1, 0, (Widget) desk1); desktopsContainer.setWidget(1, 1, (Widget) desk2); desktopsContainer.getFlexCellFormatter().setHeight(1, 0, "100%"); desktopsContainer.getFlexCellFormatter().setWidth(1, 0, "50%"); desktopsContainer.getFlexCellFormatter().setWidth(1, 1, "50%"); window.setContent(desktopsContainer); window.setOutlineDragMode(true); window.setVisible(true); RootPanel.get().clear(); RootPanel.get().add(desktopsContainer); }
From source file:org.iplantc.de.pipelineBuilder.client.builder.PipelineWorkspace.java
License:Apache License
public PipelineWorkspace(Pipeline pipeline) { FlowPanel pane = new FlowPanel(); initWidget(pane);/* ww w . j ava 2 s .c om*/ this.pipeline = pipeline; workspace = new Workspace(pipeline); // workspace.add(new ForBlock()); pane.add(workspace); pane.add(trashImg); VerticalPanel infoPane = new VerticalPanel(); FlexTable table = new FlexTable(); table.setWidget(0, 0, new SimpleLabel("Name:")); nameBox = new TextBox(); nameBox.setText(pipeline.getName()); table.setWidget(0, 1, nameBox); table.setWidget(1, 0, new SimpleLabel("Description:")); descBox = new TextBox(); descBox.setText(pipeline.getDescription()); loadNonBlocks(); table.setWidget(2, 0, descBox); table.getFlexCellFormatter().setColSpan(1, 0, 2); table.getFlexCellFormatter().setColSpan(2, 0, 2); infoPane.setWidth("100%"); table.setWidth("100%"); infoPane.add(table); workspace.setStyleName("pipe-workspace"); workspace.setHeight("100%"); trashImg.setStyleName("trash"); DragCreator.addDrop(trashImg.getElement(), new TrashCan(), new DropListener() { @Override public void drop(IPCType record) { trashImg.setUrl(IplantResources.RESOURCES.trashClose().getSafeUri().asString()); DragCreator.getDragSource().setDragAction(DragCreator.DELETE); } @Override public boolean dragOver(IPCType record) { trashImg.setUrl(IplantResources.RESOURCES.trashOpen().getSafeUri().asString()); return true; } @Override public void dragLeave(IPCType record) { trashImg.setUrl(IplantResources.RESOURCES.trashClose().getSafeUri().asString()); } @Override public boolean dragEnter(IPCType record) { trashImg.setUrl(IplantResources.RESOURCES.trashOpen().getSafeUri().asString()); return true; } }); }
From source file:org.jax.pubarray.gwtqueryapp.client.QueryFilterTable.java
License:Open Source License
/** * {@inheritDoc}// www . j a va2 s . c o m */ @Override protected void onRender(Element parent, int index) { super.onRender(parent, index); final FlexTable addFiltersTable = new FlexTable(); this.appendFilterButton.setText("Add Search Filter"); this.appendFilterButton.addSelectionListener(new SelectionListener<ButtonEvent>() { /** * {@inheritDoc} */ @Override public void componentSelected(ButtonEvent e) { QueryFilterTable.this.appendComparisonRow(); } }); this.appendFilterButton.setIconAlign(IconAlign.LEFT); this.appendFilterButton.setIcon(IconHelper.createPath("images/add-16x16.png", 16, 16)); addFiltersTable.setText(0, 0, "Search Filters:"); addFiltersTable.setWidget(0, 1, this.appendFilterButton); this.add(addFiltersTable); this.add(this.comparisonTable); this.orderByComboBox.setWidth(ATTRIBUTE_COMBO_WIDTH); this.orderByComboBox.setStore(this.attributeStore); this.orderByComboBox.setDisplayField(ATTRIBUTE_DISPLAY_PROPERTY); this.orderByComboBox.setTypeAhead(true); this.orderByComboBox.setForceSelection(false); this.orderByComboBox.setAllowBlank(true); this.orderByComboBox.setEmptyText("Any Order..."); this.orderByComboBox.setEditable(false); this.orderByComboBox.setTriggerAction(TriggerAction.ALL); ListStore<ModelData> orderByDirectionStore = new ListStore<ModelData>(); ModelData ascendingOrderModel = new BaseModel(); ascendingOrderModel.set(QueryModelUtil.ORDER_BY_DIRECTION_COLUMN_ID, SortDirection.ASCENDING); orderByDirectionStore.add(ascendingOrderModel); ModelData descendingOrderModel = new BaseModel(); descendingOrderModel.set(QueryModelUtil.ORDER_BY_DIRECTION_COLUMN_ID, SortDirection.DESCENDING); orderByDirectionStore.add(descendingOrderModel); this.orderByDirectionComboBox.setStore(orderByDirectionStore); this.orderByDirectionComboBox.setDisplayField(QueryModelUtil.ORDER_BY_DIRECTION_COLUMN_ID); this.orderByDirectionComboBox.setTypeAhead(false); this.orderByDirectionComboBox.setForceSelection(true); this.orderByDirectionComboBox.setAllowBlank(false); this.orderByDirectionComboBox.setSelection(Collections.singletonList(ascendingOrderModel)); this.orderByDirectionComboBox.setEditable(false); this.orderByDirectionComboBox.setTriggerAction(TriggerAction.ALL); final FlexTable orderAndSearchTable = new FlexTable(); orderAndSearchTable.setText(0, 0, "Order Results By:"); orderAndSearchTable.setWidget(0, 1, this.orderByComboBox); orderAndSearchTable.setWidget(0, 2, this.orderByDirectionComboBox); this.runQueryButton.setText("Search"); this.runQueryButton.setIconAlign(IconAlign.LEFT); this.runQueryButton.setIcon(IconHelper.createPath("images/work-16x16.png", 16, 16)); orderAndSearchTable.setWidget(1, 0, this.runQueryButton); orderAndSearchTable.getFlexCellFormatter().setColSpan(1, 0, 2); this.add(orderAndSearchTable); this.runQueryButton.addSelectionListener(new SelectionListener<ButtonEvent>() { /** * {@inheritDoc} */ @Override public void componentSelected(ButtonEvent ce) { QueryFilterTable.this.runQueryClicked(); } }); // start the user out with a single empty row to give them a hint // how filtering is supposed to work this.appendComparisonRow(); }