protected void onRender(Element parent, int index) { super.onRender(parent, index); ContentPanel inforPanel = new ContentPanel(); // inforPanel.setHeading(this.getCurState().getAuction().getString(IAuction.AUCTION_NAME)); HorizontalPanel infoContent = new HorizontalPanel(); infoContent.setSpacing(20); Label sk = new Label("拍卖活动名称:"); Label sv = new Label(this.getCurState().getAuction().getString(IAuction.AUCTION_NAME)); Label ek = new Label("拍卖商品名称:"); Label ev = new Label(this.getCurState().getAuction().getString(IAuction.GOOD_NAME)); infoContent.add(sk); infoContent.add(sv); infoContent.add(ek); infoContent.add(ev); inforPanel.add(infoContent); BasePagingLoader loader = new PagingListService().getLoader(ModelNames.AUCTIONLOG); loader.load(0, 10); store = new ListStore<BeanObject>(loader); toolBar = new PagingToolBar(10); toolBar.bind(loader); List<ColumnConfig> columns = new ArrayList<ColumnConfig>(); final CheckBoxSelectionModel<BeanObject> smRowSelection = new CheckBoxSelectionModel<BeanObject>(); columns.add(smRowSelection.getColumn()); columns.add(new ColumnConfig(IAuctionLog.BID_USER, "买家", 150)); columns.add(new ColumnConfig(IAuctionLog.BID_PRICE, "出价", 150)); columns.add(new ColumnConfig(IAuctionLog.BID_TIME, "时间", 150)); columns.add(new ColumnConfig(IAuctionLog.LOG_ID, "状态", 150)); ColumnModel cm = new ColumnModel(columns); grid = new Grid<BeanObject>(store, cm); // grid.setLoadMask(true); // grid.setBorders(true); grid.setSelectionModel(smRowSelection); grid.addPlugin(smRowSelection); grid.setHeight(250); ContentPanel contentPanel = new ContentPanel(); contentPanel.setFrame(true); contentPanel.setCollapsible(true); contentPanel.setAnimCollapse(false); contentPanel.setButtonAlign(HorizontalAlignment.CENTER); contentPanel.setIconStyle("icon-table"); contentPanel.setLayout(new FitLayout()); contentPanel.add(grid); contentPanel.setBottomComponent(toolBar); topPanel.add(inforPanel); topPanel.add(contentPanel); add(topPanel); }
private void createPagingToolbar() { RpcProxy<PagingLoadResult<DataContainer>> proxy = new RpcProxy<PagingLoadResult<DataContainer>>() { @Override public void load( Object loadConfig, AsyncCallback<PagingLoadResult<DataContainer>> callback) { dataManagementService.getPagingData((PagingLoadConfig) loadConfig, callback); } }; pagingToolBar = new MyPagingToolBar(50, this); Registry.register(PAGING_TOOLBAR, pagingToolBar); PagingLoader<PagingLoadResult<DataProviderUI>> loader = new BasePagingLoader<PagingLoadResult<DataProviderUI>>(proxy); loader.setRemoteSort(true); pagingToolBar.bind(loader); mainGridPanel.setBottomComponent(pagingToolBar); }
private SageAlertViewport() { westPanel = new ContentPanel(); westPanel.setScrollMode(Scroll.AUTOY); BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 280); westPanel.add(new MenuTreePanel(new MenuDataStore())); westPanel.setHeaderVisible(false); westPanel.setBottomComponent(new SageAlertToolBar()); centerPanel = new ContentPanel(); centerPanel.setLayout(new FitLayout()); BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER); centerPanel.setHeaderVisible(false); mainWindow = new Window(); mainWindow.setDraggable(false); mainWindow.setHeading("SageAlert v" + Version.getFullVersion()); mainWindow.setClosable(false); mainWindow.setResizable(false); mainWindow.setSize(600, 450); mainWindow.setLayout(new BorderLayout()); mainWindow.add(westPanel, westData); mainWindow.add(centerPanel, centerData); add(mainWindow); SettingsServiceAsync rpc = GWT.create(SettingsService.class); rpc.isLicensed( new AsyncCallback<Boolean>() { public void onFailure(Throwable caught) { GWT.log("ERROR", caught); } public void onSuccess(Boolean result) { String newHeading = mainWindow.getHeading(); if (!result) newHeading = newHeading.concat(" (Unlicensed)"); else newHeading = newHeading.concat(" (Licensed)"); mainWindow.setHeading(newHeading); } }); }
public void onModuleLoad() { instance = this; GWT.setUncaughtExceptionHandler( new GWT.UncaughtExceptionHandler() { public void onUncaughtException(Throwable throwable) { GWT.log("Uncaught exception", throwable); if (!GWT.isScript()) { String text = "Uncaught exception: "; while (throwable != null) { StackTraceElement[] stackTraceElements = throwable.getStackTrace(); text += throwable.toString() + "\n"; for (int i = 0; i < stackTraceElements.length; i++) { text += " at " + stackTraceElements[i] + "\n"; } throwable = throwable.getCause(); if (throwable != null) { text += "Caused by: "; } } DialogBox dialogBox = new DialogBox(true); DOM.setStyleAttribute(dialogBox.getElement(), "backgroundColor", "#ABCDEF"); System.err.print(text); text = text.replaceAll(" ", " "); dialogBox.setHTML("<pre>" + text + "</pre>"); dialogBox.center(); } } }); AppBundle.INSTANCE.css().ensureInjected(); // Create graphical context OMSVGDocument doc = OMSVGParser.currentDocument(); SVGElement element = doc.createSVGPathElement().getElement().cast(); element .getStyle() .setProperty(SVGConstants.CSS_FILL_PROPERTY, SVGConstants.CSS_LIGHTBLUE_VALUE); element.getStyle().setProperty(SVGConstants.CSS_STROKE_PROPERTY, SVGConstants.CSS_BLACK_VALUE); SVGNamedElementModel.createTitleDesc(element, AppConstants.INSTANCE.graphicalContext()); cssContext = new CssContextModel(element); svgWindows = new ArrayList<SVGWindow>(); viewport = new ViewportExt(); viewport.setLayout(new BorderLayout()); viewport.add(createMenuBar(), new BorderLayoutData(LayoutRegion.NORTH, getWindowBarHeight())); viewport.setStyleAttribute("background-color", SVGConstants.CSS_BEIGE_VALUE); commandToolBar = new CommandFactoryToolBar( CommandFactories.getAllFactoriesStore(), getCommandFactorySelector()); ContentPanel commandPanel = new ContentPanel(); commandPanel.setHeaderVisible(false); commandPanel.setBottomComponent(commandToolBar); viewport.add(commandPanel, new BorderLayoutData(LayoutRegion.SOUTH, getWindowBarHeight())); new InternalLoadRequest(AppBundle.INSTANCE.fish(), "fish.svg").load(); new InternalLoadRequest(AppBundle.INSTANCE.fries(), "fries.svg").load(); new InternalLoadRequest(AppBundle.INSTANCE.sample(), "sample.svg").load(); update(); fileUpload = new FileUploadExt(); Style style = fileUpload.getElement().getStyle(); style.setVisibility(Visibility.HIDDEN); style.setWidth(0, Unit.PX); style.setHeight(0, Unit.PX); fileUpload.addChangeHandler( new ChangeHandler() { @Override public void onChange(ChangeEvent event) { processFiles(fileUpload.getFiles()); } }); RootPanel.get().add(viewport); RootPanel.get().add(fileUpload); }
private void initUI() { long time = new java.util.Date().getTime(); GWT.log("Initializing the UI ", null); container = new LayoutContainer(); container.setLayout(new CenterLayout()); // Rpc Proxy setup pagingToolBar = setupRpcProxy(); // Audit event grid setup grid = setupGrid(); // Panel ContentPanel cp = new ContentPanel(); cp.setHeading("Entity Event Viewer"); cp.setFrame(true); cp.setIcon(IconHelper.create("images/search_icon_16x16.png")); cp.setLayout(new FormLayout()); cp.setSize(1100, 630); // Search Container ContentPanel searchContainer = new ContentPanel(); searchContainer.setHeaderVisible(false); FormLayout searchFormLayout = new FormLayout(); searchFormLayout.setLabelWidth(130); searchFormLayout.setDefaultWidth(770); searchContainer.setLayout(searchFormLayout); selectedEvenyTypes = new TextField<String>(); selectedEvenyTypes.setFieldLabel("Selected Event Types"); selectedEvenyTypes.setReadOnly(true); evenyTypes = new ListView<AuditEventTypeWeb>(); evenyTypes.setDisplayProperty("auditEventTypeName"); evenyTypes.setWidth(220); evenyTypes.setHeight(110); evenyTypes.setStore(eventTypesStore); evenyTypes .getSelectionModel() .addListener( Events.SelectionChange, new Listener<SelectionChangedEvent<AuditEventTypeWeb>>() { public void handleEvent(SelectionChangedEvent<AuditEventTypeWeb> be) { List<AuditEventTypeWeb> selections = be.getSelection(); String selectedTypes = ""; for (AuditEventTypeWeb type : selections) { if (selectedTypes.isEmpty()) { selectedTypes = type.getAuditEventTypeName(); } else { selectedTypes = selectedTypes + ", " + type.getAuditEventTypeName(); } } selectedEvenyTypes.setValue(selectedTypes); if (selectedTypes.isEmpty()) { searchButton.disable(); } else { searchButton.enable(); } } }); DateTimePropertyEditor dateFormat = new DateTimePropertyEditor("yyyy-MM-dd HH:mm"); startDate = new DateField(); startDate.setFieldLabel("Start Date Time"); startDate.setToolTip("yyyy-MM-dd HH:mm"); startDate.setPropertyEditor(dateFormat); endDate = new DateField(); endDate.setFieldLabel("End Date Time"); endDate.setToolTip("yyyy-MM-dd HH:mm"); endDate.setPropertyEditor(dateFormat); LayoutContainer main = new LayoutContainer(); main.setLayout(new ColumnLayout()); LayoutContainer left = new LayoutContainer(); left.setStyleAttribute("paddingRight", "10px"); FormLayout layout = new FormLayout(); layout.setLabelWidth(130); layout.setDefaultWidth(220); // layout.setLabelAlign(LabelAlign.TOP); left.setLayout(layout); left.add(startDate); LayoutContainer right = new LayoutContainer(); right.setStyleAttribute("paddingLeft", "10px"); layout = new FormLayout(); // layout.setLabelAlign(LabelAlign.TOP); layout.setLabelWidth(130); layout.setDefaultWidth(220); right.setLayout(layout); right.add(endDate); main.add(left, new ColumnData(.5)); main.add(right, new ColumnData(.5)); HBoxLayoutData dataSelectedTypes = new HBoxLayoutData(new Margins(5, 0, 0, 0)); searchContainer.add(selectedEvenyTypes, dataSelectedTypes); HBoxLayoutData dataTypes = new HBoxLayoutData(new Margins(5, 0, 5, 135)); searchContainer.add(evenyTypes, dataTypes); searchContainer.add(main); HBoxLayoutData dataButtons = new HBoxLayoutData(new Margins(0, 0, 5, 0)); searchContainer.add(setupButtonPanel(3), dataButtons); cp.add(searchContainer); cp.add(grid); cp.setBottomComponent(pagingToolBar); container.add(cp); LayoutContainer wrapper = (LayoutContainer) Registry.get(Constants.CENTER_PANEL); wrapper.removeAll(); wrapper.add(container); wrapper.layout(); GWT.log("Done Initializing the UI in " + (new java.util.Date().getTime() - time), null); }
@Override protected void onRender(Element parent, int index) { super.onRender(parent, index); setLayout(new CenterLayout()); List<ColumnConfig> configs = new ArrayList<ColumnConfig>(); configs.add(sm.getColumn()); ColumnConfig column = new ColumnConfig(); column.setId("ragioneSociale"); column.setHeader("Ragione Sociale"); column.setWidth(120); TextField<String> text = new TextField<String>(); // text.setAllowBlank(false); column.setEditor(new CellEditor(text)); configs.add(column); column = new ColumnConfig(); column.setId("cognome"); column.setHeader("Cognome"); column.setWidth(120); text = new TextField<String>(); // text.setAllowBlank(false); column.setEditor(new CellEditor(text)); configs.add(column); column = new ColumnConfig(); column.setId("nome"); column.setHeader("Nome"); column.setWidth(120); text = new TextField<String>(); // text.setAllowBlank(false); column.setEditor(new CellEditor(text)); configs.add(column); column = new ColumnConfig(); column.setId("cf"); column.setHeader("Codice Fiscale"); column.setWidth(120); text = new TextField<String>(); // text.setAllowBlank(false); column.setEditor(new CellEditor(text)); configs.add(column); column = new ColumnConfig(); column.setId("piva"); column.setHeader("Partita IVA"); column.setWidth(120); text = new TextField<String>(); text.setAllowBlank(false); column.setEditor(new CellEditor(text)); configs.add(column); column = new ColumnConfig(); column.setId("denominazione"); column.setHeader("Denominazione"); column.setWidth(120); text = new TextField<String>(); text.setAllowBlank(false); column.setEditor(new CellEditor(text)); configs.add(column); caricaDati(); ColumnModel cm = new ColumnModel(configs); ContentPanel cp = new ContentPanel(); cp.setHeading("Anagrafica aziende"); cp.setFrame(true); // cp.setIcon(Resources.ICONS.table()); cp.setSize(Consts.LarghezzaFinestra, Consts.AltezzaFinestra); cp.setLayout(new FitLayout()); final EditorGrid<BeanModel> grid = new EditorGrid<BeanModel>(store, cm); grid.setSelectionModel(sm); grid.setAutoExpandColumn("nome"); grid.setBorders(true); grid.setClicksToEdit(EditorGrid.ClicksToEdit.TWO); cp.add(grid); ToolBar toolBar = new ToolBar(); Button addButton = new Button("Aggiungi azienda"); addButton.setIcon( IconHelper.create( "/resources/grafica/x16/add2.png", Consts.ICON_WIDTH_SMALL, Consts.ICON_HEIGHT_SMALL)); addButton.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { BeanModelFactory factory = BeanModelLookup.get().getFactory(Azienda.class); Azienda azienda = new Azienda( "NuovoNome", "NuovoCognome", "nuovaRS", "nuovoCF", "nuovaPIVA", "NuovaDenominazione"); BeanModel model = factory.createModel(azienda); grid.stopEditing(); aziende.add(azienda); store.insert(model, 0); grid.startEditing(store.indexOf(model), 0); } }); toolBar.add(addButton); toolBar.add(new SeparatorToolItem()); Button remove = new Button("Rimuovi selezionati"); remove.setIcon( IconHelper.create( "/resources/grafica/x16/delete2.png", Consts.ICON_WIDTH_SMALL, Consts.ICON_HEIGHT_SMALL)); remove.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { if (!(sm.getSelectedItems()).isEmpty()) { MessageBox.confirm( "Confirm", "Sei sicuro di voler eliminare gli elemtni selezionati?", cancellazione); } else { MessageBox.alert("Errore", "Selezionare uno o più elementi", cancellazione); } } // conferma per l'eliminazione final Listener<MessageBoxEvent> cancellazione = new Listener<MessageBoxEvent>() { @Override public void handleEvent(MessageBoxEvent ce) { Button btn = ce.getButtonClicked(); if (btn.getText().equals("Yes")) { List<BeanModel> modelsDaRimuovere = sm.getSelectedItems(); ArrayList<Azienda> aziendeDaRimuovere = new ArrayList(); if (modelsDaRimuovere != null) { Iterator it = modelsDaRimuovere.iterator(); while (it.hasNext()) { Object model = it.next(); store.remove((BeanModel) model); Azienda azienda = ((BeanModel) model).getBean(); aziendeDaRimuovere.add(azienda); aziende.remove(azienda); } cancellaDati(aziendeDaRimuovere); } } } }; }); toolBar.add(remove); cp.setTopComponent(toolBar); ToolBar statusBar = new ToolBar(); status.setWidth(350); statusBar.add(status); cp.setBottomComponent(statusBar); cp.setButtonAlign(HorizontalAlignment.CENTER); Button resetButton = new Button( "Reset", new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { store.rejectChanges(); } }); resetButton.setIcon( IconHelper.create( "/resources/grafica/x16/undo.png", Consts.ICON_WIDTH_SMALL, Consts.ICON_HEIGHT_SMALL)); cp.addButton(resetButton); Button saveButton = new Button( "Save", new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { store.commitChanges(); salvaDati(aziende); } }); saveButton.setIcon( IconHelper.create( "/resources/grafica/x16/save.png", Consts.ICON_WIDTH_SMALL, Consts.ICON_HEIGHT_SMALL)); cp.addButton(saveButton); add(cp); }
private void onStatusBarReady(AppEvent event) { viewportPanel.setBottomComponent(event.<Component>getData()); }
protected void onRender(Element parent, int index) { super.onRender(parent, index); criteria.addCondition(new Condition(IGoods.DELETED, Condition.EQUALS, "true")); BasePagingLoader loader = new PagingListService().getLoader(ModelNames.GOODS, criteria); loader.load(0, 10); final ListStore<BeanObject> store = new ListStore<BeanObject>(loader); toolBar = new PagingToolBar(10); toolBar.bind(loader); List<ColumnConfig> columns = new ArrayList<ColumnConfig>(); final CheckBoxSelectionModel<BeanObject> smRowSelection = new CheckBoxSelectionModel<BeanObject>(); columns.add(smRowSelection.getColumn()); columns.add(new ColumnConfig(IGoods.ID, "ID", 50)); ColumnConfig col = new ColumnConfig(IGoods.NAME, Resources.constants.Goods_name(), 100); columns.add(col); col = new ColumnConfig(IGoods.SN, Resources.constants.Goods_SN(), 100); columns.add(col); col = new ColumnConfig(IGoods.SHOPPRICE, Resources.constants.Goods_shopPrice(), 80); col.setAlignment(HorizontalAlignment.RIGHT); col.setNumberFormat(NumberFormat.getCurrencyFormat()); columns.add(col); ColumnConfig actcol = new ColumnConfig("Action", Resources.constants.GoodsList_action(), 100); // columns.add(actcol); ColumnModel cm = new ColumnModel(columns); Grid<BeanObject> grid = new EditorGrid<BeanObject>(store, cm); grid.setLoadMask(true); grid.setBorders(true); grid.setSelectionModel(smRowSelection); // grid.setAutoExpandColumn("forum"); ActionCellRenderer render = new ActionCellRenderer(grid); ActionCellRenderer.ActionInfo act = new ActionCellRenderer.ActionInfo(); act.setImage("icon_edit.gif"); act.setAction("editGoods($id)"); act.setTooltip(Resources.constants.GoodsList_action_edit()); render.addAction(act); act = new ActionCellRenderer.ActionInfo(); act.setImage("icon_trash.gif"); act.setAction("deleteGoods($id)"); act.setTooltip(Resources.constants.GoodsList_action_delete()); render.addAction(act); actcol.setRenderer(render); HorizontalPanel header = new HorizontalPanel(); header.add(Resources.images.icon_search().createImage()); header.add(new Label(" " + Resources.constants.GoodsList_keyword())); header.add(txtKeyword); header.add(btnFind); add(header); btnFind.addSelectionListener( new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { search(); } }); ContentPanel panel = new ContentPanel(); panel.setFrame(true); panel.setCollapsible(true); panel.setAnimCollapse(false); panel.setButtonAlign(HorizontalAlignment.CENTER); panel.setIconStyle("icon-table"); // panel.setHeading("Paging Grid"); panel.setLayout(new FitLayout()); panel.add(grid); panel.setSize(880, 350); panel.setBottomComponent(toolBar); panel.setButtonAlign(HorizontalAlignment.CENTER); panel.addButton( new Button( "彻底删除", new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { List<BeanObject> items = smRowSelection.getSelectedItems(); purgeGoods(items); } })); panel.addButton( new Button( "恢复", new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { List<BeanObject> items = smRowSelection.getSelectedItems(); restoreGoods(items); } })); add(panel); }
/** 初始化界面。 */ public MagazineManager() { curState = new State(); BasePagingLoader loader = new PagingListService().getLoader(ModelNames.MAILTEMPLATE, criteria); loader.load(0, 10); store = new ListStore<BeanObject>(loader); toolBar = new PagingToolBar(10); toolBar.bind(loader); List<ColumnConfig> columns = new ArrayList<ColumnConfig>(); ColumnConfig title = new ColumnConfig(IMailTemplate.SUBJECT, "杂志标题", 200); columns.add(title); columns.add(new ColumnConfig(IMailTemplate.LASTMODIFY, "杂志上次编辑时间", 160)); columns.add(new ColumnConfig(IMailTemplate.LASTSEND, "杂志上次发送时间", 160)); ColumnConfig insert = new ColumnConfig("insert", "插入发送队列", 160); columns.add(insert); ColumnConfig actcol = new ColumnConfig("Action", "操作", 100); columns.add(actcol); ColumnModel cm = new ColumnModel(columns); grid = new Grid<BeanObject>(store, cm); grid.setLoadMask(true); grid.setBorders(true); ActionCellRenderer render = new ActionCellRenderer(grid); ActionCellRenderer insertRender = new ActionCellRenderer(grid); ActionCellRenderer.ActionInfo act = new ActionCellRenderer.ActionInfo(); act.setImage("icon_edit.gif"); act.setAction("editMagazine($id)"); act.setTooltip("编辑"); render.addAction(act); act = new ActionCellRenderer.ActionInfo(); act.setImage("icon_trash.gif"); act.setAction("deleteMagazine($id)"); act.setTooltip("删除"); render.addAction(act); act = new ActionCellRenderer.ActionInfo(); act.setText("插入队列"); act.setAction("insertMagazine($id)"); act.setTooltip("插入队列"); insertRender.addAction(act); actcol.setRenderer(render); insert.setRenderer(insertRender); ContentPanel panel = new ContentPanel(); panel.setFrame(true); panel.setCollapsible(true); panel.setAnimCollapse(false); panel.setButtonAlign(HorizontalAlignment.CENTER); panel.setIconStyle("icon-table"); panel.setLayout(new FitLayout()); panel.add(grid); panel.setSize(850, 350); panel.setBottomComponent(toolBar); panel.setHeading("邮件杂志列表"); panel.setButtonAlign(HorizontalAlignment.LEFT); // 添加新杂志 final com.extjs.gxt.ui.client.widget.button.Button addMagazine = new com.extjs.gxt.ui.client.widget.button.Button("添加新杂志"); addMagazine.addSelectionListener( new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { // add new magazine function NewMagazine.State state = new NewMagazine.State(); state.execute(); } }); panel.addButton(addMagazine); add(panel); initJS(this); }