private void buildToolbar() { toolbar = new ToolBar(); next = new Button(); next.setIconStyle("icon-next"); next.setText("Next " + NUMBER_OF_RESULTS + " Results"); next.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { start += NUMBER_OF_RESULTS; if (start + NUMBER_OF_RESULTS > currentResults.getLength()) next.setEnabled(false); if (start > 0) prev.setEnabled(true); fillTable(); } }); prev = new Button(); prev.setIconStyle("icon-previous"); prev.setText("Previous " + NUMBER_OF_RESULTS + " Results"); prev.addSelectionListener( new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { start -= NUMBER_OF_RESULTS; if (start < 0) start = 0; if (start == 0) prev.setEnabled(false); if (start + NUMBER_OF_RESULTS < currentResults.getLength()) next.setEnabled(true); fillTable(); } }); toolbar.add(prev); toolbar.add(next); }
private void buildToolbar(RowData data) { toolbar = new ToolBar(); saveAndAddTaxa = new Button(); saveAndAddTaxa.setText("Save and Add Taxa"); saveAndAddTaxa.setIconStyle("icon-go-jump"); saveAndAddTaxa.setTitle("Save and Add Taxa"); saveAndAddTaxa.addListener( Events.Select, new Listener() { public void handleEvent(BaseEvent be) { save(SAVEANDCONTINUE); } }); save = new Button(); save.setText("Save"); save.setIconStyle("icon-save"); save.setTitle("Save and Continue Editing"); save.addListener( Events.Select, new Listener() { public void handleEvent(BaseEvent be) { save(SAVE); } }); saveAndExit = new Button(); saveAndExit.setIconStyle("icon-save-and-exit"); saveAndExit.setText("Save and Exit"); saveAndExit.setTitle("Save and Exit without adding taxa"); saveAndExit.addListener( Events.Select, new Listener() { public void handleEvent(BaseEvent be) { save(SAVEANDEXIT); } }); cancel = new Button(); cancel.setIconStyle("icon-cancel"); cancel.setText("Cancel"); cancel.setTitle("Cancel"); cancel.addListener( Events.Select, new Listener() { public void handleEvent(BaseEvent be) { cancel(); } }); addItemsToToolBar(); add(toolbar, data); }
private Button createButton() { String confirm = getField().getAttribute("confirm", "false"); String icon = getField().getAttribute("icon", "icsc-edit"); String toggle = getField().getAttribute("toggle", "false"); String toggleGroup = getField().getAttribute("toggleGroup", ""); Button btn = null; if (Boolean.parseBoolean(toggle)) { btn = new ToggleButton(getField().getLabel()); if (!toggleGroup.equals("")) { ((ToggleButton) btn).setToggleGroup(toggleGroup); } } else { if (confirm.toLowerCase().equals("false")) { btn = new gkButton(getField().getLabel(), false); } else { btn = new gkButton(getField().getLabel(), confirm); } ((gkButton) btn).setValue(getField().getValue()); } // 为btn设定图片,在gul语法中设定icon="xxx",xxx可以是css文件中已定义好的选择器(如:icsc-edit) // 也可以是自定义的图片路径,若无设定,则默认使用icon="icsc-edit" btn.setIconStyle(icon); // 如果 <field type='btn'>..</field>有子節點,是為menu,進行建立menu動作 if (getField().getWidgets().size() > 0) { attachWidget(btn); } return btn; }
public void draw() { if (!drawn) { for (String definable : DefinitionCache.impl.getDefinables()) addDefinition(definable, DefinitionCache.impl.getDefinition(definable)); Button save = new Button(); save.setText("Save"); save.setIconStyle("icon-save"); save.setTitle("Save"); save.addListener( Events.Select, new Listener<BaseEvent>() { public void handleEvent(BaseEvent be) { save(); } }); Button add = new Button(); add.setText("Add new definition"); add.setIconStyle("icon-add"); add.setTitle("Add new definition"); add.addListener( Events.Select, new Listener<BaseEvent>() { public void handleEvent(BaseEvent be) { TextField<String> f = addDefinition("", ""); layout(); scrollIntoView(f); } }); ToolBar toolbar = new ToolBar(); toolbar.add(save); toolbar.add(add); setTopComponent(toolbar); drawn = true; } }
public void _add() { int armStatus = ArmWrapper.FAILED; try { ArmWrapper.startTransaction( this, "com.base.myproject.client.ui.BaseMenuBar", "_add", new Object[] {}); Button item1 = new Button("Button w/ Menu"); item1.setIconStyle("icon-menu-show"); Menu menu = new Menu(); CheckMenuItem menuItem = new CheckMenuItem("I Like Cats"); menuItem.setChecked(true); menu.add(menuItem); menuItem = new CheckMenuItem("I Like Dogs"); menu.add(menuItem); item1.setMenu(menu); MenuItem menuitem2 = new MenuItem(); menuitem2.setText("menuitem2"); menuitem2.addSelectionListener( new SelectionListener() { @Override public void componentSelected(ComponentEvent ce) { // TODO Auto-generated method stub } public void handleEvent(BaseEvent be) { // TODO Auto-generated method stub // System.out.println("++"); HTML homeText = new HTML("Tab you have selected is Home."); // BaseTabPanel.getInstance().addTab("zgw2", homeText); // BaseTabPanel.getInstance().addTab("zgw3", new BasePanel()); BaseTabPanel.getInstance().addTab("zgw4", new TestBusi()); } }); menu.add(menuitem2); basemenubar.add(item1); armStatus = ArmWrapper.GOOD; // basemenubar.add(menuitem2); } finally { ArmWrapper.stopTransaction("com.base.myproject.client.ui.BaseMenuBar", "_add", armStatus); } }
public Widget aa() { int armStatus = ArmWrapper.FAILED; try { ArmWrapper.startTransaction( this, "com.base.myproject.client.busi.b2c.manager.ChartTest", "aa", new Object[] {}); ContentPanel panel = new ContentPanel(); panel.setAutoHeight(true); ToolBar tb = new ToolBar(); Button addsuit = new Button("从商品库里添加套装商品"); addsuit.setIconStyle("b2csuit"); panel.setHeading("商品库,如果加入套装你必须先选择一行(必选)"); tb.add(addsuit); panel.setTopComponent(tb); // addsuit.addListener(Events.Select, this); panel.setAutoWidth(true); CheckBoxSelectionModel cbs = new CheckBoxSelectionModel(); List<ColumnConfig> columns = new ArrayList<ColumnConfig>(); columns.add(cbs.getColumn()); ColumnConfig gcode = new ColumnConfig("gcode", "商品大类编码", 100); TextField<String> gcodetext = new TextField<String>(); gcode.setEditor(new CellEditor(gcodetext)); columns.add(gcode); ColumnConfig gname = new ColumnConfig("discountprice", "商品大类名称", 100); TextField<String> gnametext = new TextField<String>(); gname.setEditor(new CellEditor(gnametext)); columns.add(gname); ColumnConfig treecode = new ColumnConfig("price", "商品分类树编码", 100); TextField<String> treecodetext = new TextField<String>(); treecode.setEditor(new CellEditor(treecodetext)); columns.add(treecode); ColumnConfig b2cgcodecolumn = new ColumnConfig("b2cgcode", "商品编码", 100); TextField<String> b2cgcodetext = new TextField<String>(); b2cgcodecolumn.setEditor(new CellEditor(b2cgcodetext)); columns.add(b2cgcodecolumn); ColumnConfig b2cgname = new ColumnConfig("b2cgname", "商品名称", 100); TextField<String> b2cgnametext = new TextField<String>(); b2cgname.setEditor(new CellEditor(b2cgnametext)); columns.add(b2cgname); ModelType type = new ModelType(); type.setRoot("records"); type.setRecordName("record"); type.addField("gcode"); type.addField("gname"); type.addField("b2cgcode"); type.addField("price"); type.addField("discountprice"); type.addField("b2cgname"); type.addField("mainimagepath"); type.addField("treecode"); type.addField("detailimage"); StoreInfo info = new StoreInfo(); info.setTablename("b2cgcode"); info.setKeyname(new String[] {"b2cgcode"}); info.setSql("select * from b2cgcode"); BaseStore<JDBCModelData> store = new BaseStore<JDBCModelData>(type, info); ChartModel model = new ChartModel( "Team Sales by Month", "font-size: 14px; font-family: Verdana; text-align: center;"); model.setBackgroundColour("#fefefe"); model.setLegend(new Legend(Position.TOP, true)); model.setScaleProvider(ScaleProvider.ROUNDED_NEAREST_SCALE_PROVIDER); BarChart bar = new BarChart(BarStyle.GLASS); bar.setColour("#00aa00"); BarDataProvider barProvider = new BarDataProvider("price", "b2cgname"); barProvider.bind(store); bar.setDataProvider(barProvider); // bar.addChartListener(listener); model.addChartConfig(bar); bar = new BarChart(BarStyle.GLASS); bar.setColour("#ff6600"); barProvider = new BarDataProvider("discountprice"); barProvider.bind(store); bar.setDataProvider(barProvider); // bar.addChartListener(listener); model.addChartConfig(bar); LineChart line = new LineChart(); line.setAnimateOnShow(true); line.setText("Average"); line.setColour("#FF0000"); LineDataProvider lineProvider = new LineDataProvider("discountprice"); lineProvider.bind(store); line.setDataProvider(lineProvider); model.addChartConfig(line); /* PieChart pie = new PieChart(); PieDataProvider piedataprovider = new PieDataProvider("discountprice"); piedataprovider.bind(store); pie.setDataProvider(piedataprovider); model.addChartConfig(pie);*/ String url = "chart/open-flash-chart.swf"; final Chart chart = new Chart(url); chart.setChartModel(model); chart.setHeight("300px"); ContentPanel cp = new ContentPanel(); cp.setHeading("Chart"); cp.add(chart); ColumnModel cm = new ColumnModel(columns); BaseGrid grid = new BaseGrid(store, cm); grid.setHeight("300px"); cp.add(grid); armStatus = ArmWrapper.GOOD; return cp; } finally { ArmWrapper.stopTransaction( "com.base.myproject.client.busi.b2c.manager.ChartTest", "aa", armStatus); } }