private Widget addWidget(AddRecord recordTable) { Widget widget = new Widget(); if (recordTable.getFieldType().equals(SQL_TYPE_STRING)) { widget = new TextBox(); if (recordTable.getFieldType() != null) { ((TextBox) widget).setValue(recordTable.getFieldValue()); ((TextBox) widget).setEnabled(recordTable.isEditable()); } } else if (recordTable.getFieldType().equals(SQL_TYPE_DATE)) { widget = new DateBox(); ((DateBox) widget).setEnabled(recordTable.isEditable()); } else if (recordTable.getFieldType().equals(SQL_TYPE_LIST_STRING)) { final ListBox listBox = new ListBox(); listBox.setEnabled(recordTable.isEditable()); for (RefRecord rec : recordTable.getListRefRecord()) { listBox.addItem(rec.getValue(), String.valueOf(rec.getKey())); } widget = listBox; } else { widget = new TextBox(); if (recordTable.getFieldValue() != null) { ((TextBox) widget).setValue(recordTable.getFieldValue()); ((TextBox) widget).setEnabled(recordTable.isEditable()); } } return widget; }
public void onClick(ClickEvent event) { Widget source = (Widget) event.getSource(); if (source == btnSubmit) { if (currentUser != null) { txtLogin.setValue(currentUser.getUsername()); txtProject.setValue(lbProjects.getItemText(lbProjects.getSelectedIndex())); form.submit(); } } if (source == hlBack) { if (currentUser.getUsertype().equalsIgnoreCase("user")) { History.newItem("userJobList"); } else { if (tab == 0) { History.newItem("adminJobList"); } else { History.newItem("jobList"); } // AdminPage adminPage = new AdminPage(tab); // RootPanel.get("content").add(adminPage); } /*UserHistory userHistory = new UserHistory(); userHistory.history();*/ } }
@Override public void setValue( final LabelledFrame<NamedIndividualFrame> frame, HasEntityDataProvider entityDataProvider) { editedFrame = frame.getFrame(); displayNameField.setValue(frame.getDisplayName()); iriField.setValue(editedFrame.getSubject().getIRI().toString()); assertions.setValue(editedFrame.getPropertyValueList()); setDirty(false, EventStrategy.DO_NOT_FIRE_EVENTS); List<OWLPrimitiveData> dataList = new ArrayList<OWLPrimitiveData>(); for (OWLClass cls : editedFrame.getClasses()) { final Optional<OWLEntityData> rendering = entityDataProvider.getEntityData(cls); if (rendering.isPresent()) { dataList.add(rendering.get()); } } OWLPrimitiveDataList list = new OWLPrimitiveDataList(dataList); types.setValue(list); List<OWLPrimitiveData> sameAsList = new ArrayList<OWLPrimitiveData>(); for (OWLNamedIndividual individual : editedFrame.getSameIndividuals()) { Optional<OWLEntityData> individualRendering = entityDataProvider.getEntityData(individual); if (individualRendering.isPresent()) { sameAsList.add(individualRendering.get()); } } sameAs.setValue(new OWLPrimitiveDataList(sameAsList)); }
/** @param value */ public void setUnformattedValue(Object value, boolean fireEnvents) { if (this.formatter != null) { textBox.setValue(this.formatter.format(value), fireEnvents); } else { textBox.setValue(value != null ? value.toString() : "", fireEnvents); } }
private void updateTotals() { if (MGWT.getFormFactor().isDesktop()) { txtBudget.setValue(getAmountFormat().format(project.budgeted().getTotal())); txtActual.setValue(getAmountFormat().format(project.actual().getTotal())); txtPaid.setValue(getAmountFormat().format(project.paid().getTotal())); txtBalance.setValue(getAmountFormat().format(project.balance().getTotal())); txtPercent.setValue(getPercentFormat().format(project.percent())); } }
public EditProblemInterview(JSONObject interview) { this.setSpacing(20); this.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); String companyUniqueID = ConvertJson.convertToString(interview.get("company")); if (companyUniqueID == null) { companyUniqueID = ConvertJson.convertToString(UniqueIDGlobalVariables.companyUniqueID.get("ID")); ConvertJson.setStringValue(interview, companyUniqueID, "company"); } String interviewerUniqueID = ConvertJson.convertToString(interview.get("interviewer")); if (interviewerUniqueID == null && UniqueIDGlobalVariables.uniqueID != null) { interviewerUniqueID = ConvertJson.convertToString(UniqueIDGlobalVariables.uniqueID.get("ID")); ConvertJson.setStringValue(interview, interviewerUniqueID, "interviewer"); } this.add(FormField.getStringField("Interviewer", interviewerUniqueID)); String date = ConvertJson.convertToString(interview.get("datetime")); if (date == null) { dateTime.setValue(new Date()); } else { dateTime.setValue(new Date(new Long(date))); } this.add(FormField.getFormField("<font color=red>*</font> Date", dateTime)); String problem = ConvertJson.convertToString(interview.get("problem")); problemField = new ProblemsListbox(problem); this.add(FormField.getFormField("<font color=red>*</font> Problem", problemField)); String customerName = ConvertJson.convertToString(interview.get("customerName")); customerNameField.setValue(customerName); this.add(FormField.getFormField("<font color=red>*</font> Customer Name", customerNameField)); String customerUniqueID = ConvertJson.convertToString(interview.get("customerUniqueID")); customerUniqueIDField.setValue(customerUniqueID); this.add(FormField.getFormField("Customer UniqueID", customerUniqueIDField)); String videoURLValue = ConvertJson.convertToString(interview.get("videoURL")); videoURLField.setValue(videoURLValue); this.add(FormField.getFormField("Video URL", videoURLField)); videoURLField.setWidth("300px"); String notesValue = ConvertJson.convertToString(interview.get("notes")); notes.setHTML(notesValue); this.add(FormField.getFormField("Notes", notes)); notes.setSize("300px", "100px"); }
@Override public void resetFilterWidgets() { castb_patient_identifiantBox.setValue(null); castb_patient_nomBox.setValue(null); dateExamenBeforeBox.setValue(null); dateExamenAfterBox.setValue(null); raisonDepistageBox.setSelectedIndex(0); resultatBox.setValue(null); deletedEntityBox.setValue(false); }
public void setValue(Object value) { if (this.formatter != null) { try { textBox.setValue(this.formatter.format(value)); } catch (Exception e) { if (clearIfNotValid) { textBox.setValue(null); } } } else { textBox.setValue(value.toString()); } }
public PermissionsPanel(final JSONObject entityJsonObject) { // this.center(); this.setAutoHideEnabled(true); VerticalPanel vp = new VerticalPanel(); vp.setSpacing(30); vp.setWidth("300px"); vp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); vp.add(new CloseButton(this)); vp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); vp.add(new Label("Permissions to Edit this information:")); vp.add(listPermissions(entityJsonObject)); permissionName.setValue(null); permissionName.setWidth("200px"); vp.add(permissionName); vp.add(new ButtonAddPermission(entityJsonObject, this)); this.setWidget(vp); }
// Start editing the cell @Override protected void startEditing(final Context context, final Element parent, final Byte value) { textBox.setValue((value == null ? "" : value.toString())); panel.setPopupPositionAndShow( new PositionCallback() { public void setPosition(int offsetWidth, int offsetHeight) { panel.setPopupPosition( parent.getAbsoluteLeft() + offsetX, parent.getAbsoluteTop() + offsetY); // Focus the first enabled control Scheduler.get() .scheduleDeferred( new ScheduledCommand() { public void execute() { String text = textBox.getValue(); textBox.setFocus(true); textBox.setCursorPos(text.length()); textBox.setSelectionRange(0, text.length()); } }); } }); }
@Override public void setValue(Number number) { toggleExpressionInput(textBox, false); if (number.longValue() >= 0 || allowNegativeNumber) { textBox.setValue(String.valueOf(number)); } }
@Override public void setExpressionValue(String expr) { this.expressionValue = expr; if (expressionValue != null) { toggleExpressionInput(textBox, true); textBox.setValue(expressionValue); } }
@Override public void onFocus(FocusEvent event) { if (name.getValue().equals(defaultValue)) { name.setValue(""); name.removeStyleName(style.nameDefaultText()); } else { name.removeStyleName(style.nameDefaultText()); } }
@Override public void onBlur(BlurEvent event) { if (name.getValue().equals("")) { name.setValue(defaultValue); name.addStyleName(style.nameDefaultText()); } else { name.removeStyleName(style.nameDefaultText()); } }
public void activateSavedSearch(SavedSearch savedSearch) { currentSearchId = savedSearch.getId(); autoCompletePatternField.setValue(savedSearch.getPattern(), true); patternNameField.setValue(savedSearch.getName(), true); Log.debug( "search results change: [" + savedSearch.getName() + "," + savedSearch.getPattern() + "]"); turnNameFieldIntoLabel(); savedSearchesPanel.hide(); click(searchButton); }
/** * @see com.alkacon.geranium.client.ui.input.I_HasGhostValue#setGhostValue(java.lang.String, * boolean) */ public void setGhostValue(String value, boolean ghostMode) { m_ghostValue = value; if (!ghostMode) { return; } m_textbox.setValue(value); setGhostMode(true); setGhostStyleEnabled(true); }
@Override public void populate(FBValidation validation) throws FormBuilderException { if (!(validation instanceof EqualToValidation)) { throw new FormBuilderException( i18n.RepNotOfType(validation.getClass().getName(), "EqualToValidation")); } TextBox valueTextBox = new TextBox(); if (validation.getDataMap().get("value") != null) { valueTextBox.setValue(validation.getDataMap().get("value").toString()); } super.getPropertiesMap().put("value", valueTextBox); }
@Override public void setCollectionData( String collectionTitle, String collectionId, String collectionImageUrl) { collectionTitleInCoverPage.setValue(collectionTitle); this.collectionGooruOid = collectionId; this.thumbnailUrl = collectionImageUrl; // setCollectionThumbnail(); getAddErrorLabel().setVisible(false); getAddingLabel().setVisible(false); getCollectionTitleInCoverPage().setVisible(true); showCollectionAddImageWidget(); }
/** * @see com.alkacon.geranium.client.ui.input.I_FormWidget#setFormValueAsString(java.lang.String) */ public void setFormValueAsString(String newValue) { if (newValue == null) { newValue = ""; } if ("".equals(newValue) && (m_ghostValue != null)) { m_ghostMode = true; setGhostStyleEnabled(true); m_textbox.setValue(m_ghostValue); } else { setFormValue(newValue); } }
@Override public void setNewVariable(VariableDto variableDto) { // Set the entity type (not displayed) entityType = variableDto.getEntityType(); // Set the UI fields. variableName.setValue(variableDto.getName()); setValueType(variableDto); repeatableCheckbox.setValue(variableDto.getIsRepeatable()); setOccurrenceGroup(variableDto); setUnit(variableDto); setMimeType(variableDto); }
/** Clear the chip items on the autocomplete box */ public void clear() { itemBox.setValue(""); Collection<MaterialChip> values = suggestionMap.values(); for (MaterialChip chip : values) { Widget parent = chip.getParent(); if (parent instanceof ListItem) { parent.removeFromParent(); } } suggestionMap.clear(); clearErrorOrSuccess(); }
@UiHandler("projectName") void onProjectNameChanged(KeyUpEvent event) { String projectNameValue = projectName.getValue(); if (projectNameValue != null && projectNameValue.contains(" ")) { projectNameValue = projectNameValue.replace(" ", "-"); projectName.setValue(projectNameValue); } if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { return; } delegate.projectNameChanged(projectName.getValue()); }
/** Run the query and load the map */ public void runQuery() { String query = queryTextBox.getValue(); if (isValidQuery(query)) { LatLng latlng = parseLatLng(query); if (latlng == null) { queryTextBox.setValue(""); } else { Geocoder geocoder = new Geocoder(); latlng = parseLatLng(latlng.toUrlValue(6)); if (latlng != null) initMap(map.getElement(), latlng); else initMap(map.getElement(), LatLng.newInstance(0.0, 0.0)); geocoder.getLocations( query, new LocationCallback() { @Override public void onFailure(int statusCode) { // Window.alert("failed"); Document.get().getElementById("responseCount").getStyle().setDisplay(Display.NONE); Document.get().getElementById("matches").getStyle().setDisplay(Display.NONE); } @Override public void onSuccess(JsArray<Placemark> locations) { responseGeocode(locations, true); } }); } } else { initMap(map.getElement(), LatLng.newInstance(0.0, 0.0)); Geocoder geocoder = new Geocoder(); // map.setUIToDefault(); geocoder.getLocations( query, new LocationCallback() { @Override public void onFailure(int statusCode) { // Window.alert("failed"); Document.get().getElementById("responseCount").getStyle().setDisplay(Display.NONE); Document.get().getElementById("matches").getStyle().setDisplay(Display.NONE); } @Override public void onSuccess(JsArray<Placemark> locations) { responseGeocode(locations, false); } }); } }
/** @see com.google.gwt.user.client.ui.HasValue#setValue(java.lang.Object, boolean) */ @Override public void setValue(TaskInboxFilterBean value, boolean fireEvents) { if (value.getOwner() == TaskOwnerEnum.any) { ownerAny.setValue(true); } else if (value.getOwner() == TaskOwnerEnum.mine) { ownerMine.setValue(true); } else if (value.getOwner() == TaskOwnerEnum.active) { ownerActive.setValue(true); } else if (value.getOwner() == TaskOwnerEnum.group) { ownerGroup.setValue(true); } priority.setValue( value.getPriority() == -1 ? "" : String.valueOf(value.getPriority())); // $NON-NLS-1$ dateDueFrom.setDateValue(value.getDateDueFrom() == null ? null : value.getDateDueFrom()); dateDueTo.setDateValue(value.getDateDueTo() == null ? null : value.getDateDueTo()); TaskInboxFilterBean oldState = this.currentState; currentState = value; if (fireEvents) { ValueChangeEvent.fireIfNotEqual(this, oldState, currentState); } }
@Override public void clear() { rewardsName.setTitle(""); /* 增加请选择下拉选项 */ // rewardsType.setSelectedIndex(0); rewardsDefinition.setText(""); standard.setText(""); startTime.setValue(null); peopleSizeLimit.setValue(""); frequency = null; settingText.setText(""); autoCbx.setValue(false, true); specialCbx.setValue(false, true); birthRadio.setValue(false, true); // nextPublicTime.setValue(null); nextRewardsTime.setValue(null); // lastRewardsTime.setText(""); // 清空设定规则为为设定 // setIsAmountLevel("未设定"); }
@Override public void emptyValueFields() { value.setValue(null); newValue.setValue(null); }
public void showRewardsItem(RewardsItemClient rewardsItem, boolean isItemStore) { if (rewardsItem.getFrequency() != null) { // 显示出下次颁奖时间 nextRewardsTime .getElement() .getParentElement() .getParentElement() .removeClassName(CssStyleConstants.hidden); // 把开始时间设成只读 // startTime.setEnabled(false); } if (isItemStore == false) { // 维护按钮的状态 saveStore.setVisible(false); backStore.setVisible(false); save.setVisible(true); back.setVisible(true); } else { backStore.setVisible(true); saveStore.setVisible(true); save.setVisible(false); back.setVisible(false); } rewardsName.setText(rewardsItem.getName()); rewardsDefinition.setText(rewardsItem.getDefinition()); standard.setText(rewardsItem.getStandard()); rewardsUnit = rewardsItem.getRewardsUnit(); showJudgeInfo(rewardsItem); // 显示要修改的提名人 startTime.setValue(rewardsItem.getStartTime()); nextRewardsTime.setValue(rewardsItem.getNextTime()); nextPublicTime.setValue(rewardsItem.getNextPublishTime()); peopleSizeLimit.setValue(StringUtil.valueOf(rewardsItem.getSizeLimit())); rewardsFrom.setValue(StringUtil.valueOf(rewardsItem.getRewardsFrom())); tmday.setValue(StringUtil.valueOf(rewardsItem.getTmdays())); tmdays.setValue(StringUtil.valueOf(rewardsItem.getTmdays())); totalJF.setValue(StringUtil.valueOf(rewardsItem.getTotalJF())); expectTime.setValue(rewardsItem.getNextTime()); nextPublicTime.setValue(rewardsItem.getNextPublishTime()); showFrequencyInfo(rewardsItem.getFrequency()); autoCbx.setValue(rewardsItem.isAuto(), true); if (rewardsItem.isAuto() == false) // 隐藏提名 chooseBtns .getElement() .getParentElement() .getParentElement() .removeClassName(CssStyleConstants.hidden); else chooseBtns .getElement() .getParentElement() .getParentElement() .addClassName(CssStyleConstants.hidden); specialCbx.setValue(rewardsItem.isHasSpecialCondition(), true); if (SpecialCondition.birth == rewardsItem.getCondition()) { birthRadio.setValue(true); } else { birthRadio.setValue(false); } if (rewardsItem.isPeriodEnable() == true) { moretimes.setValue(true, true); } else { onetimes.setValue(true, true); } }
public FunctionPlotterExample() { presets.put("id", new String[] {"-10", "10", "function(x) {\n return x;\n}"}); presets.put("sine", new String[] {"-10", "10", "function(x) {\n return Math.sin(x);\n}"}); presets.put( "taylor", new String[] { "-3", "3", "function(x) {\n return [Math.cos(x), 1 - x*x/2 + x*x*x*x/24];\n}" }); presets.put( "sawtooth", new String[] { "-10", "10", "function(x) {\n var y = 0;\n for (var i = 1; i < 20; i+=2) {\n y += Math.sin(i * x)/i;\n }\n var final = 1 - 2*(Math.abs(Math.floor(x / Math.PI)) % 2);\n return [4/Math.PI * y, final];\n}" }); initWidget(panel); panel.add(new HTML("<p><b>Equation: </b><br>")); textArea.setVisibleLines(10); textArea.setCharacterWidth(80); textArea.setValue( "function(x) {\n" + " return [0.1 * x, 0.1 * x + Math.sin(x), 0.1*x + Math.cos(x)];\n" + "}"); panel.add(textArea); presetsDD.addItem("(custom)", "custom"); presetsDD.addItem("Identity", "id"); presetsDD.addItem("Sine Wave", "sine"); presetsDD.addItem("Taylor series", "taylor"); presetsDD.addItem("Sawtooth", "sawtooth"); presetsDD.setSelectedIndex(0); presetsDD.getElement().getStyle().setDisplay(Style.Display.INLINE_BLOCK); presetsDD.addChangeHandler( (event) -> { String value = presetsDD.getSelectedValue(); if (value.equalsIgnoreCase("custom")) { return; } String[] preset = presets.get(value); fromTb.setValue(preset[0]); toTb.setValue(preset[1]); textArea.setValue(preset[2]); plot(); }); HorizontalPanel presetContainer = new HorizontalPanel(); presetContainer.add(new HTML("<b>Preset functions:</b>")); presetContainer.add(presetsDD); panel.add(presetContainer); panel.add(new HTML("<p></p>")); HorizontalPanel rangeContainer = new HorizontalPanel(); rangeContainer.add(new HTML("<b>x range:</b>")); fromTb.setVisibleLength(5); fromTb.setValue("-10"); toTb.setVisibleLength(5); toTb.setValue("10"); rangeContainer.add(fromTb); rangeContainer.add(new InlineLabel("to")); rangeContainer.add(toTb); panel.add(rangeContainer); Button plotBtn = new Button("Plot"); plotBtn.addClickHandler((ev) -> plot()); panel.add(new HTML("<p></p>")); panel.add(plotBtn); plot(); }
@Override public void resetMetaData() { super.resetMetaData(); textBox.setValue(null); }
private Widget getEditorWidget(final RuleAttribute at, final int idx, final boolean isReadOnly) { Widget editor = null; final String attributeName = at.getAttributeName(); if (attributeName.equals(RULEFLOW_GROUP_ATTR) || attributeName.equals(AGENDA_GROUP_ATTR) || attributeName.equals(ACTIVATION_GROUP_ATTR) || attributeName.equals(TIMER_ATTR) || attributeName.equals(CALENDARS_ATTR)) { final TextBox tb = TextBoxFactory.getTextBox(DataType.TYPE_STRING); tb.setValue(at.getValue()); tb.setEnabled(!isReadOnly); if (!isReadOnly) { tb.addValueChangeHandler( new ValueChangeHandler<String>() { public void onValueChange(ValueChangeEvent<String> event) { at.setValue(tb.getValue()); } }); } editor = tb; } else if (attributeName.equals(SALIENCE_ATTR)) { final TextBox tb = TextBoxFactory.getTextBox(DataType.TYPE_NUMERIC_INTEGER); tb.setValue(at.getValue()); tb.setEnabled(!isReadOnly); if (!isReadOnly) { tb.addValueChangeHandler( new ValueChangeHandler<String>() { public void onValueChange(ValueChangeEvent<String> event) { at.setValue(tb.getValue()); } }); } editor = tb; } else if (attributeName.equals(DURATION_ATTR)) { final TextBox tb = TextBoxFactory.getTextBox(DataType.TYPE_NUMERIC_LONG); tb.setValue(at.getValue()); tb.setEnabled(!isReadOnly); if (!isReadOnly) { tb.addValueChangeHandler( new ValueChangeHandler<String>() { public void onValueChange(ValueChangeEvent<String> event) { at.setValue(tb.getValue()); } }); } editor = tb; } else if (attributeName.equals(NO_LOOP_ATTR) || attributeName.equals(LOCK_ON_ACTIVE_ATTR) || attributeName.equals(AUTO_FOCUS_ATTR) || attributeName.equals(ENABLED_ATTR)) { editor = checkBoxEditor(at, isReadOnly); } else if (attributeName.equals(DATE_EFFECTIVE_ATTR) || attributeName.equals(DATE_EXPIRES_ATTR)) { if (isReadOnly) { final TextBox tb = TextBoxFactory.getTextBox(DataType.TYPE_STRING); tb.setValue(at.getValue()); tb.setEnabled(false); } else { final PopupDatePicker dp = new PopupDatePicker(false); dp.setValue(at.getValue()); dp.addValueChangeHandler( new ValueChangeHandler<Date>() { public void onValueChange(ValueChangeEvent<Date> event) { at.setValue(PopupDatePicker.convertToString(event)); } }); editor = dp; } } else if (attributeName.equals(DIALECT_ATTR)) { final ListBox lb = new ListBox(); lb.addItem(DIALECTS[0]); lb.addItem(DIALECTS[1]); lb.setEnabled(!isReadOnly); if (!isReadOnly) { lb.addChangeHandler( new ChangeHandler() { @Override public void onChange(ChangeEvent event) { final int selectedIndex = lb.getSelectedIndex(); if (selectedIndex < 0) { return; } at.setValue(lb.getValue(selectedIndex)); } }); } if (at.getValue() == null || at.getValue().isEmpty()) { lb.setSelectedIndex(1); at.setValue(DIALECTS[1]); } else if (at.getValue().equals(DIALECTS[0])) { lb.setSelectedIndex(0); } else if (at.getValue().equals(DIALECTS[1])) { lb.setSelectedIndex(1); } else { lb.setSelectedIndex(1); at.setValue(DIALECTS[1]); } editor = lb; } DirtyableHorizontalPane horiz = new DirtyableHorizontalPane(); if (editor != null) { horiz.add(editor); if (!isReadOnly) { horiz.add(getRemoveIcon(idx)); } } return horiz; }