private TextField<String> buildFilterField() { filter = new TextField<String>() { @Override public void onKeyUp(FieldEvent fe) { String val = getValue(); if (val == null || val.isEmpty()) { search(""); return; } if (fe.getKeyCode() == 13) { if (val.length() >= 3) { search(val); } } } }; filter.setEmptyText(I18N.DISPLAY.searchToolTip()); filter.setToolTip(I18N.DISPLAY.searchToolTip()); filter.setId(ID_SEARCH_FLD); filter.setWidth(350); return filter; }
@Override public String validate(Field<?> field, String value) { String urlPattern = "^(?:http(s{0,1})://|www)[a-zA-Z0-9_/\\-\\.]+\\.([A-Za-z/]{2,5})[a-zA-Z0-9_/\\&\\?\\=\\-\\.\\~\\%\\+\\!\\*\\(\\)\\'\\#\\_]*"; //$NON-NLS-1$ if (value == null) { return I18N.DISPLAY.inValidUrl(); } if (!value.matches(urlPattern)) { return I18N.DISPLAY.inValidUrl(); } else { return null; } }
private void search(String filter) { if (filter != null && !filter.isEmpty()) { if (filter.length() >= 3) { grid.mask(I18N.DISPLAY.loadingMask()); DeployedComponentSearchServiceFacade facade = new DeployedComponentSearchServiceFacade(); facade.searchDeployedComponents( filter, new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); grid.unmask(); } @Override public void onSuccess(String result) { List<DeployedComponent> dc_list = DeployedComponentSearchUtil.parseJson(result); grid.getStore().removeAll(); grid.getStore().add(dc_list); grid.unmask(); } }); } } else { getDeployedComponents(currentSelection); } }
private void initDialog(Button bntOk) { setHideOnButtonClick(true); setHeading(I18N.DISPLAY.component()); setLayout(new FitLayout()); setSize(600, 500); setResizable(false); setModal(true); buildcomponentLookupGrid(); initGridSelectionModel(bntOk); }
private void buildcomponentLookupGrid() { ListStore<DeployedComponent> store = new ListStore<DeployedComponent>(); grid = new Grid<DeployedComponent>(store, buildColumnModel()); grid.setAutoExpandColumn("name"); // $NON-NLS-1$ grid.addPlugin(expander); grid.getView().setEmptyText(I18N.DISPLAY.noComponents()); grid.setBorders(false); grid.setStripeRows(true); grid.setColumnLines(true); grid.getStore().setStoreSorter(new DeployedComponentSorter()); }
private String buildDCDeatailsTemplate() { StringBuilder tmpl = new StringBuilder(); // Description line tmpl.append("<tpl if=\"description\"><p>{description}</p></tpl>"); // $NON-NLS-1$ // Contact line showing the integrator's email tmpl.append("<p><b>"); // $NON-NLS-1$ tmpl.append(I18N.DISPLAY.attribution()); tmpl.append(":</b> "); // $NON-NLS-1$ tmpl.append("<tpl if=\"attribution\"><p>{attribution}</p></tpl>"); // $NON-NLS-1$ tmpl.append("<br/>"); // $NON-NLS-1$ return tmpl.toString(); }
private Button buildNewToolRequestMenuItem() { Button newToolBtn = new Button(org.iplantc.core.tito.client.I18N.DISPLAY.requestNewTool()); newToolBtn.setIcon(AbstractImagePrototype.create(Resources.ICONS.add())); newToolBtn.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { new NewToolRequestWindow().show(); } }); newToolBtn.setId(ID_BTN_NEW_TOOL_BTN); return newToolBtn; }
private ColumnModel buildColumnModel() { initExpander(); List<ColumnConfig> configs = new ArrayList<ColumnConfig>(); ColumnConfig name = buildColumnConfig(DeployedComponent.NAME, I18N.DISPLAY.name(), 225); name.setMenuDisabled(true); name.setSortable(true); ColumnConfig version = buildColumnConfig(DeployedComponent.VERSION, I18N.DISPLAY.versionColumnHeader(), 100); version.setSortable(false); version.setMenuDisabled(true); ColumnConfig loc = buildColumnConfig(DeployedComponent.LOCATION, I18N.DISPLAY.path(), 250); loc.setMenuDisabled(true); loc.setSortable(false); configs.add(expander); configs.add(name); configs.add(version); configs.add(loc); return new ColumnModel(configs); }
private void getDeployedComponents(final String currentSelection) { grid.mask(I18N.DISPLAY.loadingMask()); EnumerationServices services = new EnumerationServices(); services.getDeployedComponents( new AsyncCallback<String>() { @Override public void onSuccess(String result) { grid.getStore().removeAll(); ArrayList<DeployedComponent> components = DeployedComponentSearchUtil.parseJson(result); grid.getStore().add(components); grid.getStore().sort(DeployedComponent.NAME, SortDir.ASC); setCurrentCompSelection(currentSelection); grid.unmask(); } @Override public void onFailure(Throwable caught) { ErrorHandler.post(I18N.DISPLAY.cantLoadDeployedComponents(), caught); grid.unmask(); } }); }