private Widget createNotesField() { noteField = new TextArea(); noteField.setPreventScrollbars(true); noteField.setFieldLabel("Notes"); return noteField; }
private final ContentPanel createPropertiesContent() { FormPanel panel = new FormPanel(); panel.setHeaderVisible(false); panel.setButtonAlign(HorizontalAlignment.RIGHT); panel.setStyleAttribute("padding", "20"); KeyListener keyListener = new KeyListener() { public void componentKeyUp(ComponentEvent event) { editor.markDirty(); } }; name = new TextField<String>(); name.setFieldLabel(constants.name()); name.setEmptyText(constants.groupName()); name.setAllowBlank(false); name.setMinLength(2); name.addKeyListener(keyListener); name.setStyleAttribute("marginTop", "5"); name.setStyleAttribute("marginBottom", "5"); panel.add(name); description = new TextArea(); description.setPreventScrollbars(true); description.setFieldLabel(constants.description()); description.addKeyListener(keyListener); description.setStyleAttribute("marginTop", "5"); description.setStyleAttribute("marginBottom", "5"); panel.add(description); return panel; }
private TextField<String> addDefinition(String definable, String definition) { TableData deleteColumn = new TableData(); deleteColumn.setWidth("20px"); deleteColumn.setVerticalAlign(VerticalAlignment.TOP); TableData defColumn = new TableData(); defColumn.setWidth(defColumnWidth); defColumn.setVerticalAlign(VerticalAlignment.TOP); TableData definitionsColumn = new TableData(); definitionsColumn.setWidth(definitionsColumnWidth); definitionsColumn.setVerticalAlign(VerticalAlignment.TOP); final TextField<String> defText = new TextField<String>(); defText.setValue(definable); defText.setWidth(defColumnWidth); final TextArea definitionText = new TextArea(); definitionText.setValue(definition); definitionText.setWidth(definitionsColumnWidth); fields.put(defText, definitionText); final Image image = new Image("images/icon-delete.png"); image.addClickListener( new ClickListener() { public void onClick(Widget sender) { WindowUtils.confirmAlert( "Delete?", "Are you sure you want to delete this definition?", new Listener<MessageBoxEvent>() { public void handleEvent(MessageBoxEvent be) { if (be.getButtonClicked().getText().equalsIgnoreCase("yes")) { remove(defText); remove(definitionText); remove(image); fields.remove(defText); } }; }); } }); add(image, deleteColumn); add(defText, defColumn); add(definitionText, definitionsColumn); return defText; }
public CommentSection(int width, int height) { getFormLayout().setLabelAlign(LabelAlign.TOP); commentField = new TextArea(); commentField.setName("comments"); commentField.setFieldLabel(I18N.CONSTANTS.comments()); if (width > 0) { getFormLayout().setDefaultWidth(width); commentField.setWidth(width); } if (height > 0) { commentField.setHeight(height); } add(commentField); }
// ------------------------------------------------------------------------------------- public void updateFileContent() { if (listFiles.getSelectedIndex() != -1) { service = (ServiceManagerWebServiceAsync) Registry.get("guiservice"); service.getFile( LeftPanelLogin.session_id, selectedComponent, listFiles.getSimpleValue(), new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { Dispatcher.forwardEvent(MainEvents.error, caught); } @Override public void onSuccess(String result) { if (result != null) { if (!result.equals(currentOutput)) { output.setValue(result); } } else { removeAll(); ((TextArea) textArea) .setValue( "Session time elapsed! Please log out, log in again and refresh the selected option"); add(textArea); layout(true); } } }); } else { output.setEmptyText("Please select a file to display."); } }
public final boolean save(XObject input) { if (input instanceof XGroup) { XGroup group = (XGroup) input; group.setName(name.getValue()); group.setDescription(description.getValue()); } return true; }
public String getNote() { String note = noteField.getValue(); if (note == null) { note = ""; } return note; }
public boolean isValid() { if (storeComboBox.isValid() && billTypeComboBox.isValid() && costField.isValid() && dateField.isValid() && noteField.isValid()) { return true; } else { return false; } }
public void set(XObject input) { if (input instanceof XGroup) { XGroup group = (XGroup) input; name.setValue(group.getName()); description.setValue(translateDescription(group.getDescription())); if (group != null && group.getName() != null && (group.getName().equals("admin") || group.getName().equals("editor") || group.getName().equals("creator") || group.getName().equals("viewer") || group.getName().equals("poweruser") || group.getName().equals("publisher"))) { name.setEnabled(false); description.setEnabled(false); } else { name.setEnabled(true); description.setEnabled(true); } } }
// ****************************************************** // Method: getPanel // // ****************************************************** private FormPanel getPanel() { FormLayout formLayout = new FormLayout(LabelAlign.LEFT); formLayout.setLabelWidth(160); FormPanel formPanel = new FormPanel(); formPanel.setHeight(350); formPanel.setLayout(formLayout); formPanel.setPadding(10); formPanel.setFrame(false); formPanel.setBorders(false); formPanel.setBodyBorder(false); formPanel.setHeaderVisible(false); FormData formData = new FormData("95%"); availableJndiNamesComboBox = new SimpleComboBox<String>(); availableJndiNamesComboBox.add("FIT_DATA_TEST"); availableJndiNamesComboBox.add("FIT_SOURCE_TEST"); availableJndiNamesComboBox.add("FIT_CONFIG_TEST"); availableJndiNamesComboBox.setAllowBlank(false); availableJndiNamesComboBox.setForceSelection(true); availableJndiNamesComboBox.setEditable(false); availableJndiNamesComboBox.setTriggerAction(TriggerAction.ALL); availableJndiNamesComboBox.setFieldLabel("Source JNDI*"); availableJndiNamesComboBox.setSimpleValue("FIT_CONFIG_TEST"); formPanel.add(availableJndiNamesComboBox, formData); sourceSqlQueryTextArea = new TextArea(); sourceSqlQueryTextArea.setFieldLabel("Sql Query*"); sourceSqlQueryTextArea.setAllowBlank(false); formPanel.add(sourceSqlQueryTextArea, new FormData(314, 200)); setupRulesCheckBox = new CheckBox(); setupRulesCheckBox.setFieldLabel("Setup Rules?"); setupRulesCheckBox.setBoxLabel(""); formPanel.add(setupRulesCheckBox, formData); return formPanel; }
@Override protected void onRender(Element parent, int pos) { super.onRender(parent, pos); tfTitle.setFieldLabel("Title"); tfTitle.setAllowBlank(false); tfTitle.getMessages().setBlankText("Title is required"); taDescription.setFieldLabel("Description"); taDescription.setAllowBlank(false); taDescription.getMessages().setBlankText("Description is required"); tfLink.setFieldLabel("Link"); tfLink.setAllowBlank(false); tfLink.setRegex("^http\\://[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(/\\S*)?$"); tfLink.getMessages().setBlankText("Link is required"); tfLink .getMessages() .setRegexText("The link field must be a URL e.g. http://www.example.com/rss.xml"); add(tfTitle); add(taDescription); add(tfLink); }
public void save(final Feed feed) { feed.setTitle(tfTitle.getValue()); feed.setDescription(taDescription.getValue()); feed.setLink(tfLink.getValue()); final FeedServiceAsync feedService = Registry.get(RSSReaderConstants.FEED_SERVICE); feedService.saveFeed( feed, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Info.display("RSS Reader", "Failed to save feed: " + feed.getTitle()); } @Override public void onSuccess(Void result) { Info.display("RSS Reader", "Feed " + feed.getTitle() + " saved sucessfully"); final ListStore<BeanModel> feedStore = Registry.get(RSSReaderConstants.FEED_STORE); BeanModelFactory beanModelFactory = BeanModelLookup.get().getFactory(feed.getClass()); feedStore.add(beanModelFactory.createModel(feed)); } }); }
@Override public Widget asWidget() { // show window window.setSize(400, 310); window.setPlain(true); window.setModal(true); window.setClosable(false); window.setResizable(false); window.setHeading(AppController.Lang.AddNew(AppController.Lang.RunValue().toLowerCase())); window.setLayout(new FitLayout()); // form final FormData formData = new FormData("-20"); FormPanel simple = new FormPanel(); simple.setHeaderVisible(false); simple.setFrame(true); simple.setAutoWidth(true); simple.setLabelWidth(100); // run cbName.setDisplayField("n"); cbName.setFieldLabel(AppController.Lang.Run()); cbName.setStore(storeName); cbName.setEnabled(false); cbName.setMinLength(Constants.LIMIT_NAME_MIN); cbName.setMaxLength(Constants.LIMIT_NAME_MAX); cbName.setAllowBlank(false); cbName.setTriggerAction(TriggerAction.ALL); simple.add(cbName, formData); // date final DateField tfDate = CommonUtils.getDateField(date); simple.add(tfDate, formData); // time final TimeSelectFieldView tfTime = new TimeSelectFieldView(0, null); tfTime.setFieldLabel(AppController.Lang.Time()); simple.add(tfTime); // duration final MySpinnerField tfDuration = CommonUtils.getDurationSpinner(); simple.add(tfDuration, formData); // pulse final SpinnerField tfPulse = CommonUtils.getPulseSpinner(); simple.add(tfPulse, formData); // pulse max final SpinnerField tfPulseMax = CommonUtils.getPulseSpinner(); tfPulseMax.setFieldLabel(AppController.Lang.MaxPulse()); simple.add(tfPulseMax, formData); // calories final SpinnerField tfCalories = CommonUtils.getCaloriesSpinner(); simple.add(tfCalories, formData); // info final TextArea tfInfo = new TextArea(); tfInfo.setPreventScrollbars(true); tfInfo.setFieldLabel(AppController.Lang.Info()); simple.add(tfInfo, formData); // buttons eventhandler Button btnAdd = new Button(AppController.Lang.Add()); btnAdd.setScale(ButtonScale.MEDIUM); btnAdd.addSelectionListener( new SelectionListener<ButtonEvent>() { @SuppressWarnings("deprecation") @Override public void componentSelected(ButtonEvent ce) { try { // return model if (handler != null) { final int pulse = (int) tfPulse.getValue().doubleValue(); final int pulseMax = (int) tfPulseMax.getValue().doubleValue(); final int calories = (int) tfCalories.getValue().doubleValue(); // date and time Date date = tfDate.getValue(); final double time = CommonUtils.getTimeToSeconds(tfTime.getValue()); date.setHours((int) (time / 3600)); date.setMinutes((int) ((time % 3600) / 60)); date = CommonUtils.trimDateToDatabase(date, false); final String info = tfInfo.getValue(); final long duration = tfDuration.getValue().intValue(); RunValueModel value = new RunValueModel(); value.setCalories(calories); value.setDate(date); value.setDuration(duration); value.setInfo(info); value.setPulse(pulse); value.setPulseMax(pulseMax); // get run RunModel run = null; // if no values if (cbName.getValue() == null) { final String str = cbName.getRawValue(); run = new RunModel(0L, str); } // if user typed new value else if (!cbName.getRawValue().equals(cbName.getValue().getNameClient())) { final String str = cbName.getRawValue(); run = new RunModel(0L, str); } // value selected from list else { run = cbName.getValue(); } handler.newValue(run, value); } } catch (Exception e) { Motiver.showException(e); } } }); simple.addButton(btnAdd); Button btnCancel = new Button(AppController.Lang.Cancel()); btnCancel.setScale(ButtonScale.MEDIUM); // hide window btnCancel.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { handler.cancel(); } }); simple.addButton(btnCancel); simple.setButtonAlign(HorizontalAlignment.CENTER); FormButtonBinding binding = new FormButtonBinding(simple); binding.addButton(btnAdd); window.add(simple); window.show(); return this; }
@Override public void updateForm(SiteDTO m) { commentField.setValue(m.getComments()); }
@Override public void updateModel(SiteDTO m) { m.setComments(commentField.getValue()); }
@SuppressWarnings("unchecked") public static boolean handleFormException(FormPanel form, Throwable caught) { boolean isWarning = false; if (caught instanceof GwtKuraException) { List<Field<?>> fields = form.getFields(); GwtKuraException gee = (GwtKuraException) caught; GwtKuraErrorCode code = gee.getCode(); switch (code) { case DUPLICATE_NAME: boolean fieldFound = false; String duplicateFieldName = gee.getArguments()[0]; for (Field<?> field : fields) { if (duplicateFieldName.equals(field.getName())) { TextField<String> textField = (TextField<String>) field; textField.markInvalid(MSGS.duplicateValue()); fieldFound = true; break; } } if (!fieldFound) { Info.display(CMSGS.error(), caught.getLocalizedMessage()); } break; case ILLEGAL_NULL_ARGUMENT: String invalidFieldName = gee.getArguments()[0]; for (Field<?> field : fields) { if (invalidFieldName.equals(field.getName())) { TextField<String> textField = (TextField<String>) field; textField.markInvalid(MSGS.invalidNullValue()); break; } } break; case ILLEGAL_ARGUMENT: String invalidFieldName1 = gee.getArguments()[0]; for (Field<?> field : fields) { if (invalidFieldName1.equals(field.getName())) { TextField<String> textField = (TextField<String>) field; textField.markInvalid(gee.getCause().getMessage()); break; } } break; case INVALID_RULE_QUERY: for (Field<?> field : fields) { if ("query".equals(field.getName())) { TextArea statement = (TextArea) field; statement.markInvalid(caught.getLocalizedMessage()); break; } } break; case WARNING: isWarning = true; Info.display(CMSGS.warning(), caught.getLocalizedMessage()); break; default: Info.display(CMSGS.error(), caught.getLocalizedMessage()); caught.printStackTrace(); break; } } else { Info.display(CMSGS.error(), caught.getLocalizedMessage()); caught.printStackTrace(); } return isWarning; }
LayoutContainer initProButtons() { TableLayout tl = new TableLayout(2); lc.setLayout(tl); TableData td1 = new TableData(); td1.setColspan(1); TableData td2 = new TableData(); td2.setColspan(2); bsd_add = new BcodeSelectDialog<TreeNodeModelData>() { public void doposted(List<TreeNodeModelData> modeldatalist) { if (modeldatalist.size() > 0) { this.setEmptyText("已经选择了数据"); List<TreeNodeModelData> selectchecklist = bsd_add.getTree().getCheckedSelection(); if (selectchecklist.size() <= 0) { MessageBox.alert("错误", "请选择“离职人员”", null); return; } String bcodestr = ""; for (TreeNodeModelData tnmd : selectchecklist) { BusiObject bo = new BusiObject(); bcodestr += " systembcode like '" + tnmd.get("systembcode") + "%25' or "; } bcodestr += " 1=2"; GWT.log("bcodestr =" + bcodestr); String sql = "select icode, bcode,employstatus,leavereason,leavemark,Resignationdate from bcode_job where exists (select * from systembcode_view where systembcode_view.bcode = bcode_job.bcode and ( " + bcodestr + "))"; GWT.log("sql =" + sql); store.getStoreinfo().setSql(sql); store.reload(); } } }; bsd_add.setNeesreselect(false); bsd_add.setEmptyText("未选择数据"); bsd_add.setExpanded(); bsd_add.setCheckNodes(CheckNodes.BOTH); Resignationdate = new DateField(); Resignationdate.getPropertyEditor().setFormat(DateTimeFormat.getFormat("yyyy-MM-dd")); save.addListener(Events.OnClick, getListener()); lc.add(new LabelField("选择人员:"), td1); lc.add(bsd_add, td1); lc.add(new LabelField("状态改变为:"), td1); lc.add(C_num8, td1); lc.add(leavereason_l, td1); lc.add(C_num9, td1); lc.add(resignationdate_l, td1); lc.add(Resignationdate, td1); lc.add(mark_l, td1); lc.add(mark_t, td1); leavereason_l.setVisible(false); C_num9.setVisible(false); mark_l.setVisible(false); mark_t.setVisible(false); resignationdate_l.setVisible(false); Resignationdate.setVisible(false); lc.add(save, td2); bsd_add.addListener(Events.Changed, getListener()); C_num8.addListener(Events.Changed, getListener()); C_num9.addListener(Events.Changed, getListener()); mark_t.addListener(Events.Changed, getListener()); Resignationdate.addListener(Events.Changed, getListener()); return lc; }
/** * 主窗口 */ void initmainpanel() { w = new BaseFormPanel(getStore()); w.setHeaderVisible(false); Label cardno_l = new Label("卡号:"); cardno_l.setWidth("50"); Label cname_l = new Label("名字:"); cname_l.setWidth("50"); Label sex_l = new Label("性别:"); sex_l.setWidth("50"); Label edu_l = new Label("学历:"); Label bird_l = new Label("出生日期:"); Label mobil_l = new Label("手机号:"); Label idno_l = new Label("身份证号:"); Label mark_l = new Label("备注:"); cardno_t = new TextField<String>(); cardno_t.setAllowBlank(false); cardno_t.addListener(Events.Change, this); cname_t = new TextField<String>(); cname_t.setAllowBlank(false); // passwordc_t.setAllowBlank(false); // password_t.setAllowBlank(false); // // TextField<String> sex_t = new TextField<String>(); // BaseGridEditor sex_t= CodeNameMapFactory.aa(); BaseComboBoxForm<BaseModelData> sex_t = CodeNameMapFactory.createSexInput_F(); TextField<String> edu_t = new TextField<String>(); // CodeNameMapFactory codenamemap = new CodeNameMapFactory(); // BaseGridEditor<String> edu_t =codenamemap.createSexInput_G(); // createBocdeInput_F DateField bird_t = new DateField(); bird_t.setAutoWidth(true); bird_t.getPropertyEditor().setFormat(DateTimeFormat.getFormat("yyyy-M-d H:mm:ss")); TextField<String> mobil_t = new TextField<String>(); mobil_t.setAllowBlank(false); TextField<String> idno_t = new TextField<String>(); TextArea mark_t = new TextArea(); mark_t.setSize(420, 40); // TextField<String> password_t = new TextField<String>(); password_t.setPassword(true); passwordc_t.setPassword(true); // password_t.setToolTip("将光标放到此处,并由会员录入自己的密码"); ccode_t = new TextField<String>(); // ccode_t.setEnabled(false); ccode_t.setVisible(false); icode_t = new TextField<String>(); icode_t.setVisible(false); cardno_t.setName("s_cardno"); cname_t.setName("cname"); password_t.setName("password"); sex_t.setName("s_sex"); edu_t.setName("s_edu"); bird_t.setName("s_birid"); mobil_t.setName("s_mobil"); idno_t.setName("s_idno"); mark_t.setName("s_mark"); ccode_t.setName("ccode"); icode_t.setName("icode"); // password_t.setName("password"); TableLayout tl = new TableLayout(4); tl.setWidth("600"); w.setLayout(tl); TableData td = new TableData(); td.setColspan(1); // td.setWidth("2000"); td.setMargin(100); td.setPadding(5); td.setRowspan(1); TableData td2 = new TableData(); td2.setColspan(3); // td.setWidth("2000"); td2.setMargin(100); td2.setPadding(5); td2.setRowspan(1); w.add(cardno_l, td); w.add(cardno_t, td); w.add(cname_l, td); w.add(cname_t, td); w.add(mobil_l, td); w.add(mobil_t, td); w.add(sex_l, td); w.add(sex_t, td); w.add(new Label("密码:"), td); w.add(password_t, td); w.add(new Label("重新录入密码:"), td); w.add(passwordc_t, td); w.add(edu_l, td); w.add(edu_t, td); w.add(bird_l, td); w.add(bird_t, td); w.add(idno_l, td); w.add(idno_t, td); w.add(new Label(""), td); w.add(new Label(""), td); w.add(mark_l, td); w.add(mark_t, td2); w.add(new Label("销售人员:"), td); BaseComboBoxForm<BaseModelData> cbf = createBcode_filter(); cbf.setName("rbcode"); cbf.setAllowBlank(false); w.add(cbf, td2); w.add(ccode_t, td); w.add(icode_t, td); w.setBottomComponent(addfinace); addfinace.addListener(Events.Select, this); addfinace.setEnabled(false); w.inited(); // w.setAutoHeight(true); // w.setAutoWidth(true); // w.setSize(661, 300); cardno_t.addListener(Events.Change, this); cname_t.addListener(Events.Change, this); // mobil_t.addListener(Events.Change, this); cardno_t.setValidateOnBlur(true); cname_t.setValidateOnBlur(true); }
public RightPropertiesPanel() { setHeading(Constants.MENU_PROPS); setLayout(new FitLayout()); ToolBar toolBarSelection = new ToolBar(); LabelToolItem labelComponents = new LabelToolItem("Component: "); toolBarSelection.add(labelComponents); labelComponents.setVisible(true); setTopComponent(toolBarSelection); listComponents = new SimpleComboBox<String>(); updateFileList("Folders", listComponents); listComponents.add(Constants.COMPONENT_SPMANAGERWEB_NAME); listComponents.add("Test"); listComponents.setForceSelection(true); listComponents.setEditable(false); listComponents.setTriggerAction(ComboBox.TriggerAction.ALL); listComponents.setEmptyText("- Choose a component -"); listComponents.setFieldLabel("Component"); listComponents.setWidth(200); toolBarSelection.add(listComponents); listComponents.addSelectionChangedListener( new SelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent se) { selectedComponent = listComponents.getSimpleValue(); output.setEmptyText( "Select a component and configuration file to display and press \"Load\""); updateFileList(selectedComponent, listFiles); } }); LabelToolItem labelFiles = new LabelToolItem(" File: "); toolBarSelection.add(labelFiles); labelFiles.setVisible(true); listFiles = new SimpleComboBox<String>(); listFiles.setForceSelection(true); listFiles.setEditable(false); listFiles.setTriggerAction(ComboBox.TriggerAction.ALL); listFiles.setEmptyText("-Choose a file-"); listFiles.setFieldLabel("File"); listFiles.setAutoWidth(false); listFiles.setWidth(250); toolBarSelection.add(listFiles); listFiles.addSelectionChangedListener( new SelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent se) { output.setEmptyText( "Select a component and configuration file to display and press \"Load\""); output.clear(); } }); Button loadButton = new Button("Load"); toolBarSelection.add(loadButton); loadButton.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { updateFileContent(); } }); currentOutput = "Select a component and configuration file to display and press \"Load\""; output = new TextArea(); output.addStyleName("demo-TextArea"); output.setWidth("800px"); output.setHeight("400px"); output.setReadOnly(true); output.setEmptyText("Select a component and configuration file to display and press \"Load\""); output.setVisible(true); add(output); }
private TextArea getCommandLineTextArea() { if (txtrEnterTheCommand == null) { txtrEnterTheCommand = new TextArea(); txtrEnterTheCommand.setFieldLabel("Enter the command to run"); txtrEnterTheCommand.setAllowBlank(false); txtrEnterTheCommand.addListener( Events.KeyUp, new Listener<BaseEvent>() { public void handleEvent(BaseEvent be) { String text = txtrEnterTheCommand.getValue(); String exe; if (text == null) { exe = ""; } else { int firstWhitespace = text.indexOf(" "); if (firstWhitespace == -1) { exe = text; } else { exe = text.substring(0, firstWhitespace); } } if (lastCalculatedExecutable != null && lastCalculatedExecutable.equals(exe)) { return; } final String executable = exe; lastCalculatedExecutable = exe; suggestJobname(); if (exe.length() == 0) { lastCalculatedExecutable = null; setStatus("No executable specified."); setAppNotAvailable(); return; } setStatus("Trying to find application(s) for executable: " + executable); GrisuClientService.Util.getInstance() .getApplicationForExecutable( exe, new AsyncCallback<String[]>() { public void onFailure(Throwable arg0) { getApplicationPanel().setHeading("Application"); arg0.printStackTrace(); } public void onSuccess(String[] arg0) { if (arg0.length == 0) { setStatus("Could not find application for executable: " + executable); setAppNotAvailable(); return; } if (arg0.length > 1) { setStatus( "Found more than one application for executable: " + executable + ". Please contact [email protected] and tell them to bloody fix this."); // return; } setStatus( "Found " + arg0.length + " applications for executable " + executable + ". Getting Versions..."); setCurrentApplication(arg0); fillVersionsComboBox(); } }); } }); } return txtrEnterTheCommand; }