private SecurityPanel() { saveButton.setStylePrimaryName("pentaho-button"); HorizontalPanel roleTypeSelectionPanel = new HorizontalPanel(); regularRolesBtn.addValueChangeHandler(this); systemRolesBtn.addValueChangeHandler(this); roleTypeSelectionPanel.add(regularRolesBtn); roleTypeSelectionPanel.add(systemRolesBtn); // add role type panel FlexTable securityPanel = new FlexTable(); securityPanel.setWidget(0, 0, roleTypeSelectionPanel); securityPanel.getFlexCellFormatter().setColSpan(0, 0, 2); // add available roles list securityPanel.setWidget(1, 0, createRolesListBox()); securityPanel.getFlexCellFormatter().setRowSpan(1, 0, 2); saveButton.addClickHandler(this); securityPanel.setWidget(2, 0, saveButton); securityPanel.setWidget(1, 1, createPermissionPanel()); securityPanel.getFlexCellFormatter().setVerticalAlignment(2, 0, HasVerticalAlignment.ALIGN_TOP); setWidget(securityPanel); initializeAvailUserRoles(); initializeSystemRoles(); initializeLogicalRoleMappings(); }
/** Creates a new length property editor. */ public YoungAndroidLengthPropertyEditor() { // The radio button group cannot be shared across all instances, so we append a unique id. int uniqueId = ++uniqueIdSeed; String radioButtonGroup = "LengthType-" + uniqueId; automaticRadioButton = new RadioButton(radioButtonGroup, MESSAGES.automaticCaption()); fillParentRadioButton = new RadioButton(radioButtonGroup, MESSAGES.fillParentCaption()); customLengthRadioButton = new RadioButton(radioButtonGroup); customLengthField = new TextBox(); customLengthField.setVisibleLength(3); customLengthField.setMaxLength(3); Panel customRow = new HorizontalPanel(); customRow.add(customLengthRadioButton); customRow.add(customLengthField); Label pixels = new Label(MESSAGES.pixelsCaption()); pixels.setStylePrimaryName("ode-PixelsLabel"); customRow.add(pixels); Panel panel = new VerticalPanel(); panel.add(automaticRadioButton); panel.add(fillParentRadioButton); panel.add(customRow); automaticRadioButton.addValueChangeHandler( new ValueChangeHandler() { @Override public void onValueChange(ValueChangeEvent event) { // Clear the custom length field. customLengthField.setText(""); } }); fillParentRadioButton.addValueChangeHandler( new ValueChangeHandler() { @Override public void onValueChange(ValueChangeEvent event) { // Clear the custom length field. customLengthField.setText(""); } }); customLengthField.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { // If the user clicks on the custom length field, but the radio button for a custom // length // is not checked, check it. if (!customLengthRadioButton.isChecked()) { customLengthRadioButton.setChecked(true); } } }); initAdditionalChoicePanel(panel); }
private Widget createScreenshotPanel() { VerticalPanel panel = new VerticalPanel(); panel.setSize("100%", "100%"); // background Label label2 = new Label("Background"); panel.add(label2); HorizontalPanel bgTypes = new HorizontalPanel(); bgTypes.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); panel.add(bgTypes); screenshotTransparentBt = new RadioButton("scbgtype", "Transparent"); screenshotTransparentBt.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { updatePreviewCanvas(); } }); bgTypes.add(screenshotTransparentBt); // stop because not support so far screenshotColorBt = new RadioButton("scbgtype", "Color"); bgTypes.add(screenshotColorBt); screenshotColorBox = new ColorBox(); screenshotColorBox.setValue("#333333"); bgTypes.add(screenshotColorBox); return panel; }
public void setOptions(List<T> options) { for (T option : options) { final RadioButton radio = new RadioButton(RADIO_GROUP_NAME, option.getName()) { @Override public void onAttach() { super.onAttach(); Element radioButtonElement = getElement(); for (int i = 0; i < radioButtonElement.getChildCount(); i++) { Node child = radioButtonElement.getChild(i); // Найдем соответствующие input-элемент и label-элемент. if (child instanceof Element) { Element labelElement = (Element) child; if (((Element) child).getTagName().equalsIgnoreCase("label")) { labelElement.addClassName(RADIO_ITEM_STYLE); labelElement.addClassName(MAIN_FONT_STYLE); } else if (((Element) child).getTagName().equalsIgnoreCase("input")) { Element inputElement = (Element) child; inputElement.addClassName(RADIO_ITEM_STYLE); } } } } }; radio.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { if (event.getValue()) { setValue(getValueByField(radio), true); } } }); radios.put(option, radio); add(radio); setCellHeight(radio, (FIELD_DEFAULT_HEIGHT + 2) + Unit.PX.getType()); } }
private void init() { staffArea = new OrganizationSpecialTextArea(); staffAreaPanel.add(staffArea); // 提名人面板 startTime.setFormat(new DateBox.DefaultFormat(dateFormat)); // 隐藏周期性 expectTime.setEnabled(true); tmdays.setEnabled(true); nextRewardsTime.setEnabled(false); tmday.setEnabled(false); setting.setEnabled(false); autoCbx.setEnabled(false); nextPublicTime.setEnabled(false); specialCbx.setEnabled(false); birthRadio.setEnabled(false); backStore.setVisible(false); // settingText.getElement().getParentElement().getParentElement().getParentElement().addClassName(CssStyleConstants.hidden); nextRewardsTime.setFormat(new DateBox.DefaultFormat(dateFormat)); nextPublicTime.setFormat(new DateBox.DefaultFormat(dateFormat)); expectTime.setFormat(new DateBox.DefaultFormat(dateFormat)); // sub.setText("我的奖项"); // title.setText("创建奖项"); // settingText.setText("每1天一次"); birthRadio.getElement().addClassName(CssStyleConstants.hidden); // 周期性选择 onetimes.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { if (event.getValue()) { // settingText.getElement().getParentElement().getParentElement().getParentElement().addClassName(CssStyleConstants.hidden); // expectTime.getElement().getParentElement().getParentElement().getParentElement().removeClassName(CssStyleConstants.hidden); expectTime.setEnabled(true); tmdays.setEnabled(true); nextRewardsTime.setEnabled(false); tmday.setEnabled(false); setting.setEnabled(false); autoCbx.setEnabled(false); nextPublicTime.setEnabled(false); specialCbx.setEnabled(false); birthRadio.setEnabled(false); nextRewardsTime.setValue(null); tmday.setValue(null); autoCbx.setValue(null); nextPublicTime.setValue(null); specialCbx.setValue(null); birthRadio.setValue(null); settingText.setText(""); frequency = null; } else { // settingText.getElement().getParentElement().getParentElement().getParentElement().removeClassName(CssStyleConstants.hidden); // expectTime.getElement().getParentElement().getParentElement().getParentElement().addClassName(CssStyleConstants.hidden); expectTime.setEnabled(false); tmdays.setEnabled(false); expectTime.setValue(null); tmdays.setValue(null); nextRewardsTime.setEnabled(true); tmday.setEnabled(true); setting.setEnabled(true); autoCbx.setEnabled(true); nextPublicTime.setEnabled(true); specialCbx.setEnabled(true); birthRadio.setEnabled(true); } } }); moretimes.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { if (event.getValue()) { expectTime.setEnabled(false); tmdays.setEnabled(false); expectTime.setValue(null); tmdays.setValue(null); nextRewardsTime.setEnabled(true); tmday.setEnabled(true); setting.setEnabled(true); autoCbx.setEnabled(true); nextPublicTime.setEnabled(true); specialCbx.setEnabled(true); birthRadio.setEnabled(true); // settingText.getElement().getParentElement().getParentElement().getParentElement().removeClassName(CssStyleConstants.hidden); // expectTime.getElement().getParentElement().getParentElement().getParentElement().addClassName(CssStyleConstants.hidden); } else { expectTime.setEnabled(true); tmdays.setEnabled(true); nextRewardsTime.setEnabled(false); tmday.setEnabled(false); setting.setEnabled(false); autoCbx.setEnabled(false); nextPublicTime.setEnabled(false); specialCbx.setEnabled(false); birthRadio.setEnabled(false); nextRewardsTime.setValue(null); tmday.setValue(null); autoCbx.setValue(null); nextPublicTime.setValue(null); specialCbx.setValue(null); birthRadio.setValue(null); settingText.setText(""); // settingText.getElement().getParentElement().getParentElement().getParentElement().addClassName(CssStyleConstants.hidden); // expectTime.getElement().getParentElement().getParentElement().getParentElement().removeClassName(CssStyleConstants.hidden); } } }); // 特殊条件 specialCbx.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { if (event.getValue()) { birthRadio.setValue(true, true); birthRadio.getElement().removeClassName(CssStyleConstants.hidden); } else { birthRadio.setValue(false, true); birthRadio.getElement().addClassName(CssStyleConstants.hidden); } } }); // 生日奖 birthRadio.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { if (event.getValue()) { FrequencyClient frequecny = getFrequencyObj(); if (frequecny == null || frequecny instanceof WeekFrequencyClient || frequecny instanceof YearFrequencyClient) { Window.alert("生日奖必须为每日或每月,已重设为每天一次"); DayFrequencyClient daily = new DayFrequencyClient(); daily.setInterval(1); showFrequencyInfo(daily); } } else { showFrequencyInfo(null); } } }); // 自动颁奖 autoCbx.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { if (event.getValue()) { nextPublicTime.setEnabled(false); chooseBtns.setEnabled(false); // chooseBtns.getElement().getParentElement()//隐藏提名 // .getParentElement() // .addClassName(CssStyleConstants.hidden); // nextPublicTime.getElement().getParentElement() // .getParentElement() // .addClassName(CssStyleConstants.hidden); } else { // chooseBtns.getElement().getParentElement()//隐藏提名 // .getParentElement() // .removeClassName(CssStyleConstants.hidden); // nextPublicTime.getElement().getParentElement() // .getParentElement() // .removeClassName(CssStyleConstants.hidden); nextPublicTime.setEnabled(true); chooseBtns.setEnabled(true); } } }); // 只能输入数字 peopleSizeLimit.addValueChangeHandler( new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { if (event.getValue() != null && !event.getValue().equals("")) { try { Integer.parseInt(event.getValue()); } catch (Exception e) { peopleSizeLimit.setValue(""); } } } }); totalJF.addValueChangeHandler( new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { if (event.getValue() != null && !event.getValue().equals("")) { try { Integer.parseInt(event.getValue()); } catch (Exception e) { totalJF.setValue(""); } } } }); rewardsFrom.addValueChangeHandler( new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { if (event.getValue() != null && !event.getValue().equals("")) { try { Integer.parseInt(event.getValue()); } catch (Exception e) { rewardsFrom.setValue(""); } } } }); tmdays.addValueChangeHandler( new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { if (event.getValue() != null && !event.getValue().equals("")) { try { Integer.parseInt(event.getValue()); } catch (Exception e) { tmdays.setValue(""); } } } }); tmday.addValueChangeHandler( new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { if (event.getValue() != null && !event.getValue().equals("")) { try { Integer.parseInt(event.getValue()); } catch (Exception e) { tmday.setValue(""); } } } }); }