List of usage examples for com.google.gwt.dom.client InputElement setAttribute
@Override
public void setAttribute(String name, String value)
From source file:com.akjava.gwt.html5.client.input.ColorBox.java
License:Apache License
/** * Constructor for <code>color</code>. *//* w ww . j a va 2 s. c om*/ public ColorBox() { InputElement input = Document.get().createHiddenInputElement(); input.setAttribute("type", "color"); setElement(input); }
From source file:org.drools.workbench.screens.scenariosimulation.client.collectioneditor.PropertyPresenter.java
License:Apache License
@Override public LIElement getPropertyFields(String itemId, String propertyName, String propertyValue) { final PropertyView propertyEditorView = viewsProvider.getPropertyEditorView(); String hashedPropertyName = "#" + propertyName; final SpanElement propertyNameSpan = propertyEditorView.getPropertyName(); setSpanAttributeAttributes(propertyName, hashedPropertyName, "propertyName" + hashedPropertyName, propertyNameSpan);/* w ww . jav a 2 s. c o m*/ final SpanElement propertyValueSpan = propertyEditorView.getPropertyValueSpan(); setSpanAttributeAttributes(propertyName, propertyValue, "propertyValue" + hashedPropertyName, propertyValueSpan); propertySpanElementMap.put(propertyName, propertyValueSpan); final InputElement propertyValueInput = propertyEditorView.getPropertyValueInput(); propertyValueInput.setAttribute("placeholder", hashedPropertyName); propertyValueInput.setAttribute("data-field", "propertyValue" + hashedPropertyName); propertyValueInput.setDisabled(true); propertyValueInput.getStyle().setDisplay(Style.Display.NONE); final LIElement propertyFields = propertyEditorView.getPropertyFields(); propertyFields.setAttribute("data-field", "propertyFields" + hashedPropertyName); if (propertyViewMap.containsKey(itemId)) { propertyViewMap.get(itemId).add(propertyEditorView); } else { List<PropertyView> toPut = new ArrayList<>(); toPut.add(propertyEditorView); propertyViewMap.put(itemId, toPut); } return propertyFields; }
From source file:org.eclipse.che.ide.ui.listbox.CustomComboBox.java
License:Open Source License
/** * Inserts an item into the list box.//from w ww. j ava2 s . c o m * * @param item * the text of the item to be inserted. * @param value * the item's value. */ public void insertItem(String item, String value) { //create new widget final RadioButton radioButton = new RadioButton(optionsGroupName, item); //remove the default gwt-RadioButton style radioButton.removeStyleName("gwt-RadioButton"); //set value final InputElement inputElement = (InputElement) radioButton.getElement().getElementsByTagName("input") .getItem(0); inputElement.removeAttribute("tabindex"); inputElement.setAttribute("value", value); //set default state if (defaultSelectedIndex > -1 && optionsPanel.getElement().getChildCount() == defaultSelectedIndex) { inputElement.setChecked(true); currentInputElement.setValue(""); } //add to widget optionsPanel.add(radioButton); }
From source file:org.eclipse.che.ide.ui.listbox.CustomListBox.java
License:Open Source License
/** * Inserts an item into the list box.//from www . ja v a 2 s . c o m * * @param item * the text of the item to be inserted. * @param value * the item's value. */ public void insertItem(String item, String value) { //create new widget final RadioButton radioButton = new RadioButton(optionsGroupName, item); //remove the default gwt-RadioButton style radioButton.removeStyleName("gwt-RadioButton"); //set value final InputElement inputElement = (InputElement) radioButton.getElement().getElementsByTagName("input") .getItem(0); inputElement.removeAttribute("tabindex"); inputElement.setAttribute("value", value); //set default state if (defaultSelectedIndex > -1 && optionsPanel.getElement().getChildCount() == defaultSelectedIndex) { inputElement.setChecked(true); currentItemLabel.setInnerText(item); } //add to widget optionsPanel.add(radioButton); }
From source file:org.gwtbootstrap3.extras.tagsinput.client.ui.base.SingleValueTagsInput.java
License:Apache License
public SingleValueTagsInput(final Collection<? extends Dataset<T>> datasets) { InputElement tagsInput = Document.get().createTextInputElement(); tagsInput.setAttribute("data-role", "tagsinput"); setElement(tagsInput);/* ww w . jav a2 s . co m*/ setDatasets(datasets); }
From source file:org.opencms.gwt.client.ui.input.upload.CmsFileInputFileApiImpl.java
License:Open Source License
/** * @see org.opencms.gwt.client.ui.input.upload.I_CmsFileInputService#setAllowMultipleFiles(com.google.gwt.dom.client.InputElement, boolean) *//*ww w . j a va2 s .c o m*/ public void setAllowMultipleFiles(InputElement inputElement, boolean allow) { if (allow) { inputElement.setAttribute("multiple", ""); } else { inputElement.removeAttribute("multiple"); } }
From source file:org.sigmah.client.page.orgunit.reports.OrgUnitReportsView.java
License:Open Source License
public void setReport(final ProjectReportDTO report) { mainPanel.removeAll();// w w w .j a va 2s . com // currentReport = report; if (autoSaveTimer != null) { autoSaveTimer.cancel(); autoSaveTimer = null; } if (report == null) return; // Preparing the view for the new report textAreas.clear(); oldContents.clear(); keyQuestionState.clear(); // Title bar final ContentPanel reportPanel = new ContentPanel(new FitLayout()); reportPanel.setScrollMode(Scroll.AUTOY); reportPanel.setHeading(report.getName()); final ToolButton closeButton = new ToolButton("x-tool-close"); closeButton.addListener(Events.Select, new Listener<BaseEvent>() { @Override public void handleEvent(BaseEvent be) { final OrgUnitState state = new OrgUnitState(currentState.getOrgUnitId()); state.setCurrentSection(currentState.getCurrentSection()); state.setArgument("-1"); eventBus.fireEvent(new NavigationEvent(NavigationHandler.NavigationRequested, state, null)); } }); reportPanel.getHeader().addTool(closeButton); // Report container final FlowPanel flowPanel = new FlowPanel(); // Report final FoldPanel root = new FoldPanel(); root.addStyleName("project-report"); final List<ProjectReportSectionDTO> sections = report.getSections(); final StringBuilder prefix = new StringBuilder(); for (int index = 0; index < sections.size(); index++) { final ProjectReportSectionDTO section = sections.get(index); prefix.append(index + 1).append('.'); displaySection(section, root, prefix, 1, report.isDraft()); prefix.setLength(0); } // Toolbar final ToolBar toolBar = new ToolBar(); final IconImageBundle icons = GWT.create(IconImageBundle.class); if (report.isDraft()) { // Draft banner final HorizontalPanel header = new HorizontalPanel(); header.addStyleName("project-report-draft"); // The "Personal Draft" final Label personalDraft = new Label(I18N.MESSAGES.personalDraft()); personalDraft.addStyleName("project-report-personalDraft"); final DateTimeFormat dateFormat = DateTimeFormat.getMediumDateFormat(); final DateTimeFormat timeFormat = DateTimeFormat.getMediumTimeFormat(); // The label showing the last changed time final Label draftLastChangedTime = new Label(I18N.MESSAGES.reportDraftLastChanged( dateFormat.format(report.getLastEditDate()), timeFormat.format(report.getLastEditDate()))); // Add the two labels header.add(personalDraft); header.add(draftLastChangedTime); final Button cancelButton = new Button(I18N.CONSTANTS.delete()); final Button sendButton = new Button(I18N.CONSTANTS.sendReportDraft()); cancelButton.addSelectionListener(new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { final RemoveProjectReportDraft removeDraft = new RemoveProjectReportDraft( report.getVersionId()); final GetProjectReport getReport = new GetProjectReport(report.getId()); final AsyncCallback<VoidResult> callback = AsyncCallbacks.emptyCallback(); dispatcher.execute(removeDraft, null, callback); dispatcher.execute(getReport, null, new AsyncCallback<ProjectReportDTO>() { @Override public void onFailure(Throwable caught) { MessageBox.alert(I18N.CONSTANTS.projectTabReports(), I18N.CONSTANTS.reportEditError(), null); } @Override public void onSuccess(ProjectReportDTO result) { Notification.show(I18N.CONSTANTS.projectTabReports(), I18N.CONSTANTS.reportEditCancelSuccess()); setReport(result); } }); } }); sendButton.addSelectionListener(new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { final HashMap<String, Object> changes = new HashMap<String, Object>(); changes.put("currentPhase", phaseName); for (final Map.Entry<Integer, RichTextArea> entry : textAreas.entrySet()) changes.put(entry.getKey().toString(), entry.getValue().getHTML()); final UpdateEntity updateEntity = new UpdateEntity("ProjectReport", report.getVersionId(), changes); final PromoteProjectReportDraft promoteDraft = new PromoteProjectReportDraft(report.getId(), report.getVersionId()); final AsyncCallback<VoidResult> callback = AsyncCallbacks.emptyCallback(); dispatcher.execute(updateEntity, null, callback); dispatcher.execute(promoteDraft, null, new AsyncCallback<ProjectReportDTO>() { @Override public void onFailure(Throwable caught) { MessageBox.alert(I18N.CONSTANTS.projectTabReports(), I18N.CONSTANTS.reportSaveError(), null); } @Override public void onSuccess(ProjectReportDTO result) { Notification.show(I18N.CONSTANTS.projectTabReports(), I18N.CONSTANTS.reportSaveSuccess()); setReport(result); } }); } }); final HorizontalPanel buttons = new HorizontalPanel(); buttons.setSpacing(5); buttons.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); buttons.addStyleName("project-report-draft-button"); buttons.add(cancelButton); buttons.add(sendButton); header.add(buttons); header.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_RIGHT); flowPanel.add(header); // Save action final Listener<BaseEvent> saveListener = new Listener<BaseEvent>() { @Override public void handleEvent(BaseEvent be) { final HashMap<String, String> changes = new HashMap<String, String>(); changes.put("currentPhase", phaseName); for (final Map.Entry<Integer, RichTextArea> entry : textAreas.entrySet()) changes.put(entry.getKey().toString(), entry.getValue().getHTML()); final UpdateEntity updateEntity = new UpdateEntity("ProjectReport", report.getVersionId(), (Map<String, Object>) (Map<String, ?>) changes); dispatcher.execute(updateEntity, null, new AsyncCallback<VoidResult>() { @Override public void onFailure(Throwable caught) { MessageBox.alert(I18N.CONSTANTS.projectTabReports(), I18N.CONSTANTS.reportSaveError(), null); } @Override public void onSuccess(VoidResult result) { Notification.show(I18N.CONSTANTS.projectTabReports(), I18N.CONSTANTS.reportSaveSuccess()); final Date now = new Date(); header.clear(); draftLastChangedTime.setText(I18N.MESSAGES .reportDraftLastChanged(dateFormat.format(now), timeFormat.format(now))); personalDraft.setText(I18N.MESSAGES.personalDraft()); header.add(personalDraft); header.add(draftLastChangedTime); header.add(buttons); boolean found = false; for (int index = 0; !found && index < store.getCount(); index++) { final ReportReference reference = store.getAt(index); if (reference.getId().equals(report.getId())) { store.remove(reference); reference.setEditorName(authentication.getUserShortName()); reference.setPhaseName(phaseName); reference.setLastEditDate(new Date()); store.add(reference); found = true; } } updateChanges(); autoSaveTimer.cancel(); autoSaveTimer.schedule(AUTO_SAVE_PERIOD); } }); } }; // Save button final Button saveButton = new Button(I18N.CONSTANTS.save(), icons.save()); saveButton.addListener(Events.Select, saveListener); toolBar.add(saveButton); toolBar.add(new SeparatorToolItem()); // Auto save timer autoSaveTimer = new Timer() { @Override public void run() { saveListener.handleEvent(null); } }; autoSaveTimer.schedule(AUTO_SAVE_PERIOD); } else { final Button editReportButton = new Button(I18N.CONSTANTS.edit(), icons.editPage()); if (ProfileUtils.isGranted(authentication, GlobalPermissionEnum.MANAGE_UNIT)) { toolBar.add(editReportButton); } editReportButton.addSelectionListener(new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { // Draft creation final HashMap<String, Object> properties = new HashMap<String, Object>(); properties.put("reportId", report.getId()); properties.put("phaseName", phaseName); final CreateEntity createDraft = new CreateEntity("ProjectReportDraft", properties); // Retrieving the new draft final GetProjectReport getReportDraft = new GetProjectReport(report.getId()); final AsyncCallback<CreateResult> callback = AsyncCallbacks.emptyCallback(); dispatcher.execute(createDraft, null, callback); dispatcher.execute(getReportDraft, null, new AsyncCallback<ProjectReportDTO>() { @Override public void onFailure(Throwable caught) { MessageBox.alert(I18N.CONSTANTS.projectTabReports(), I18N.CONSTANTS.reportEditError(), null); } @Override public void onSuccess(ProjectReportDTO result) { setReport(result); } }); } }); final Button exportReportButton = new Button(I18N.CONSTANTS.exportToWord(), icons.msword()); toolBar.add(exportReportButton); exportReportButton.addSelectionListener(new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { final FormElement form = FormElement.as(DOM.createForm()); form.setAction(GWT.getModuleBaseURL() + "export"); form.setTarget("_downloadFrame"); form.setMethod("POST"); final InputElement typeField = InputElement.as(DOM.createInputText()); typeField.setAttribute("type", "hidden"); typeField.setName(ExportUtils.PARAM_EXPORT_TYPE); typeField.setValue(ExportUtils.ExportType.PROJECT_REPORT.toString()); form.appendChild(typeField); final InputElement formatField = InputElement.as(DOM.createInputText()); formatField.setAttribute("type", "hidden"); formatField.setName(ExportUtils.PARAM_EXPORT_FORMAT); formatField.setValue(ExportUtils.ExportFormat.MS_WORD.name()); form.appendChild(formatField); final InputElement idField = InputElement.as(DOM.createInputText()); idField.setAttribute("type", "hidden"); idField.setName(ExportUtils.PARAM_EXPORT_PROJECT_ID); idField.setAttribute("value", report.getId().toString()); form.appendChild(idField); RootPanel.getBodyElement().appendChild(form); form.submit(); form.removeFromParent(); } }); toolBar.add(new SeparatorToolItem()); } // Key question info final Label keyQuestionLabel = keyQuestionState.getLabel(); toolBar.add(keyQuestionLabel); toolBar.add(new SeparatorToolItem()); // Overview mode final Button foldButton = new Button(I18N.CONSTANTS.reportOverviewMode()); foldButton.addListener(Events.Select, new Listener<BaseEvent>() { @Override public void handleEvent(BaseEvent be) { root.expand(true); root.fold(true); } }); // Expanded mode final Button expandButton = new Button(I18N.CONSTANTS.reportFullMode()); expandButton.addListener(Events.Select, new Listener<BaseEvent>() { @Override public void handleEvent(BaseEvent be) { root.expand(true); } }); toolBar.add(foldButton); toolBar.add(expandButton); if (report.isDraft()) { toolBar.add(new SeparatorToolItem()); createRichTextToolbar(toolBar); } flowPanel.add(root); reportPanel.add(flowPanel); reportPanel.setTopComponent(toolBar); // Display mainPanel.add(reportPanel, new BorderLayoutData(LayoutRegion.CENTER)); mainPanel.layout(); mainPanel.unmask(); }
From source file:org.sigmah.client.page.project.reports.ProjectReportsView.java
License:Open Source License
public void setReport(final ProjectReportDTO report) { mainPanel.removeAll();//from w w w . j ava 2 s. c om // currentReport = report; if (autoSaveTimer != null) { autoSaveTimer.cancel(); autoSaveTimer = null; } if (report == null) { currentReportId = -1; return; } currentReportId = report.getId(); // Preparing the view for the new report textAreas.clear(); oldContents.clear(); keyQuestionState.clear(); // Title bar final ContentPanel reportPanel = new ContentPanel(new FitLayout()); reportPanel.setScrollMode(Scroll.AUTOY); reportPanel.setHeading(report.getName()); final ToolButton closeButton = new ToolButton("x-tool-close"); closeButton.addListener(Events.Select, new Listener<BaseEvent>() { @Override public void handleEvent(BaseEvent be) { final ProjectState state = new ProjectState(currentState.getProjectId()); state.setCurrentSection(currentState.getCurrentSection()); state.setArgument("-1"); eventBus.fireEvent(new NavigationEvent(NavigationHandler.NavigationRequested, state, null)); } }); reportPanel.getHeader().addTool(closeButton); // Report container final FlowPanel flowPanel = new FlowPanel(); // Report final FoldPanel root = new FoldPanel(); root.addStyleName("project-report"); final List<ProjectReportSectionDTO> sections = report.getSections(); final StringBuilder prefix = new StringBuilder(); for (int index = 0; index < sections.size(); index++) { final ProjectReportSectionDTO section = sections.get(index); prefix.append(index + 1).append('.'); displaySection(section, root, prefix, 1, report.isDraft()); prefix.setLength(0); } // Toolbar final ToolBar toolBar = new ToolBar(); final IconImageBundle icons = GWT.create(IconImageBundle.class); if (report.isDraft()) { // Draft banner final HorizontalPanel header = new HorizontalPanel(); header.addStyleName("project-report-draft"); // The "Personal Draft" final Label personalDraft = new Label(I18N.MESSAGES.personalDraft()); personalDraft.addStyleName("project-report-personalDraft"); final DateTimeFormat dateFormat = DateTimeFormat.getMediumDateFormat(); final DateTimeFormat timeFormat = DateTimeFormat.getMediumTimeFormat(); // The label showing the last changed time final Label draftLastChangedTime = new Label(I18N.MESSAGES.reportDraftLastChanged( dateFormat.format(report.getLastEditDate()), timeFormat.format(report.getLastEditDate()))); // Add the two labels header.add(personalDraft); header.add(draftLastChangedTime); final Button cancelButton = new Button(I18N.CONSTANTS.delete()); final Button sendButton = new Button(I18N.CONSTANTS.sendReportDraft()); cancelButton.addSelectionListener(new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { final RemoveProjectReportDraft removeDraft = new RemoveProjectReportDraft( report.getVersionId()); final GetProjectReport getReport = new GetProjectReport(report.getId()); final AsyncCallback<VoidResult> callback = AsyncCallbacks.emptyCallback(); dispatcher.execute(removeDraft, null, callback); dispatcher.execute(getReport, null, new AsyncCallback<ProjectReportDTO>() { @Override public void onFailure(Throwable caught) { MessageBox.alert(I18N.CONSTANTS.projectTabReports(), I18N.CONSTANTS.reportEditError(), null); } @Override public void onSuccess(ProjectReportDTO result) { Notification.show(I18N.CONSTANTS.projectTabReports(), I18N.CONSTANTS.reportEditCancelSuccess()); setReport(result); } }); } }); sendButton.addSelectionListener(new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { final HashMap<String, Object> changes = new HashMap<String, Object>(); changes.put("currentPhase", phaseName); for (final Map.Entry<Integer, RichTextArea> entry : textAreas.entrySet()) changes.put(entry.getKey().toString(), entry.getValue().getHTML()); final UpdateEntity updateEntity = new UpdateEntity("ProjectReport", report.getVersionId(), changes); final PromoteProjectReportDraft promoteDraft = new PromoteProjectReportDraft(report.getId(), report.getVersionId()); final AsyncCallback<VoidResult> callback = AsyncCallbacks.emptyCallback(); dispatcher.execute(updateEntity, null, callback); dispatcher.execute(promoteDraft, null, new AsyncCallback<ProjectReportDTO>() { @Override public void onFailure(Throwable caught) { MessageBox.alert(I18N.CONSTANTS.projectTabReports(), I18N.CONSTANTS.reportSaveError(), null); } @Override public void onSuccess(ProjectReportDTO result) { Notification.show(I18N.CONSTANTS.projectTabReports(), I18N.CONSTANTS.reportSaveSuccess()); setReport(result); } }); } }); final HorizontalPanel buttons = new HorizontalPanel(); buttons.setSpacing(5); buttons.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); buttons.addStyleName("project-report-draft-button"); buttons.add(cancelButton); buttons.add(sendButton); header.add(buttons); header.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_RIGHT); flowPanel.add(header); // Save action final Listener<BaseEvent> saveListener = new Listener<BaseEvent>() { @Override public void handleEvent(BaseEvent be) { final HashMap<String, String> changes = new HashMap<String, String>(); changes.put("currentPhase", phaseName); for (final Map.Entry<Integer, RichTextArea> entry : textAreas.entrySet()) changes.put(entry.getKey().toString(), entry.getValue().getHTML()); final UpdateEntity updateEntity = new UpdateEntity("ProjectReport", report.getVersionId(), (Map<String, Object>) (Map<String, ?>) changes); dispatcher.execute(updateEntity, null, new AsyncCallback<VoidResult>() { @Override public void onFailure(Throwable caught) { MessageBox.alert(I18N.CONSTANTS.projectTabReports(), I18N.CONSTANTS.reportSaveError(), null); } @Override public void onSuccess(VoidResult result) { Notification.show(I18N.CONSTANTS.projectTabReports(), I18N.CONSTANTS.reportSaveSuccess()); final Date now = new Date(); header.clear(); draftLastChangedTime.setText(I18N.MESSAGES .reportDraftLastChanged(dateFormat.format(now), timeFormat.format(now))); personalDraft.setText(I18N.MESSAGES.personalDraft()); header.add(personalDraft); header.add(draftLastChangedTime); header.add(buttons); boolean found = false; for (int index = 0; !found && index < store.getCount(); index++) { final ReportReference reference = store.getAt(index); if (reference.getId().equals(report.getId())) { store.remove(reference); reference.setEditorName(authentication.getUserShortName()); reference.setPhaseName(phaseName); reference.setLastEditDate(new Date()); store.add(reference); found = true; } } updateChanges(); autoSaveTimer.cancel(); autoSaveTimer.schedule(AUTO_SAVE_PERIOD); } }); } }; // Save button final Button saveButton = new Button(I18N.CONSTANTS.save(), icons.save()); saveButton.addListener(Events.Select, saveListener); toolBar.add(saveButton); toolBar.add(new SeparatorToolItem()); // Auto save timer autoSaveTimer = new Timer() { @Override public void run() { saveListener.handleEvent(null); } }; autoSaveTimer.schedule(AUTO_SAVE_PERIOD); } else { final Button editReportButton = new Button(I18N.CONSTANTS.edit(), icons.editPage()); if (ProfileUtils.isGranted(authentication, GlobalPermissionEnum.EDIT_PROJECT)) { toolBar.add(editReportButton); } editReportButton.addSelectionListener(new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { // Draft creation final HashMap<String, Object> properties = new HashMap<String, Object>(); properties.put("reportId", report.getId()); properties.put("phaseName", phaseName); final CreateEntity createDraft = new CreateEntity("ProjectReportDraft", properties); // Retrieving the new draft final GetProjectReport getReportDraft = new GetProjectReport(report.getId()); final AsyncCallback<CreateResult> callback = AsyncCallbacks.emptyCallback(); dispatcher.execute(createDraft, null, callback); dispatcher.execute(getReportDraft, null, new AsyncCallback<ProjectReportDTO>() { @Override public void onFailure(Throwable caught) { MessageBox.alert(I18N.CONSTANTS.projectTabReports(), I18N.CONSTANTS.reportEditError(), null); } @Override public void onSuccess(ProjectReportDTO result) { setReport(result); } }); } }); final Button exportReportButton = new Button(I18N.CONSTANTS.exportToWord(), icons.msword()); toolBar.add(exportReportButton); exportReportButton.addSelectionListener(new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { final FormElement form = FormElement.as(DOM.createForm()); form.setAction(GWT.getModuleBaseURL() + "export"); form.setTarget("_downloadFrame"); form.setMethod("POST"); final InputElement typeField = InputElement.as(DOM.createInputText()); typeField.setAttribute("type", "hidden"); typeField.setName(ExportUtils.PARAM_EXPORT_TYPE); typeField.setValue(ExportUtils.ExportType.PROJECT_REPORT.toString()); form.appendChild(typeField); final InputElement formatField = InputElement.as(DOM.createInputText()); formatField.setAttribute("type", "hidden"); formatField.setName(ExportUtils.PARAM_EXPORT_FORMAT); formatField.setValue(ExportUtils.ExportFormat.MS_WORD.name()); form.appendChild(formatField); final InputElement idField = InputElement.as(DOM.createInputText()); idField.setAttribute("type", "hidden"); idField.setName(ExportUtils.PARAM_EXPORT_PROJECT_ID); idField.setAttribute("value", report.getId().toString()); form.appendChild(idField); RootPanel.getBodyElement().appendChild(form); form.submit(); form.removeFromParent(); } }); toolBar.add(new SeparatorToolItem()); } // Key question info final Label keyQuestionLabel = keyQuestionState.getLabel(); toolBar.add(keyQuestionLabel); toolBar.add(new SeparatorToolItem()); // Overview mode final Button foldButton = new Button(I18N.CONSTANTS.reportOverviewMode()); foldButton.addListener(Events.Select, new Listener<BaseEvent>() { @Override public void handleEvent(BaseEvent be) { root.expand(true); root.fold(true); } }); // Expanded mode final Button expandButton = new Button(I18N.CONSTANTS.reportFullMode()); expandButton.addListener(Events.Select, new Listener<BaseEvent>() { @Override public void handleEvent(BaseEvent be) { root.expand(true); } }); toolBar.add(foldButton); toolBar.add(expandButton); if (report.isDraft()) { toolBar.add(new SeparatorToolItem()); createRichTextToolbar(toolBar); } flowPanel.add(root); reportPanel.add(flowPanel); reportPanel.setTopComponent(toolBar); // Display mainPanel.add(reportPanel, new BorderLayoutData(LayoutRegion.CENTER)); mainPanel.layout(); mainPanel.unmask(); }
From source file:ru.fly.client.ui.field.PasswordField.java
License:Apache License
protected FElement getInputElement() { InputElement inp = super.getInputElement().cast(); inp.setAttribute("type", "password"); return inp.cast(); }