private void initClickModeSelectionUI(IGame game) { DockPanel clickModePanel = new DockPanel(); add(clickModePanel); clickModePanel.setWidth( Integer.toString(FieldCanvas.SIZE * game.getBoard().getDimension().x) + "px"); clickModePanel.setHorizontalAlignment(DockPanel.ALIGN_CENTER); clickOpenButton = new RadioButton("ClickOpens", "click opens"); clickOpenButton.setValue(true); clickFlagButton = new RadioButton("ClickFlags", "click flags"); clickFlagButton.setValue(false); ValueChangeHandler<Boolean> checkBoxToggler = new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { CheckBox checkBox = (CheckBox) event.getSource(); if (checkBox == clickOpenButton) clickFlagButton.setValue(!event.getValue()); else clickOpenButton.setValue(!event.getValue()); } }; clickOpenButton.addValueChangeHandler(checkBoxToggler); clickFlagButton.addValueChangeHandler(checkBoxToggler); clickModePanel.add(clickFlagButton, DockPanel.WEST); clickModePanel.add(clickOpenButton, DockPanel.EAST); clickModePanel.setCellHorizontalAlignment(clickOpenButton, DockPanel.ALIGN_LEFT); clickModePanel.setCellHorizontalAlignment(clickFlagButton, DockPanel.ALIGN_RIGHT); }
public Widget makeExtraUI(final WebLayerItem item) { final CheckBox cb = GwtUtil.makeCheckBox( "Offset Calculation", "Calculate the distance, delta(RA), delta(Dec), and PA between two points", _posAngle); cb.addValueChangeHandler( new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> ev) { _posAngle = ev.getValue(); redraw(); } }); SimpleInputField units = SimpleInputField.createByProp("PrefGroup.Generic.field.DistanceReadout"); String pref = Preferences.get(DIST_READOUT); units.setValue(pref == null ? DEG : pref); units .getField() .addValueChangeHandler( new ValueChangeHandler<String>() { public void onValueChange(ValueChangeEvent<String> ev) { Preferences.set(DIST_READOUT, ev.getValue()); redraw(); } }); VerticalPanel vp = new VerticalPanel(); vp.add(cb); vp.add(units); return vp; }
private void initActivateFilter(final BoardsFilter filterObject) { activateFilter.setValue(filterObject.isActive()); disclosurePanel.setVisible(filterObject.isActive()); activateFilter.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { boolean active = event.getValue(); filterObject.setActive(active); disclosurePanel.setVisible(active); filterObject.fireFilterChangedEvent(); } }); }
private void createRequiredCheckBoxColumn() { VerticalPanel mp = new VerticalPanel(); upperLinePanel.add(mp); Label mandatoryLabel = new Label(myConstants.required() + ":"); mandatoryLabel.setStyleName("keyLabel"); mp.add(mandatoryLabel); final CheckBox valueBox = new CheckBox(); valueBox.setValue(input.getRequired()); mp.add(valueBox); valueBox.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent arg0) { input.setRequired(valueBox.getValue()); } }); }
private void initAutoPlay() { final AutoPlayer autoPlayer = new AutoPlayer(game, false); autoPlayTimer = new Timer() { public void run() { autoPlayer.doNextMove(); } }; final CheckBox autoPlay = new CheckBox("Let the browser play."); autoPlay.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { if (event.getValue() && !isGameFinished()) autoPlayTimer.scheduleRepeating(1000); else autoPlayTimer.cancel(); } }); add(autoPlay); }
/** * Creates new component design panel for visible components. * * @param nonVisibleComponentsPanel corresponding panel for non-visible components */ public SimpleVisibleComponentsPanel( final SimpleEditor editor, SimpleNonVisibleComponentsPanel nonVisibleComponentsPanel) { this.nonVisibleComponentsPanel = nonVisibleComponentsPanel; projectEditor = editor.getProjectEditor(); // Initialize UI phoneScreen = new VerticalPanel(); phoneScreen.setStylePrimaryName("ode-SimpleFormDesigner"); checkboxShowHiddenComponents = new CheckBox(MESSAGES.showHiddenComponentsCheckbox()) { @Override protected void onLoad() { // onLoad is called immediately after a widget becomes attached to the browser's // document. boolean showHiddenComponents = Boolean.parseBoolean( projectEditor.getProjectSettingsProperty( SettingsConstants.PROJECT_YOUNG_ANDROID_SETTINGS, SettingsConstants.YOUNG_ANDROID_SETTINGS_SHOW_HIDDEN_COMPONENTS)); checkboxShowHiddenComponents.setValue(showHiddenComponents); } }; checkboxShowHiddenComponents.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { boolean isChecked = event.getValue(); // auto-unbox from Boolean to boolean projectEditor.changeProjectSettingsProperty( SettingsConstants.PROJECT_YOUNG_ANDROID_SETTINGS, SettingsConstants.YOUNG_ANDROID_SETTINGS_SHOW_HIDDEN_COMPONENTS, isChecked ? "True" : "False"); if (form != null) { form.refresh(); } } }); phoneScreen.add(checkboxShowHiddenComponents); initWidget(phoneScreen); }
private void createConditionCheckboxColumn() { VerticalPanel cp = new VerticalPanel(); upperLinePanel.add(cp); Label conditionalLabel = new Label(myConstants.conditional() + ":"); conditionalLabel.setStyleName("keyLabel"); cp.add(conditionalLabel); conditionalBox = new CheckBox(); conditionalBox.setValue(input.getConditional()); cp.add(conditionalBox); conditionalBox.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent arg0) { input.setConditional(conditionalBox.getValue()); conditionalPanel.setVisible(conditionalBox.getValue()); } }); }
private ProjectWidgets(final Project project) { checkBox = new CheckBox(); checkBox.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { boolean isChecked = event.getValue(); // auto-unbox from Boolean to boolean int row = 1 + projects.indexOf(project); if (isChecked) { table.getRowFormatter().setStyleName(row, "ode-ProjectRowHighlighted"); selectedProjects.add(project); } else { table.getRowFormatter().setStyleName(row, "ode-ProjectRowUnHighlighted"); selectedProjects.remove(project); } Ode.getInstance().getProjectToolbar().updateButtons(); } }); nameLabel = new Label(project.getProjectName()); nameLabel.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { Ode.getInstance().openYoungAndroidProjectInDesigner(project); } }); nameLabel.addStyleName("ode-ProjectNameLabel"); DateTimeFormat dateTimeFormat = DateTimeFormat.getMediumDateTimeFormat(); Date dateCreated = new Date(project.getDateCreated()); dateCreatedLabel = new Label(dateTimeFormat.format(dateCreated)); Date dateModified = new Date(project.getDateModified()); dateModifiedLabel = new Label(dateTimeFormat.format(dateModified)); editButton = new Button("Publish"); }
@Inject StoriesView(Binder uiBinder) { initWidget(uiBinder.createAndBindUi(this)); bindSlot(StoriesPresenter.SLOT_CREATESTORY, panelCreateStory); lstStatus.setNullText("--Status--"); lstBranch.setNullText("--Branch--"); lstCreator.setNullText("--Staff--"); lstStatus.setItems( Arrays.asList( NewsQueueStatus.Draft, NewsQueueStatus.InProgress, NewsQueueStatus.Published, // NewsQueueStatus.Returned, NewsQueueStatus.Spiked)); chkMineOnly.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { setMineOnly(event.getValue()); searchCallback.onComplete(null); } }); setMineOnly(true); aDateRange.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { AppManager.showPopUp( "Date Range", dateSelector, new OnOptionSelected() { @Override public void onSelect(String name) { if (name.equals("Clear")) { dateSelector.clearData(); } if (dateSelector.hasValue()) { aDateRange.addStyleName("orange"); alertOnSearchValueChange(true); } else { aDateRange.removeStyleName("orange"); } aDateRange.setTitle("" + dateSelector.getValueAsString()); searchCallback.onComplete(null); } }, "Done", "Clear"); } }); lstStatus.addValueChangeHandler( new ValueChangeHandler<NewsQueueStatus>() { @Override public void onValueChange(ValueChangeEvent<NewsQueueStatus> event) { searchCallback.onComplete(null); if (event.getValue() != null) { alertOnSearchValueChange(true); } } }); lstCreator.addValueChangeHandler( new ValueChangeHandler<UserDto>() { @Override public void onValueChange(ValueChangeEvent<UserDto> event) { searchCallback.onComplete(null); if (event.getValue() != null) { alertOnSearchValueChange(true); } } }); lstBranch.addValueChangeHandler( new ValueChangeHandler<Org>() { @Override public void onValueChange(ValueChangeEvent<Org> event) { searchCallback.onComplete(null); if (event.getValue() != null) { alertOnSearchValueChange(true); } } }); chkMineOnly.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { setMineOnly(event.getValue()); } }); }
public RowLayoutPortlet() { LayoutPanel panel = new LayoutPanel(); initWidget(panel); final CheckBox column = new CheckBox("Column"); column.addValueChangeHandler( new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> event) { getTargetLayout().setColumn(column.getValue()); target.layout(); } }); final TextBox spacing = new TextBox(); spacing.setVisibleLength(4); spacing.addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { try { getTargetLayout().setSpacing(Integer.parseInt(spacing.getText())); } catch (NumberFormatException e) { // ignore } target.layout(); } }); final Label bounds = new Label(); target.addLayoutHandler( new LayoutHandler() { public void onLayoutUpdated(LayoutEvent layoutEvent) { bounds.setText(LDOM.getBounds(target).toString()); column.setValue(getTargetLayout().isColumn()); spacing.setText(Integer.toString(getTargetLayout().getSpacing())); } }); demoList.addItem("Buttons & Body"); demoList.addItem("Sidebar & Margin"); demoList.addItem("Border Layout"); demoList.setSelectedIndex(0); Button add = new CssButton( "Add Widget", new ClickHandler() { public void onClick(ClickEvent event) { target.add(new Thing("Widget-" + (target.getWidgetCount() + 1))); target.layout(); } }, "Add a new widget to the layout"); final Button go = new CssButton( "Go", new ClickHandler() { public void onClick(ClickEvent event) { go(); } }, "Reset the layout to the selected state"); demoList.addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { go.click(); } }); FormBuilder b = new FormBuilder(); b.add(add) .label("Spacing") .field(spacing) .field(column) .add("") .field(bounds) .wrap() .width("100%") .add(demoList) .add(go) .endRow(); panel.add(b.getForm(), 22); panel.add(target, LayoutConstraints.HIDDEN); go(); }
// TODO extract & move private VerticalPanel createArcTypeContainerControl( String label, final ArcItemContainer arcItemContainer) { final TextBox arcColorText = new TextBox(); arcColorText.setText(arcItemContainer.getArcColor()); final ListBox arcStyleDropDown = new ListBox(); arcStyleDropDown.setVisibleItemCount(1); arcStyleDropDown.addItem(ArcSettings.ARC_STYLE_SOLID); arcStyleDropDown.addItem(ArcSettings.ARC_STYLE_DASHED); arcStyleDropDown.addItem(ArcSettings.ARC_STYLE_DOTTED); String arcStyle = arcItemContainer.getArcStyle(); if (ArcSettings.ARC_STYLE_DOTTED.equals(arcStyle)) { arcStyleDropDown.setSelectedIndex(2); } else if (ArcSettings.ARC_STYLE_DASHED.equals(arcStyle)) { arcStyleDropDown.setSelectedIndex(1); } else { arcStyleDropDown.setSelectedIndex(0); } final ListBox arcHeadDropDown = new ListBox(); arcHeadDropDown.setVisibleItemCount(1); arcHeadDropDown.addItem(ArcSettings.ARC_HEAD_NONE); arcHeadDropDown.addItem(ArcSettings.ARC_HEAD_TRIANGLE_EMPTY); arcHeadDropDown.addItem(ArcSettings.ARC_HEAD_TRIANGLE_FULL); String arcHead = arcItemContainer.getArcHead(); if (ArcSettings.ARC_HEAD_TRIANGLE_FULL.equals(arcHead)) { arcHeadDropDown.setSelectedIndex(2); } else if (ArcSettings.ARC_HEAD_TRIANGLE_EMPTY.equals(arcHead)) { arcHeadDropDown.setSelectedIndex(1); } else if (ArcSettings.ARC_HEAD_NONE.equals(arcHead)) { arcHeadDropDown.setSelectedIndex(0); } final String defaultEntry = "Default"; final ListBox arcThicknessDropDown = new ListBox(); arcThicknessDropDown.setVisibleItemCount(1); arcThicknessDropDown.addItem(defaultEntry); arcThicknessDropDown.addItem("1"); arcThicknessDropDown.addItem("2"); arcThicknessDropDown.addItem("3"); arcThicknessDropDown.addItem("4"); arcThicknessDropDown.addItem("5"); arcThicknessDropDown.setSelectedIndex(0); final Button updateButton = new Button("Update Arcs"); updateButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { arcItemContainer.setArcColor(arcColorText.getText()); arcItemContainer.setArcStyle( arcStyleDropDown.getItemText(arcStyleDropDown.getSelectedIndex())); String selectedThicknessText = arcThicknessDropDown.getItemText(arcThicknessDropDown.getSelectedIndex()); if (selectedThicknessText.equals(defaultEntry)) { arcItemContainer.setArcThicknessLevel(0); } else { arcItemContainer.setArcThicknessLevel(Integer.parseInt(selectedThicknessText)); } arcItemContainer.setArcHead( arcHeadDropDown.getItemText(arcHeadDropDown.getSelectedIndex())); } }); final CheckBox visibleCheckBox = new CheckBox("Arcs Visible"); visibleCheckBox.setValue(true); visibleCheckBox.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { boolean value = visibleCheckBox.getValue(); updateButton.setEnabled(value); arcStyleDropDown.setEnabled(value); arcHeadDropDown.setEnabled(value); arcThicknessDropDown.setEnabled(value); arcColorText.setEnabled(value); arcItemContainer.setVisible(value); } }); VerticalPanel containerPanel = new VerticalPanel(); containerPanel.add(new Label(label)); containerPanel.add(visibleCheckBox); containerPanel.add(new Label("Arc Color")); containerPanel.add(arcColorText); containerPanel.add(new Label("Arc Style")); containerPanel.add(arcStyleDropDown); containerPanel.add(new Label("Arc Head")); containerPanel.add(arcHeadDropDown); containerPanel.add(new Label("Arc Thickness")); containerPanel.add(arcThicknessDropDown); containerPanel.add(updateButton); // Handler runs and removes itself internally. @SuppressWarnings("unused") Handler handler = new Handler() { private HandlerRegistration register = arcColorText.addAttachHandler(this); @Override public void onAttachOrDetach(AttachEvent event) { $(arcColorText).as(Enhance).colorBox(ColorPickerType.SIMPLE); // Only want this run once, so let's do a trick to remove it. register.removeHandler(); } }; return containerPanel; }
public void sprayFileList(List<FileWrapper> list) { checkBoxList.clear(); selectedFileSet.clear(); flowPanel.clear(); for (final FileWrapper fileWrapper : list) { final FlowPanel tempFlowPanel = new FlowPanel(); flowPanel.add(tempFlowPanel); tempFlowPanel.getElement().getStyle().setProperty("margin", 50, Unit.PX); tempFlowPanel.getElement().getStyle().setProperty("textAlign", "center"); tempFlowPanel.getElement().getStyle().setProperty("verticalAlign", "top"); tempFlowPanel.getElement().getStyle().setProperty("display", "inline-block"); tempFlowPanel.sinkEvents(Event.ONDBLCLICK); tempFlowPanel.sinkEvents(Event.ONCONTEXTMENU); final CheckBox chckbxFileName = new CheckBox(fileWrapper.getName()); Image imgFileIcon; switch (fileWrapper.getKind()) { case DIR: imgFileIcon = new Image("/img/folder.png"); tempFlowPanel.addHandler( new DoubleClickHandler() { public void onDoubleClick(DoubleClickEvent event) { presenter.changeDirectory(fileWrapper.getPath()); } }, DoubleClickEvent.getType()); tempFlowPanel.addHandler( new ContextMenuHandler() { public void onContextMenu(ContextMenuEvent event) { event.preventDefault(); event.stopPropagation(); FileContextMenu fileContextMenu = new FileContextMenu( presenter, ContextMenuType.DIRECTORY, fileWrapper.getPath(), selectedFileSet); fileContextMenu.setPopupPosition( event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY()); fileContextMenu.show(); chckbxFileName.setValue(true, true); } }, ContextMenuEvent.getType()); break; default: imgFileIcon = new Image("/img/file.png"); tempFlowPanel.addHandler( new DoubleClickHandler() { public void onDoubleClick(DoubleClickEvent event) { presenter.downloadFiles(selectedFileSet); } }, DoubleClickEvent.getType()); tempFlowPanel.addHandler( new ContextMenuHandler() { public void onContextMenu(ContextMenuEvent event) { event.preventDefault(); event.stopPropagation(); FileContextMenu fileContextMenu = new FileContextMenu( presenter, ContextMenuType.OTHERS, fileWrapper.getPath(), selectedFileSet); fileContextMenu.setPopupPosition( event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY()); fileContextMenu.show(); chckbxFileName.setValue(true, true); } }, ContextMenuEvent.getType()); break; } tempFlowPanel.add(imgFileIcon); imgFileIcon.setSize("128px", "128px"); imgFileIcon.getElement().getStyle().setProperty("display", "block"); checkBoxList.add(chckbxFileName); tempFlowPanel.add(chckbxFileName); chckbxFileName.addStyleName("iconName"); chckbxFileName.getElement().getStyle().setProperty("display", "block"); chckbxFileName.addClickHandler(clickHandlerStopPropagation); chckbxFileName.addValueChangeHandler( new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> event) { if (event.getValue()) { tempFlowPanel.getElement().getStyle().setBackgroundColor("lightblue"); selectedFileSet.add(fileWrapper.getPath()); } else { tempFlowPanel.getElement().getStyle().clearBackgroundColor(); selectedFileSet.remove(fileWrapper.getPath()); } if (!mntmDeleteFile.isEnabled() && selectedFileSet.size() > 0) { mntmDeleteFile.setEnabled(true); } else if (selectedFileSet.size() == 0) { mntmDeleteFile.setEnabled(false); } if (selectedFileSet.size() == 1 && !mntmDownloadFile.isEnabled() && !mntmRenameFile.isEnabled()) { mntmDownloadFile.setEnabled(true); mntmRenameFile.setEnabled(true); } else if (selectedFileSet.size() != 1 && mntmDownloadFile.isEnabled() && mntmRenameFile.isEnabled()) { mntmDownloadFile.setEnabled(false); mntmRenameFile.setEnabled(false); } } }); imgFileIcon.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { event.stopPropagation(); setAllCheckBoxFalse(); chckbxFileName.setValue(true, true); } }); imgFileIcon.addMouseOverHandler( new MouseOverHandler() { public void onMouseOver(MouseOverEvent event) { if (!chckbxFileName.getValue()) tempFlowPanel.getElement().getStyle().setBackgroundColor("lightgray"); } }); imgFileIcon.addMouseOutHandler( new MouseOutHandler() { public void onMouseOut(MouseOutEvent event) { if (!chckbxFileName.getValue()) tempFlowPanel.getElement().getStyle().clearBackgroundColor(); } }); } }
private Widget createGifPanel() { VerticalPanel panel = new VerticalPanel(); panel.setSize("100%", "100%"); Label label = new Label("Visible options"); panel.add(label); HorizontalPanel checks = new HorizontalPanel(); panel.add(checks); backgroundCheck = new CheckBox("Tile"); checks.add(backgroundCheck); backgroundCheck.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { PoseEditor.poseEditor.setReservedSettingPreview(true); } }); boneCheck = new CheckBox("Bone"); checks.add(boneCheck); boneCheck.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { PoseEditor.poseEditor.setReservedSettingPreview(true); } }); ikCheck = new CheckBox("IK"); checks.add(ikCheck); ikCheck.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { PoseEditor.poseEditor.setReservedSettingPreview(true); } }); // camera control Label label5 = new Label("Camera"); panel.add(label5); HorizontalPanel h4 = new HorizontalPanel(); panel.add(h4); settingPositionXRange = InputRangeWidget.createInputRange(-300, 300, 0); HorizontalPanel hx = new HorizontalPanel(); hx.setWidth("100px"); h4.add(hx); hx.add( HTML5Builder.createRangeLabel( "X-Position:", settingPositionXRange, PoseEditor.poseEditor.getPosDivided())); h4.add(settingPositionXRange); settingPositionXRange.addInputRangeListener( new InputRangeListener() { @Override public void changed(int newValue) { PoseEditor.poseEditor.setRootPositionRangeValues( settingPositionXRange.getValue(), settingPositionYRange.getValue(), settingPositionZRange.getValue()); PoseEditor.poseEditor.setReservedSettingPreview(true); } }); settingPositionYRange = InputRangeWidget.createInputRange(-300, 300, 0); HorizontalPanel hy = new HorizontalPanel(); hy.setWidth("100px"); h4.add(hy); hy.add( HTML5Builder.createRangeLabel( "Y-Position:", settingPositionYRange, PoseEditor.poseEditor.getPosDivided())); h4.add(settingPositionYRange); settingPositionYRange.addInputRangeListener( new InputRangeListener() { @Override public void changed(int newValue) { PoseEditor.poseEditor.setRootPositionRangeValues( settingPositionXRange.getValue(), settingPositionYRange.getValue(), settingPositionZRange.getValue()); PoseEditor.poseEditor.setReservedSettingPreview(true); // updatePreviewCanvas(); } }); settingPositionZRange = InputRangeWidget.createInputRange(0, 1000, 0); HorizontalPanel hz = new HorizontalPanel(); hz.setWidth("100px"); h4.add(hz); hz.add( HTML5Builder.createRangeLabel( "Z-Position:", settingPositionZRange, PoseEditor.poseEditor.getPosDivided())); h4.add(settingPositionZRange); settingPositionZRange.addInputRangeListener( new InputRangeListener() { @Override public void changed(int newValue) { PoseEditor.poseEditor.setRootPositionRangeValues( settingPositionXRange.getValue(), settingPositionYRange.getValue(), settingPositionZRange.getValue()); PoseEditor.poseEditor.setReservedSettingPreview(true); } }); // transparent and basic material can't support because need recreate model. Label label3 = new Label("Size"); panel.add(label3); HorizontalPanel sizePanel = new HorizontalPanel(); sizePanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); panel.add(sizePanel); sizePanel.add(new Label("Width:")); widthBox = new IntegerBox(); widthBox.setWidth("50px"); sizePanel.add(widthBox); widthBox.addValueChangeHandler( new ValueChangeHandler<Integer>() { @Override public void onValueChange(ValueChangeEvent<Integer> event) { updateCanvasSize(); } }); sizePanel.add(new Label("Height:")); heightBox = new IntegerBox(); heightBox.setWidth("50px"); sizePanel.add(heightBox); heightBox.addValueChangeHandler( new ValueChangeHandler<Integer>() { @Override public void onValueChange(ValueChangeEvent<Integer> event) { updateCanvasSize(); } }); Button reset1 = new Button( "Reset size", new ClickHandler() { @Override public void onClick(ClickEvent event) { widthBox.setValue(gifWidth); heightBox.setValue(gifHeight); updateCanvasSize(); } }); sizePanel.add(reset1); Label label4 = new Label("GifAnime Options"); panel.add(label4); HorizontalPanel h1 = new HorizontalPanel(); panel.add(h1); h1.add(new Label("Quality")); qualityBox = new ValueListBox<Integer>( new Renderer<Integer>() { @Override public String render(Integer value) { if (value == 10) { return "medium(10)"; } if (value == 1) { return "High(1)"; } if (value == 20) { return "low(20)"; } return "" + value; } @Override public void render(Integer object, Appendable appendable) throws IOException {} }); List<Integer> acceptableValues = Lists.newArrayList(); for (int i = 20; i > 0; i--) { acceptableValues.add(i); } qualityBox.setValue(20); // low qualityBox.setAcceptableValues(acceptableValues); h1.add(qualityBox); h1.add(new Label("Speed")); speedBox = new ValueListBox<Integer>( new Renderer<Integer>() { @Override public String render(Integer value) { if (value == 1000) { return "slow(1000ms)"; } if (value == 50) { return "first(50ms)"; } if (value == 500) { return "medium(500ms)"; } return "" + value; } @Override public void render(Integer object, Appendable appendable) throws IOException {} }); List<Integer> acceptableValues2 = Lists.newArrayList(); for (int i = 1; i <= 20; i++) { acceptableValues2.add(i * 50); } speedBox.setValue(300); // low speedBox.setAcceptableValues(acceptableValues2); h1.add(speedBox); // background Label label2 = new Label("Background"); panel.add(label2); HorizontalPanel bgTypes = new HorizontalPanel(); bgTypes.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); panel.add(bgTypes); transparentBt = new RadioButton("bgtype", "Transparent"); transparentBt.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { updatePreviewCanvas(); } }); // bgTypes.add(transparentBt);//stop because not support so far colorBt = new RadioButton("bgtype", "Color"); bgTypes.add(colorBt); /* colorBt.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { updatePreviewCanvas(); } }); */ colorBt.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { updatePreviewCanvas(); } }); colorBox = new ColorBox(); colorBox.setValue("#333333"); bgTypes.add(colorBox); imageBt = new RadioButton("bgtype", "Image"); bgTypes.add(imageBt); imageBt.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { updatePreviewCanvas(); } }); Button colorUpdateBt = new Button( "Update", new ClickHandler() { @Override public void onClick(ClickEvent event) { updatePreviewCanvas(); } }); bgTypes.add(colorUpdateBt); bgImageLabel = new Label(); bgImageLabel.setWidth("100px"); bgImageUpload = FileUtils.createSingleFileUploadForm( new DataURLListener() { @Override public void uploaded(File file, String text) { bgImageLabel.setText(Ascii.truncate(file.getFileName(), 15, "...")); ImageElementUtils.createWithLoader( text, new ImageElementListener() { @Override public void onLoad(ImageElement element) { bgImage = element; imageBt.setValue(true); updatePreviewCanvas(); } @Override public void onError(String url, ErrorEvent event) { LogUtils.log(event.getNativeEvent()); } }); } }, true); bgTypes.add(bgImageUpload); bgTypes.add(bgImageLabel); Button reset = new Button( "Reset", new ClickHandler() { @Override public void onClick(ClickEvent event) { bgImageLabel.setText(""); bgImage = null; updatePreviewCanvas(); } }); bgTypes.add(reset); // size // TODO support size bgCanvas = CanvasUtils.createCanvas(gifWidth, gifHeight); panel.add(bgCanvas); return panel; }
public DeploymentView() { VerticalPanel container = new VerticalPanel(); container.addStyleName("container"); FlexTable table = new FlexTable(); Anchor back = new Anchor("<< Retour"); int rowIndex = 0; // Titre : création/edition viewTitle = new HTML(); table.setWidget(rowIndex, 0, viewTitle); table.getFlexCellFormatter().setColSpan(rowIndex, 0, 2); table .getCellFormatter() .setHorizontalAlignment(rowIndex++, 0, HasHorizontalAlignment.ALIGN_CENTER); // Date de déploiement deploymentDatePicker = new DatePicker(); deploymentDatePicker.addValueChangeHandler( new ValueChangeHandler<Date>() { @Override public void onValueChange(ValueChangeEvent<Date> event) { listener.setDeploymentDate(event.getValue()); } }); table.setWidget(rowIndex, 0, new HTML("Date prévue de déploiement")); table.setWidget(rowIndex++, 1, deploymentDatePicker); // Flag deployée ou pas deployedCheckBox = new CheckBox(); table.setWidget(rowIndex, 0, new HTML("Deployé")); table.setWidget(rowIndex++, 1, deployedCheckBox); // Bouton de validation saveButton = new Button("Enregistrer"); table.setWidget(rowIndex, 0, saveButton); table.getFlexCellFormatter().setColSpan(rowIndex, 0, 2); table .getCellFormatter() .setHorizontalAlignment(rowIndex++, 0, HasHorizontalAlignment.ALIGN_CENTER); // Création des handlers back.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { DeploymentView.this.listener.goTo(new MainPlace()); } }); deploymentDatePicker.addValueChangeHandler( new ValueChangeHandler<Date>() { @Override public void onValueChange(ValueChangeEvent<Date> event) { DeploymentView.this.listener.setDeploymentDate(event.getValue()); } }); deployedCheckBox.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { DeploymentView.this.listener.setDeployed(event.getValue()); } }); saveButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { DeploymentView.this.listener.save(); } }); container.add(back); container.add(table); initWidget(container); }
@Inject public PublishingPreferencesPane( GlobalDisplay globalDisplay, RSConnectServerOperations server, RSAccountConnector connector, UIPrefs prefs, DependencyManager deps) { reloadRequired_ = false; display_ = globalDisplay; uiPrefs_ = prefs; server_ = server; connector_ = connector; deps_ = deps; VerticalPanel accountPanel = new VerticalPanel(); Label accountLabel = headerLabel("Publishing Accounts"); HorizontalPanel hpanel = new HorizontalPanel(); accountPanel.add(accountLabel); accountList_ = new RSConnectAccountList(server, globalDisplay, true, true); accountList_.setHeight("200px"); accountList_.setWidth("300px"); accountList_.getElement().getStyle().setMarginBottom(15, Unit.PX); accountList_.getElement().getStyle().setMarginLeft(3, Unit.PX); hpanel.add(accountList_); accountList_.setOnRefreshCompleted( new Operation() { @Override public void execute() { setButtonEnabledState(); } }); accountList_.addChangeHandler( new ChangeHandler() { @Override public void onChange(ChangeEvent arg0) { setButtonEnabledState(); } }); VerticalPanel vpanel = new VerticalPanel(); hpanel.add(vpanel); connectButton_ = new ThemedButton("Connect..."); connectButton_.getElement().getStyle().setMarginBottom(5, Unit.PX); connectButton_.setWidth("100%"); connectButton_.setWrapperWidth("100%"); connectButton_.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { onConnect(); } }); vpanel.add(connectButton_); reconnectButton_ = new ThemedButton("Reconnect..."); reconnectButton_.getElement().getStyle().setMarginBottom(5, Unit.PX); reconnectButton_.setWidth("100%"); reconnectButton_.setWrapperWidth("100%"); reconnectButton_.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { onReconnect(); } }); vpanel.add(reconnectButton_); disconnectButton_ = new ThemedButton("Disconnect"); disconnectButton_.setWidth("100%"); disconnectButton_.setWrapperWidth("100%"); disconnectButton_.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { onDisconnect(); } }); vpanel.add(disconnectButton_); setButtonEnabledState(); accountPanel.add(hpanel); add(accountPanel); // special UI to show when we detect that there are account records but // the RSConnect package isn't installed final VerticalPanel missingPkgPanel = new VerticalPanel(); missingPkgPanel.setVisible(false); missingPkgPanel.add( new Label( "Account records appear to exist, but cannot be viewed because a " + "required package is not installed.")); ThemedButton installPkgs = new ThemedButton("Install Missing Packages"); installPkgs.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent arg0) { deps_.withRSConnect( "Viewing publish accounts", false, null, new CommandWithArg<Boolean>() { @Override public void execute(Boolean succeeded) { if (succeeded) { // refresh the account list to show the accounts accountList_.refreshAccountList(); // remove the "missing package" UI missingPkgPanel.setVisible(false); } } }); } }); installPkgs.getElement().getStyle().setMarginLeft(0, Unit.PX); installPkgs.getElement().getStyle().setMarginTop(10, Unit.PX); missingPkgPanel.add(installPkgs); missingPkgPanel.getElement().getStyle().setMarginBottom(20, Unit.PX); add(missingPkgPanel); final CheckBox chkEnableRSConnect = checkboxPref("Enable publishing to RStudio Connect", uiPrefs_.enableRStudioConnect()); final HorizontalPanel rsconnectPanel = checkBoxWithHelp(chkEnableRSConnect, "rstudio_connect"); lessSpaced(rsconnectPanel); add(headerLabel("Settings")); CheckBox chkEnablePublishing = checkboxPref("Enable publishing documents and apps", uiPrefs_.showPublishUi()); chkEnablePublishing.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { reloadRequired_ = true; rsconnectPanel.setVisible(RSConnect.showRSConnectUI() && event.getValue()); } }); add(chkEnablePublishing); if (RSConnect.showRSConnectUI()) add(rsconnectPanel); add( checkboxPref( "Show diagnostic information when publishing", uiPrefs_.showPublishDiagnostics())); server_.hasOrphanedAccounts( new ServerRequestCallback<Int>() { @Override public void onResponseReceived(Int numOrphans) { missingPkgPanel.setVisible(numOrphans.getValue() > 0); } @Override public void onError(ServerError error) { // if we can't determine whether orphans exist, presume that they // don't (this state is recoverable as we'll attempt to install // rsconnect if necessary and refresh the account list when the user // tries to interact with it) } }); }
private SidePanelSection createOntologyGraphNodesSidePanelSection( final ResourceModel resourceModel, final VisualizationModel visualizationModel) { final VerticalPanel panel = new VerticalPanel(); final Map<String, CheckBox> ontologyToFilterBox = CollectionFactory.createStringMap(); final CheckBox colorByOntologyCheckBox = new CheckBox("Color Nodes by Ontology"); colorByOntologyCheckBox.setValue(true); colorByOntologyCheckBox.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { boolean value = colorByOntologyCheckBox.getValue(); VisualItemValueResolver resolver; if (value) { resolver = NODE_COLOR_BY_ONTOLOGY_RESOLVER_FACTORY.create(); } else { resolver = NODE_BACKGROUND_COLOR_RESOLVER_FACTORY.create(); } visualizationModel.setResolver(Graph.NODE_BACKGROUND_COLOR, resolver); } }); resourceModel .getResources() .addEventHandler( new ResourceSetChangedEventHandler() { @Override public void onResourceSetChanged(ResourceSetChangedEvent event) { LightweightCollection<Resource> addedResources = event.getAddedResources(); for (Resource resource : addedResources) { if (Ontology.isOntology(resource)) { String ontologyAcronym = (String) resource.getValue(Ontology.ONTOLOGY_ACRONYM); if (!ontologyToFilterBox.containsKey(ontologyAcronym)) { CheckBox checkBox = new CheckBox( "<span style='color: " + BioMixerConceptByOntologyColorResolver.getColor(ontologyAcronym) + "'>▉</span>" + " " + "Show " + resource.getValue(Ontology.ONTOLOGY_ACRONYM), true); checkBox.setValue(true); ontologyToFilterBox.put(ontologyAcronym, checkBox); panel.add(checkBox); checkBox.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { updatePredicate(resourceModel, false, ontologyToFilterBox); } }); } } } } }); panel.add(colorByOntologyCheckBox); updatePredicate(resourceModel, false, ontologyToFilterBox); return new SidePanelSection("Nodes", panel); }
/** @param jobs */ public void initUI(JsArray<JsJob> jobs) { if (jobs != null) { for (int i = 0; i < jobs.length(); i++) { resourceOracle.add(jobs.get(i).getShortResourceName()); } } resourceSuggestBox.setWidth("240px"); userListBox.setWidth("200px"); userListBox.getElement().getStyle().setTextTransform(Style.TextTransform.CAPITALIZE); scheduleStateListBox.setWidth("200px"); scheduleTypeListBox.setWidth("200px"); // next execution filter CaptionPanel executionFilterCaptionPanel = new CaptionPanel(Messages.getString("executionTime")); FlexTable executionFilterPanel = new FlexTable(); executionFilterPanel.setWidget(0, 0, beforeCheckBox); executionFilterPanel.setWidget(0, 1, beforeDateBox); executionFilterPanel.setWidget(1, 0, afterCheckBox); executionFilterPanel.setWidget(1, 1, afterDateBox); executionFilterCaptionPanel.add(executionFilterPanel); afterCheckBox.addValueChangeHandler( new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> event) { afterDateBox.setEnabled(event.getValue()); } }); beforeCheckBox.addValueChangeHandler( new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> event) { beforeDateBox.setEnabled(event.getValue()); } }); beforeDateBox.setEnabled(beforeCheckBox.getValue()); afterDateBox.setEnabled(afterCheckBox.getValue()); final String showAll = Messages.getString("showAll"); // user filter int selectedIndex = getSelectedIndex(userListBox); userListBox.clear(); userListBox.addItem(showAll); HashSet<String> uniqueUsers = new HashSet<String>(); if (jobs != null) { for (int i = 0; i < jobs.length(); i++) { uniqueUsers.add(jobs.get(i).getUserName()); } } for (String user : uniqueUsers) { userListBox.addItem(user); } userListBox.setSelectedIndex(selectedIndex); // state filter scheduleStateListBox.setVisibleItemCount(1); selectedIndex = getSelectedIndex(scheduleStateListBox); scheduleStateListBox.clear(); // NORMAL, PAUSED, COMPLETE, ERROR, BLOCKED, UNKNOWN scheduleStateListBox.addItem(showAll, ScheduleStateEnum.SHOWALL.getValue()); scheduleStateListBox.addItem(Messages.getString("normal"), ScheduleStateEnum.NORMAL.getValue()); scheduleStateListBox.addItem(Messages.getString("paused"), ScheduleStateEnum.PAUSED.getValue()); scheduleStateListBox.addItem( Messages.getString("complete"), ScheduleStateEnum.COMPLETE.getValue()); scheduleStateListBox.addItem(Messages.getString("error"), ScheduleStateEnum.ERROR.getValue()); scheduleStateListBox.addItem( Messages.getString("blocked"), ScheduleStateEnum.BLOCKED.getValue()); scheduleStateListBox.addItem( Messages.getString("unknown"), ScheduleStateEnum.UNKNOWN.getValue()); scheduleStateListBox.setSelectedIndex(selectedIndex); // state filter scheduleTypeListBox.setVisibleItemCount(1); selectedIndex = getSelectedIndex(scheduleTypeListBox); scheduleTypeListBox.clear(); // DAILY, WEEKLY, MONTHLY, YEARLY scheduleTypeListBox.addItem(showAll, ScheduleStateEnum.SHOWALL.getValue()); scheduleTypeListBox.addItem( Messages.getString("schedule.daily"), ScheduleTypeEnum.DAILY.getValue()); scheduleTypeListBox.addItem( Messages.getString("schedule.weekly"), ScheduleTypeEnum.WEEKLY.getValue()); scheduleTypeListBox.addItem( Messages.getString("schedule.monthly"), ScheduleTypeEnum.MONTHLY.getValue()); scheduleTypeListBox.addItem( Messages.getString("schedule.yearly"), ScheduleTypeEnum.YEARLY.getValue()); scheduleTypeListBox.setSelectedIndex(selectedIndex); FlexTable filterPanel = new FlexTable(); filterPanel.setWidget(0, 0, new Label(Messages.getString("scheduledResource"))); filterPanel.setWidget(1, 0, resourceSuggestBox); filterPanel.setWidget(2, 0, new Label(Messages.getString("_user"))); filterPanel.setWidget(3, 0, userListBox); filterPanel.setWidget(4, 0, new Label(Messages.getString("scheduleState"))); filterPanel.setWidget(5, 0, scheduleStateListBox); filterPanel.setWidget(6, 0, new Label(Messages.getString("scheduleType"))); filterPanel.setWidget(7, 0, scheduleTypeListBox); filterPanel.setWidget(8, 0, executionFilterCaptionPanel); setContent(filterPanel); }
private SidePanelSection createConceptGraphNodesSidePanelSection( final ResourceModel resourceModel, final VisualizationModel visualizationModel) { final VerticalPanel panel = new VerticalPanel(); final Map<String, CheckBox> ontologyToFilterBox = CollectionFactory.createStringMap(); // code below removes the "Show Mapping Nodes" checkbox under the // "Nodes" view part in the vertical panel // final CheckBox mappingNodesCheckbox = new // CheckBox("Show Mapping Nodes"); // mappingNodesCheckbox.setValue(false); // mappingNodesCheckbox // .addValueChangeHandler(new ValueChangeHandler<Boolean>() { // @Override // public void onValueChange(ValueChangeEvent<Boolean> event) { // updatePredicate(resourceModel, // mappingNodesCheckbox.getValue(), // ontologyToFilterBox); // } // }); final CheckBox colorByOntologyCheckBox = new CheckBox("Color Concept Nodes by Ontology"); colorByOntologyCheckBox.setValue(true); colorByOntologyCheckBox.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { boolean value = colorByOntologyCheckBox.getValue(); VisualItemValueResolver resolver; if (value) { resolver = NODE_COLOR_BY_ONTOLOGY_RESOLVER_FACTORY.create(); } else { resolver = NODE_BACKGROUND_COLOR_RESOLVER_FACTORY.create(); } visualizationModel.setResolver(Graph.NODE_BACKGROUND_COLOR, resolver); } }); resourceModel .getResources() .addEventHandler( new ResourceSetChangedEventHandler() { @Override public void onResourceSetChanged(ResourceSetChangedEvent event) { LightweightCollection<Resource> addedResources = event.getAddedResources(); for (Resource resource : addedResources) { if (Concept.isConcept(resource)) { String ontologyAcronym = (String) resource.getValue(Concept.ONTOLOGY_ACRONYM); if (!ontologyToFilterBox.containsKey(ontologyAcronym)) { CheckBox checkBox = new CheckBox( "<span style='color: " + BioMixerConceptByOntologyColorResolver.getColor(ontologyAcronym) + "'>▉</span>" + " " + "Show " + resource.getValue(Concept.ONTOLOGY_ACRONYM), true); checkBox.setValue(true); ontologyToFilterBox.put(ontologyAcronym, checkBox); panel.add(checkBox); checkBox.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { updatePredicate(resourceModel, false, ontologyToFilterBox); // the code below updates the // "Show Mapping Nodes" checkbox // under "Nodes" view part in the // vertical panel // updatePredicate(resourceModel, // mappingNodesCheckbox // .getValue(), // ontologyToFilterBox); } }); } } } } }); // next line commented out so the "Show Mapping Nodes" checkbox is not // added to the "Nodes" view part in the vertical panel // panel.add(mappingNodesCheckbox); panel.add(colorByOntologyCheckBox); updatePredicate(resourceModel, false, ontologyToFilterBox); return new SidePanelSection("Nodes", panel); }
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(""); } } } }); }
public void addCheckbox(String list, Boolean value) { final CheckBox checkbox = new CheckBox(list); StyledFlowPanel fix = new StyledFlowPanel("fix"); checkbox.addStyleName("checkbox"); // manage checks and unchecks checkbox.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { // is the item is checked? if (event.getValue() == true && !listed.contains(checkbox.getText()) && checkbox.getText() != null && checkbox.getText().length() != 0) { // set the values listed.add(checkbox.getText()); rosterItem.setGroups(listed); // disable during processing checkbox.setEnabled(false); // show task final DefaultTaskInfo task = new DefaultTaskInfo("Adding person to the list", false); TaskMonitor.getInstance().addTask(task); // save new state rosterItem.save( new RequestCallback<RosterItem>() { @Override public void onFailure() { // return to original state and notify user checkbox.setEnabled(true); checkbox.setValue(true); task.complete("Could not add person to list.", Status.failure); } @Override public void onSuccess(RosterItem result) { // enable the checkbox again checkbox.setEnabled(true); task.complete("", Status.succes); } }); } else if (event.getValue() == false && listed.contains(checkbox.getText())) { // set the values listed.remove(checkbox.getText()); rosterItem.setGroups(listed); // disable during processing checkbox.setEnabled(false); // show task final DefaultTaskInfo task = new DefaultTaskInfo("Removing person from the list", false); TaskMonitor.getInstance().addTask(task); // save new state rosterItem.save( new RequestCallback<RosterItem>() { @Override public void onFailure() { // return to original state and notify user checkbox.setEnabled(true); checkbox.setValue(true); task.complete("Could not remove person from the list.", Status.failure); } @Override public void onSuccess(RosterItem result) { // enable the checkbox again checkbox.setEnabled(true); task.complete("", Status.succes); } }); } } }); // if this person is already on the list make sure the checkbox is // checked if (listed != null && list.length() > 0 && listed.contains(list)) { checkbox.setValue(true); } else if (value == true) { // if a new checkbox is added automatically check it and fire a // change event checkbox.setValue(true); checkbox.fireEvent(new ValueChangeEvent<Boolean>(true) {}); } if (checkbox.getText() != null && checkbox.getText().length() != 0) { wrapper.add(checkbox); wrapper.add(fix); } }
Widget asWidget() { breadcrumb = new HorizontalPanel(); VerticalPanel panel = new VerticalPanel(); panel.setStyleName("fill-layout-width"); panel.getElement().setAttribute("style", "padding:10px"); // ---- fileSystem = new DefaultCellTable<Entry>(30); fileSystemProvider = new ListDataProvider<Entry>(); fileSystemProvider.addDataDisplay(fileSystem); TextColumn<Entry> entryCol = new TextColumn<Entry>() { @Override public String getValue(Entry entry) { return entry.getName(); } }; fileSystem.addColumn(entryCol); fileSystem.getElement().setAttribute("style", "margin-bottom:10px;"); panel.add(breadcrumb); panel.add(fileSystem); // -- Button visualize = new NavButton( "Visualize", new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.onVisualize(); } }); panel.add(visualize); Button reify = new NavButton( "Reify", new ClickHandler() { @Override public void onClick(ClickEvent event) { Entry dialog = fsSelection.getSelectedObject(); presenter.onReify(dialog.getName()); } }); panel.add(reify); Button activate = new NavButton( "Activate", new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.onActivate(); } }); panel.add(activate); Button reset = new NavButton( "Reset", new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.onResetDialog(); } }); panel.add(reset); Button passivate = new NavButton( "Passivate", new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.onPassivate(); } }); panel.add(passivate); CheckBox cacheDisabled = new CheckBox("Disable Cache"); cacheDisabled.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { presenter.setDisableCache(event.getValue()); } }); cacheDisabled.setValue(true); panel.add(cacheDisabled); // ---- fsSelection = new SingleSelectionModel<Entry>(); fileSystem.setSelectionModel(fsSelection); fsSelection.addSelectionChangeHandler( new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { Entry selection = fsSelection.getSelectedObject(); if (selection != null) { if (Entry.Type.DIR == selection.getType()) { // directories Entry dir = history.peek(); presenter.loadDir( new Entry(dir.getName() + selection.getName(), Entry.Type.DIR), false); } else { // files presenter.loadFile(selection); } } } }); return panel; }
private static <T extends IsIndexed> void updateFacetPanels( final AsyncTableCell<T, ?> list, final Map<String, FlowPanel> facetPanels, final List<FacetFieldResult> facetResults, final boolean hideDisabled) { for (FacetFieldResult facetResult : facetResults) { final String facetField = facetResult.getField(); FlowPanel facetPanel = facetPanels.get(facetResult.getField()); if (facetPanel != null) { facetPanel.clear(); if (facetResult.getTotalCount() == 0) { facetPanel.getParent().addStyleName("facet-empty"); } else { facetPanel.getParent().removeStyleName("facet-empty"); } for (FacetValue facetValue : facetResult.getValues()) { final String value = facetValue.getValue(); final String label = facetValue.getLabel(); long count = facetValue.getCount(); boolean selected = facetResult.getSelectedValues().contains(value); StringBuilder checkboxLabel = new StringBuilder(); checkboxLabel.append(label); if (count > 0 || facetResult.getSelectedValues().size() == 0 || selected) { checkboxLabel.append(" (").append(count).append(")"); } CheckBox facetValuePanel = new CheckBox(checkboxLabel.toString()); facetValuePanel.setTitle(checkboxLabel.toString()); facetValuePanel.addStyleName("sidebar-facet-label"); facetValuePanel.addStyleName("fade-out"); boolean enabled = count > 0 || facetResult.getSelectedValues().size() > 0; facetValuePanel.setEnabled(enabled); if (hideDisabled) { facetValuePanel.setVisible(enabled); } facetPanel.add(facetValuePanel); facetValuePanel.setValue(selected); facetValuePanel.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { Facets facets = list.getFacets(); FacetParameter selectedFacetParameter = facets.getParameters().get(facetField); if (selectedFacetParameter != null) { if (event.getValue()) { selectedFacetParameter.getValues().add(value); } else { selectedFacetParameter.getValues().remove(value); } } else { LOGGER.warn("Haven't found the facet parameter: " + facetField); } list.setFacets(facets); } }); } } else { LOGGER.warn("Got a facet but haven't got a panel for it"); } } }