private String getKeyType() throws ViewNotFoundException { RadioButton rsaButton = findView(RadioButton.class, R.id.pk_type_rsa); if (rsaButton.isChecked()) { return "RSA"; } return "DSA"; }
@Override public void onCheckedChanged(RadioGroup group, int checkedId) { View v = group.findViewById(checkedId); if (!(v instanceof RadioButton)) { return; } RadioButton b = (RadioButton) v; String message = (String) b.getTag(); app.settings().setDefaultMessage(message); }
public static Tuple2<Label, RadioButton> addLabelRadioButton( GridPane gridPane, int rowIndex, ToggleGroup toggleGroup, String title, String radioButtonTitle) { Label label = addLabel(gridPane, rowIndex, title, 0); RadioButton radioButton = new RadioButton(radioButtonTitle); radioButton.setToggleGroup(toggleGroup); radioButton.setPadding(new Insets(6, 0, 0, 0)); GridPane.setRowIndex(radioButton, rowIndex); GridPane.setColumnIndex(radioButton, 1); gridPane.getChildren().add(radioButton); return new Tuple2<>(label, radioButton); }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Tell AQUtility about context: it can use this globally...which is really handy! AQUtility.setContext(getApplication()); // Load default preferences PreferenceManager.setDefaultValues(this, R.xml.preferences, false); findAllViewsById(); View.OnClickListener radioButtonListener = new View.OnClickListener() { public void onClick(View v) { RadioButton radioButton = (RadioButton) v; searchTypeTextView.setText("Searching for " + radioButton.getText()); } }; moviesSearchRadioButton.setOnClickListener(radioButtonListener); peopleSearchRadioButton.setOnClickListener(radioButtonListener); searchButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { String query = searchEditText.getText().toString(); if (moviesSearchRadioButton.isChecked()) { PerformFilmSearchTask task = new PerformFilmSearchTask(FilmSearchAppActivity.this); task.execute(query); } else if (peopleSearchRadioButton.isChecked()) { PerformPersonSearchTask task = new PerformPersonSearchTask(FilmSearchAppActivity.this); task.execute(query); } } }); int radioId = searchRadioGroup.getCheckedRadioButtonId(); RadioButton radioButton = (RadioButton) findViewById(radioId); searchTypeTextView.setText(radioButton.getText()); }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button button = (Button) findViewById(R.id.button); final EditText edittext = (EditText) findViewById(R.id.edittext); final CheckBox checkbox = (CheckBox) findViewById(R.id.checkbox); final RadioButton radio_red = (RadioButton) findViewById(R.id.radio_red); final RadioButton radio_blue = (RadioButton) findViewById(R.id.radio_blue); final ToggleButton togglebutton = (ToggleButton) findViewById(R.id.togglebutton); final RatingBar ratingbar = (RatingBar) findViewById(R.id.ratingbar); button.setOnClickListener(button_listener); edittext.setOnKeyListener(edittext_listener); checkbox.setOnClickListener(checkbox_listener); radio_red.setOnClickListener(radio_listener); radio_blue.setOnClickListener(radio_listener); togglebutton.setOnClickListener(togglebutton_listener); ratingbar.setOnRatingBarChangeListener(ratingbar_listener); }
public void initialize(URL location, ResourceBundle resources) { txtFieldGeldEingabe.textProperty().bindBidirectional(viewModel.geldEingabe()); txtFieldZeitEingabe.textProperty().bindBidirectional(viewModel.zeitEinagabe()); labelQualitaet.textProperty().bindBidirectional(viewModel.qualitaetText()); labelZeit.textProperty().bindBidirectional(viewModel.zeitText()); labelSkill.textProperty().bindBidirectional(viewModel.skillText()); labelGehalt.textProperty().bindBidirectional(viewModel.gehaltText()); labelGeld.textProperty().bindBidirectional(viewModel.geldText()); labelGesundheit.textProperty().bindBidirectional(viewModel.gesundheitText()); labelMotivation.textProperty().bindBidirectional(viewModel.motivationText()); SliderGehalt.valueProperty().bindBidirectional(viewModel.gehaltProperty()); SliderGehalt.setValue(1500); SliderGehalt.setShowTickMarks(false); SliderGehalt.setMajorTickUnit(1); SliderGehalt.setMinorTickCount(0); SliderGehalt.setBlockIncrement(100); SliderGehalt.setSnapToTicks(true); labelNeuesGehalt.textProperty().bind(SliderGehalt.valueProperty().asString("%.0f")); buttonStart.setOnAction( event -> { buttonNachsteRunde.setDisable(false); buttonStart.setDisable(true); txtFieldGeldEingabe.setDisable(true); txtFieldZeitEingabe.setDisable(true); viewModel.startRound(); }); buttonNachsteRunde.setOnAction( event -> { RadioButton rb = (RadioButton) ToggleGroupSelect.getSelectedToggle(); viewModel.nextRound(rb.getText()); }); viewModel.setButtonNaechsteRunde(buttonNachsteRunde); viewModel.setButtonStart(buttonStart); viewModel.setTxtFieldGeldEingabe(txtFieldGeldEingabe); viewModel.setTxtFieldZeitEingabe(txtFieldZeitEingabe); }
@FXML public void registrarArticulo(ActionEvent e) { Articulo art = new Articulo(); cruds = new CRUDArticulos(); boolean registrado; int indiceCategoria = cmbCategorias.getSelectionModel().getSelectedIndex() + 1; art.setNombre(tfNombreArticulo.getText()); art.setMarca(tfMarca.getText()); art.setDescripcion_estado(txaDescripcion.getText()); art.setEstado(true); RadioButton chk = (RadioButton) acceso.getSelectedToggle(); if (chk.getText().equals("Prestable")) art.setAcceso(true); else art.setAcceso(false); art.setIdcategoria(indiceCategoria); registrado = cruds.registrarArticulo(art); System.out.println(art.getIdcategoria() + "" + art.isAcceso()); if (registrado) JOptionPane.showMessageDialog(null, "algo salio mal menor"); else JOptionPane.showMessageDialog(null, "se ha registrado con exito menor"); }
public ConfigurationsDialogBuilder addConfigurations(List<Configuration> configurations) { dialog.setTitle("Choose a configuration to graph"); dialog.configurations = configurations; dialog.borderPanel.setCenter(dialog.scrollPane); ObservableList<Node> children = dialog.configurationsBox.getChildren(); ToggleGroup toggleGroup = new ToggleGroup(); for (Configuration configuration : configurations) { String name = configuration.getName(); RadioButton configurationRadioButton = new RadioButton(name); configurationRadioButton.setToggleGroup(toggleGroup); if (name.equals("compile")) { configurationRadioButton.setSelected(true); // todo select default from prefs } children.add(configurationRadioButton); } return this; }
/** * Initializes the RadioButton, permits to know if a file or a directory needs to be transformed */ private void initializeRadioButtons() { folderRadio.setToggleGroup(this.radioFileGroup); fileRadio.setToggleGroup(this.radioFileGroup); this.radioFileGroup .selectedToggleProperty() .addListener( new ChangeListener<Toggle>() { @Override public void changed( ObservableValue<? extends Toggle> observable, Toggle oldValue, Toggle newValue) { if (fileRadio.isSelected()) { selectFileButton.setText("Select your subtitle file !"); isFileToConvert = true; } else { selectFileButton.setText("Select your subtitles folder !"); isFileToConvert = false; } buttonRemoveSubs.setDisable(true); } }); fileRadio.setSelected(true); }
private Configuration getChosenConfiguration() { ObservableList<Node> children = dialog.configurationsBox.getChildren(); for (Node child : children) { if (child instanceof RadioButton) { RadioButton radioButton = (RadioButton) child; if (radioButton.isSelected()) { String text = radioButton.getText(); List<Configuration> configurations = dialog.configurations; for (Configuration configuration : configurations) { String name = configuration.getName(); if (name.equals(text)) { return configuration; } } } } } return null; }
public void updateUI() { radioGroup.removeAllViews(); radioGroup.setOnCheckedChangeListener(null); String[] messageOptions = app.settings().getMessageOptionsArray(); RadioButton buttonToCheck = new RadioButton(getContext()); for (int i = 0; i < messageOptions.length; i++) { RadioButton button = new RadioButton(getContext()); button.setText(messageOptions[i]); button.setTag(messageOptions[i]); button.setId(i); if (app.settings().getDefaultMessage().equals(messageOptions[i])) { buttonToCheck = button; } radioGroup.addView(button); } buttonToCheck.setChecked(true); radioGroup.setOnCheckedChangeListener(this); removeOptionButton.setEnabled(messageOptions.length != 1); }
public void hide() { for (RadioButton rb : this.btns) { rb.hide(); } }
/** {@inheritDoc} */ @Override public boolean isSoftMode() { return soft.getValue(); }
/** 初始化. */ private void inits() { context = this; view = View.inflate(this, R.layout.activity_main, null); // 初始化ActionBar的样式 initActionbarByFragment(View.GONE); // END. // 初始化底部的RadioButton. rbtnSee = (RadioButton) findViewById(R.id.rbtn_see); rbtnSimg = (RadioButton) findViewById(R.id.rbtn_simg); rbtnAbout = (RadioButton) findViewById(R.id.rbtn_about); rbtnSee.setOnCheckedChangeListener(this); rbtnSimg.setOnCheckedChangeListener(this); rbtnAbout.setOnCheckedChangeListener(this); // END. fragment_container = (FrameLayout) findViewById(R.id.fragment_container); // 底部弹出框. imagePopupWindow = new PopupWindowUtils( this, R.layout.simg_bottom_dialog, R.id.simg_bottom_pop_layout, new int[] { R.id.btn_simg_setdesktop, R.id.btn_simg_saveimg, R.id.btn_wxshare_friend, R.id.btn_wxshare_moments, R.id.btn_wxshare_collent, R.id.btn_yixinshare_timeline, R.id.btn_yixinshare_friend, R.id.btn_yixinshare_collect, R.id.btn_qqshare, R.id.btn_qzoneshare }, this); // 底部弹出框END. R.id.btn_sinaweiboshare,eSe if (dialog == null) { dialog = new CustomProgressDialog(this, "正在加载中"); } // 将应用注册到微信. // TODO 配置微信分享APPID /*wxapi = WXAPIFactory.createWXAPI(this, WxUtils.WXAPPID, true); wxapi.registerApp(WxUtils.WXAPPID); wxutils = WxUtils.getInstence(wxapi, context);*/ // END. // 易信. /* * TODO 配置易信APPID * yxapi = YXAPIFactory.createYXAPI(this, YxUtils.YX_APPID); yxapi.registerApp(); yxutils = YxUtils.getInstance(yxapi, context); */ // END. /*//新浪微博.TODO 配置新浪微博APPID sinaweiboapi = WeiboShareSDK.createWeiboAPI(this, SinaWeiboConstants.APP_KEY); sinaweiboapi.registerApp();*/ // END. // TODO 配置QQ APPID /*tencent = Tencent.createInstance("", this.getApplicationContext()); qqShareUtils = QQShareUtils.getInstance(this, tencent, MainActivity.this); UmengUpdateAgent.update(this);//友盟自动更新 UmengUpdateAgent.setUpdateCheckConfig(false);*/ initSee(); }
public void show() { for (RadioButton rb : this.btns) { rb.show(); } }
public void onClick(View v) { // Perform actions on clicks RadioButton rb = (RadioButton) v; Toast.makeText(HelloFormStuffActivity.this, rb.getText(), Toast.LENGTH_SHORT).show(); }
/** 初始化加载看看。 */ private void initSee() { // 初始化加载看看。 rbtnSee.setChecked(true); }
/** {@inheritDoc} */ @Override public void setHardMode(boolean isHard) { hard.setValue(isHard); }
public void iniciarAcceso() { radbtnPrestable.setToggleGroup(acceso); radbtnNoPrestable.setToggleGroup(acceso); }
/** {@inheritDoc} */ @Override public void setMixMode(boolean isMix) { mixed.setValue(isMix); }
/** {@inheritDoc} */ @Override public boolean isHardMode() { return hard.getValue(); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_user_crud, container, false); editTextUserName = (EditText) rootView.findViewById(R.id.editTextUserName); editTextEmail = (EditText) rootView.findViewById(R.id.editTextEmail); editTextLogin = (EditText) rootView.findViewById(R.id.editTextLogin); editTextPassword = (EditText) rootView.findViewById(R.id.editTextPassword); editTextConfirmPassword = (EditText) rootView.findViewById(R.id.editTextConfirmPassword); editTextZipCode = (EditText) rootView.findViewById(R.id.editTextZipCode); editTextAddress = (EditText) rootView.findViewById(R.id.editTextAddress); editTextNumberAddress = (EditText) rootView.findViewById(R.id.editTextNumberAddress); editTextComplement = (EditText) rootView.findViewById(R.id.editTextComplement); editTextNeighborhood = (EditText) rootView.findViewById(R.id.editTextNeighborhood); editTextCity = (EditText) rootView.findViewById(R.id.editTextCity); txtLatitude = (TextView) rootView.findViewById(R.id.txtLatitude); txtLongitude = (TextView) rootView.findViewById(R.id.txtLongitude); radioGroupGender = (RadioGroup) rootView.findViewById(R.id.radioGender); spinnerStates = (Spinner) rootView.findViewById(R.id.spinnerStates); btnSearchZipCode = (Button) rootView.findViewById(R.id.btnSearchZipCode); btnSaveUser = (Button) rootView.findViewById(R.id.btnSaveUser); ArrayAdapter arrayAdapterStates = new ArrayAdapter(getActivity(), R.layout.support_simple_spinner_dropdown_item, states); spinnerStates.setPrompt("Estados"); spinnerStates.setAdapter(arrayAdapterStates); spinnerStates.setOnItemSelectedListener( new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (position > 0) { String state = (String) spinnerStates.getItemAtPosition(position); spinnerStates.setSelection(states.indexOf(state)); } } @Override public void onNothingSelected(AdapterView<?> parent) { Toast.makeText( getActivity(), "É necessário selecionar uma Categoria", Toast.LENGTH_SHORT) .show(); } }); if (getActivity().getIntent().getSerializableExtra("user") != null) { UserBean userBeanLoad = (UserBean) getActivity().getIntent().getSerializableExtra("user"); editTextUserName.setText(userBeanLoad.getUserName()); editTextEmail.setText(userBeanLoad.getEmail()); editTextLogin.setText(userBeanLoad.getLogin()); editTextPassword.setVisibility(View.INVISIBLE); editTextConfirmPassword.setVisibility(View.INVISIBLE); editTextZipCode.setText(userBeanLoad.getZipCode()); editTextAddress.setText(userBeanLoad.getAddress()); editTextNumberAddress.setText(userBeanLoad.getNumberAddress()); editTextComplement.setText(userBeanLoad.getComplement()); editTextNeighborhood.setText(userBeanLoad.getNeighborhood()); editTextCity.setText(userBeanLoad.getCity()); if (userBeanLoad.getGender().equals(UserBean.Gender.MALE.getSex())) { radioButtonGender = (RadioButton) rootView.findViewById(R.id.radioMale); radioButtonGender.setChecked(true); } else { radioButtonGender = (RadioButton) rootView.findViewById(R.id.radioFemale); radioButtonGender.setChecked(true); } spinnerStates.setSelection(states.indexOf(userBeanLoad.getState())); getActivity() .getWindow() .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); btnSaveUser.setTag(userBeanLoad); } btnSaveUser.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { progressDialog = ProgressDialog.show(getActivity(), "Processando", "Salvando usuário..."); if (view.getTag() != null) { userBean = (UserBean) view.getTag(); } else { userBean = new UserBean(); } int selectedId = radioGroupGender.getCheckedRadioButtonId(); switch (selectedId) { case R.id.radioFemale: userBean.setGender(UserBean.Gender.FEMALE.getSex()); break; case R.id.radioMale: userBean.setGender(UserBean.Gender.MALE.getSex()); break; } userBean.setUserName(editTextUserName.getText().toString()); userBean.setEmail(editTextEmail.getText().toString()); userBean.setLogin(editTextLogin.getText().toString()); userBean.setPassword(editTextPassword.getText().toString()); userBean.setZipCode(editTextZipCode.getText().toString()); userBean.setAddress(editTextAddress.getText().toString()); userBean.setNumberAddress(editTextNumberAddress.getText().toString()); userBean.setComplement(editTextComplement.getText().toString()); userBean.setNeighborhood(editTextNeighborhood.getText().toString()); userBean.setCity(editTextCity.getText().toString()); userBean.setState(spinnerStates.getSelectedItem().toString()); AsyncTask<Void, Void, JSONObject> task = new AsyncTask<Void, Void, JSONObject>() { @Override protected JSONObject doInBackground(Void... voids) { Http http = new Http(); try { StringBuilder strAddress = new StringBuilder(); strAddress.append(editTextAddress.getText().toString()).append(" "); strAddress.append(editTextNumberAddress.getText().toString()).append(" "); strAddress.append(editTextCity.getText().toString()).append(" "); strAddress.append(spinnerStates.getSelectedItem().toString()); String result = http.doGet( PAGE_MAPS + URLEncoder.encode(strAddress.toString(), "UTF-8") + "&sensor=true"); JSONObject jsonObject = new JSONObject(result); if (jsonObject.getString("status").equals("OK")) { JSONArray jsonArrayResults = jsonObject.getJSONArray("results"); for (int i = 0; i < jsonArrayResults.length(); i++) { JSONObject jsonObjectResults = jsonArrayResults.getJSONObject(i); if (jsonObjectResults.get("geometry") != null) { JSONObject jsonObjectGeometry = jsonObjectResults.getJSONObject("geometry"); return (JSONObject) jsonObjectGeometry.get("location"); } } } } catch (IOException e1) { Log.e(AppHelper.getClassError(UserCrudActivity.class), e1.getMessage()); } catch (JSONException e2) { Log.e(AppHelper.getClassError(UserCrudActivity.class), e2.getMessage()); } return null; } @Override protected void onPostExecute(JSONObject jsonObject) { super.onPostExecute(jsonObject); boolean cepOK = true; if (jsonObject == null || jsonObject.isNull("lng")) { cepOK = false; Toast.makeText(getActivity(), "CEP inexistente.", Toast.LENGTH_SHORT) .show(); } else { try { userBean.setLatitude(jsonObject.get("lat").toString()); userBean.setLongitude(jsonObject.get("lng").toString()); boolean create = userBean.getId() == null ? true : false; UserDB userDB = new UserDB(getActivity()); userBean = userDB.salvar(userBean); if (userBean != null) { Intent it = new Intent(); it.putExtra( "msg", create ? "Usuário salvo com sucesso!" : "Usuário atualizado com sucesso!"); it.putExtra("user", userBean); getActivity().setResult(RESULT_OK, it); getActivity().finish(); } else { Intent it = new Intent(); it.putExtra( "msg", create ? "Falha ao cadastrar o Usuário!" : "Falha ao atualizar Usuário!"); getActivity().setResult(RESULT_CANCELED, it); getActivity().finish(); } } catch (JSONException e3) { Log.e(AppHelper.getClassError(UserCrudActivity.class), e3.getMessage()); } } if (cepOK) { UserDB userDB = new UserDB(getActivity()); userBean = userDB.salvar(userBean); if (userBean != null) { Intent it = new Intent(); it.putExtra( "msg", userBean.getId() == null ? "Usuário salvo com sucesso!" : "Usuário atualizado com sucesso!"); it.putExtra("user", userBean); getActivity().setResult(RESULT_OK, it); getActivity().finish(); } else { Intent it = new Intent(); it.putExtra( "msg", userBean.getId() == null ? "Falha ao cadastrar o Usuário!" : "Falha ao atualizar Usuário!"); getActivity().setResult(RESULT_CANCELED, it); getActivity().finish(); } } } }; if (validateFields(userBean)) { task.execute(); } progressDialog.dismiss(); } }); btnSearchZipCode.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { progressDialog = ProgressDialog.show(getActivity(), "Pesquisando", "Carregando..."); AsyncTask<Void, Void, JSONObject> task = new AsyncTask<Void, Void, JSONObject>() { @Override protected JSONObject doInBackground(Void... params) { Http http = new Http(); try { String result = http.doGet(PAGE_CORREIOS + editTextZipCode.getText().toString()); JSONObject jsonObject = new JSONObject(result); if (!jsonObject.has("message")) { return jsonObject; } } catch (IOException e1) { Log.e(AppHelper.getClassError(UserCrudActivity.class), e1.getMessage()); } catch (JSONException e2) { Log.e(AppHelper.getClassError(UserCrudActivity.class), e2.getMessage()); } return null; } @Override protected void onPostExecute(JSONObject jsonObject) { if (jsonObject == null) { Toast.makeText(getActivity(), "CEP inexistente.", Toast.LENGTH_SHORT) .show(); } else { try { editTextAddress.setText( jsonObject.get("tipoDeLogradouro") + " " + jsonObject.get("logradouro")); editTextNeighborhood.setText(jsonObject.get("bairro").toString()); editTextCity.setText(jsonObject.get("cidade").toString()); spinnerStates.setSelection( states.indexOf(jsonObject.get("estado").toString())); } catch (JSONException e3) { Log.e(AppHelper.getClassError(UserCrudActivity.class), e3.getMessage()); } } progressDialog.dismiss(); } }; task.execute(); } }); return rootView; }
/** * Tests submitting using url-encoded get, with all form widgets (other than FileUpload, which * requires post/multipart. */ public void testMethodGet() { System.out.println("testMethodGet"); final FormPanel form = new FormPanel(); form.setMethod(FormPanel.METHOD_GET); form.setEncoding(FormPanel.ENCODING_URLENCODED); form.setAction(GWT.getModuleBaseURL() + "formHandler"); TextBox tb = new TextBox(); tb.setText("text"); tb.setName("tb"); PasswordTextBox ptb = new PasswordTextBox(); ptb.setText("password"); ptb.setName("ptb"); CheckBox cb0 = new CheckBox(), cb1 = new CheckBox(); cb1.setValue(true); cb0.setName("cb0"); cb1.setName("cb1"); RadioButton rb0 = new RadioButton("foo"); RadioButton rb1 = new RadioButton("foo"); rb0.setValue(true); rb0.setName("rb0"); rb1.setName("rb1"); ListBox lb = new ListBox(); lb.addItem("option0"); lb.addItem("option1"); lb.addItem("option2"); lb.setValue(0, "value0"); lb.setValue(1, "value1"); lb.setValue(2, "value2"); lb.setSelectedIndex(1); lb.setName("lb"); Hidden h = new Hidden("h", "v"); FlowPanel panel = new FlowPanel(); panel.add(tb); panel.add(ptb); panel.add(cb0); panel.add(cb1); panel.add(rb0); panel.add(rb1); panel.add(lb); panel.add(h); form.setWidget(panel); RootPanel.get().add(form); delayTestFinish(TEST_DELAY); form.addSubmitCompleteHandler( new SubmitCompleteHandler() { public void onSubmitComplete(SubmitCompleteEvent event) { // The server just echoes the query string. This is what it should look // like. assertTrue( event .getResults() .equals( "tb=text&ptb=password&cb1=on&rb0=on&lb=value1&h=v")); finishTest(); } }); form.submit(); }
public NewPackageWizard(ClientFactory clientFactory, EventBus eventBus) { super(images.newexWiz(), constants.CreateANewPackage()); this.eventBus = eventBus; nameBox = new TextBox(); descBox = new TextBox(); newPackageLayout.addAttribute(constants.NameColon(), nameBox); newPackageLayout.addAttribute(constants.DescriptionColon(), descBox); nameBox.setTitle(constants.PackageNameTip()); RadioButton newPackage = new RadioButton("action", constants.CreateNewPackageRadio()); RadioButton importPackage = new RadioButton("action", constants.ImportFromDrlRadio()); newPackage.setValue(true); newPackageLayout.setVisible(true); newPackage.addClickHandler( new ClickHandler() { public void onClick(ClickEvent arg0) { newPackageLayout.setVisible(true); importLayout.setVisible(false); } }); this.setAfterShow( new Command() { public void execute() { nameBox.setFocus(true); } }); importLayout.setVisible(false); importPackage.addClickHandler( new ClickHandler() { public void onClick(ClickEvent arg0) { newPackageLayout.setVisible(false); importLayout.setVisible(true); } }); VerticalPanel ab = new VerticalPanel(); ab.add(newPackage); ab.add(importPackage); addAttribute("", ab); addRow(newPackageLayout); addRow(importLayout); importLayout.addAttribute(constants.DRLFileToImport(), newImportWidget(this)); importLayout.addRow(new HTML("<br/><b>" + constants.NoteNewPackageDrlImportWarning() + "</b>")); importLayout.addRow(new HTML(constants.ImportDRLDesc1())); importLayout.addRow(new HTML(constants.ImportDRLDesc2())); importLayout.addRow(new HTML(constants.ImportDRLDesc3())); HorizontalPanel hp = new HorizontalPanel(); Button create = new Button(constants.CreatePackage()); create.addClickHandler( new ClickHandler() { public void onClick(ClickEvent arg0) { if (PackageNameValidator.validatePackageName(nameBox.getText())) { createPackageAction(nameBox.getText(), descBox.getText()); hide(); } else { nameBox.setText(""); Window.alert(constants.PackageNameCorrectHint()); } } }); hp.add(create); Button cancel = new Button(constants.Cancel()); cancel.addClickHandler( new ClickHandler() { public void onClick(ClickEvent arg0) { hide(); } }); hp.add(cancel); newPackageLayout.addAttribute("", hp); }
/** * Add description to radio button title. * * @param radioItem radio button * @param description description to add */ private void addDescription(RadioButton radioItem, String description) { Element descElement = DOM.createSpan(); descElement.setInnerText(description); descElement.getStyle().setColor("#888"); radioItem.getElement().appendChild(descElement); }
public AddNewModuleDialog( final ApplicationModel model, final List<String> types, final NewModuleCreatedCallback callback, final Context errorDisplay) { super(false, true); okButton = new Button("Ok"); okButton.addStyleName("btn"); cancelButton = new Button("Cancel"); okButton.addStyleName("btn"); this.errorDisplay = errorDisplay; setTitle("Add new module"); final Panel radioPanel = new HorizontalPanel(); { final Panel daemonPanel; daemonPanel = new VerticalPanel(); boolean wasChecked = false; for (final DaemonModel daemonModel : model.getDaemons()) { final RadioButton radio = new RadioButton("daemonRadioGroup", "Add to " + daemonModel.getName() + " daemon."); if (!wasChecked) { radio.setValue(true); wasChecked = true; } daemonPanel.add(radio); daemonRadios.put(daemonModel, radio); } if (daemonRadios.size() > 1) { radioPanel.add(daemonPanel); } } { final Panel typePanel = new VerticalPanel(); boolean wasChecked = false; for (final String type : types) { if (!UiBuilderClient.NONE_TYPE.equals(type)) { final RadioButton radio = new RadioButton("typeRadioGroup", "Create " + type + " module."); if (!wasChecked) { radio.setValue(true); wasChecked = true; } typePanel.add(radio); typeRadios.put(type, radio); } } if (typeRadios.size() > 1) { radioPanel.add(typePanel); } } // If the user has no choice, just do the job if (skipDisplay()) { okClicked(callback); return; } final Panel buttonPanel = new HorizontalPanel(); buttonPanel.add(okButton); buttonPanel.add(cancelButton); okButton.addClickHandler( new ClickHandler() { @Override public void onClick(final ClickEvent event) { okClicked(callback); } }); cancelButton.addClickHandler( new ClickHandler() { @Override public void onClick(final ClickEvent event) { hide(); } }); final Panel allPanel = new VerticalPanel(); allPanel.add(radioPanel); allPanel.add(buttonPanel); add(allPanel); }
public void addTrip(ViaggioGruppo viaggoGruppo) { int i; int from = gpPack.getChildren().size(); int fromRow = gpPackRow; RadioButton rb = new RadioButton(); rb.setId(Integer.toString(viaggoGruppo.getVid())); rb.setToggleGroup(this.tg); rb.setOnAction(this::buildRight); gpPack.add(new Label(viaggoGruppo.getNumPacket().getNome()), 0, gpPackRow); gpPack.add(new Label(Integer.toString(viaggoGruppo.getNumPacket().getPrezzo())), 1, gpPackRow); gpPack.add( new Label(viaggoGruppo.getNumPacket().getOffertaPernotto().getCittà()), 2, gpPackRow); gpPack.add( new Label(viaggoGruppo.getNumPacket().getOffertaPernotto().getTipologia()), 4, gpPackRow); gpPack.add( new Label(Integer.toString(viaggoGruppo.getNumPacket().getOffertaPernotto().getStelle())), 5, gpPackRow); gpPack.add( new Label( Integer.toString(viaggoGruppo.getNumPacket().getOffertaPernotto().getNumeroNotti())), 6, gpPackRow); gpPack.add( new Label(viaggoGruppo.getNumPacket().getOffertaTrasporto().getCittàPartenza()), 8, gpPackRow); gpPack.add( new Label(viaggoGruppo.getNumPacket().getOffertaTrasporto().getTipologia()), 9, gpPackRow); gpPack.add( new Label(Integer.toString(viaggoGruppo.getNumPacket().getOffertaTrasporto().getDurata())), 10, gpPackRow); gpPack.add(rb, 20, gpPackRow); gpPack.add(new Label(Integer.toString(viaggoGruppo.getMinP())), 15, gpPackRow); gpPack.add(new Label(Integer.toString(viaggoGruppo.getMaxP())), 16, gpPackRow); gpPack.add(new Label(Double.toString(viaggoGruppo.getDiscount())), 17, gpPackRow); gpPack.add(new Label(Integer.toString(viaggoGruppo.getNumreserved())), 18, gpPackRow); int j = 0; for (OffertaEvento events : viaggoGruppo.getNumPacket().getOffertaEvento()) { gpPack.add(new Label(events.getNome()), 12, gpPackRow); gpPack.add(new Label(events.getTipologia()), 13, gpPackRow); j += 2; gpPackRow++; } Separator separator = new Separator(); gpPack.add(separator, 0, gpPackRow, 19, 1); gpPackRow++; Separator separator1 = new Separator(); separator1.setOrientation(Orientation.VERTICAL); Separator separator2 = new Separator(); separator2.setOrientation(Orientation.VERTICAL); Separator separator3 = new Separator(); separator3.setOrientation(Orientation.VERTICAL); Separator separator4 = new Separator(); separator4.setOrientation(Orientation.VERTICAL); Separator separator5 = new Separator(); separator4.setOrientation(Orientation.VERTICAL); gpPack.add(separator1, 3, fromRow, 1, viaggoGruppo.getNumPacket().getOffertaEvento().size()); gpPack.add(separator2, 7, fromRow, 1, viaggoGruppo.getNumPacket().getOffertaEvento().size()); gpPack.add(separator3, 11, fromRow, 1, viaggoGruppo.getNumPacket().getOffertaEvento().size()); gpPack.add(separator4, 14, fromRow, 1, viaggoGruppo.getNumPacket().getOffertaEvento().size()); gpPack.add(separator5, 19, fromRow, 1, viaggoGruppo.getNumPacket().getOffertaEvento().size()); }
/** {@inheritDoc} */ @Override public void setSoftMode(boolean isSoft) { soft.setValue(isSoft); }
@Override public void addRadioButtonHandler(ClickHandler handler) { rb2d.addClickHandler(handler); rb3d.addClickHandler(handler); }
/** {@inheritDoc} */ @Override public boolean isMixMode() { return mixed.getValue(); }