@Inject public FormatterPreferencePageViewImpl( FormatterPreferencePageViewImplUiBinder uiBinder, JavaLocalizationConstant localizationConstant) { widget = uiBinder.createAndBindUi(this); fileUpload = new FileUpload(); radioButtonGroup = new RadioButtonGroup(); targetPanel.add(radioButtonGroup); radioButtonGroup.addButton( localizationConstant.formatterPreferencesProjectLabel(), localizationConstant.formatterPreferencesProjectDescription(), null, event -> isWorkspace = false); radioButtonGroup.addButton( localizationConstant.formatterPreferencesWorkspaceLabel(), localizationConstant.formatterPreferencesWorkspaceDescription(), null, event -> isWorkspace = true); radioButtonGroup.selectButton(0); uploadForm.add(fileUpload); importButton.setEnabled(false); }
/** Creates new mutually-exclusion group of buttons. */ public RadioButtonGroup() { GROUP_NAME = "buttons-group-" + UUID.uuid(); buttons = new ArrayList<>(); mainPanel = new FlowPanel(); mainPanel.setStyleName(resources.getCSS().mainPanel()); initWidget(mainPanel); }
public void showDialog() { radioButtonGroup.selectButton(0); uploadForm.remove(fileUpload); errorMessage.setText(""); importButton.setEnabled(false); fileContent = null; fileUpload = new FileUpload(); fileUpload.setHeight("22px"); fileUpload.setWidth("100%"); fileUpload.setName("file"); fileUpload.ensureDebugId("import-formatter-ChooseFile"); readFileContent(fileUpload.getElement()); fileUpload.addChangeHandler( event -> { if (delegate != null) { readFileContent(fileUpload.getElement()); importButton.setEnabled(fileUpload.getFilename() != null); } }); uploadForm.add(fileUpload); }