コード例 #1
0
  private ContentPanel buildConfigBloc(ConfigGroup configGroup, ImageResource icon) {
    final ContentPanel cPanel = new ContentPanel(new ColumnLayout());
    cPanel.setHeading(
        "<div class='config-title'>" + I18nUtils.getString(configGroup.key) + "</div>");
    cPanel.getHeader().addStyleName("config-header");
    cPanel.setCollapsible(true);
    cPanel.setAnimCollapse(false);
    cPanel.collapse();
    cPanel.setIcon(AbstractImagePrototype.create(icon));
    cPanel.addListener(
        Events.Expand,
        new Listener<ComponentEvent>() {

          @Override
          public void handleEvent(ComponentEvent be) {
            cPanel.layout(true);
          }
        });

    cPanel.getHeader().addDomHandler(this, ClickEvent.getType());
    mapConfigGroupPanel.put(configGroup, cPanel);
    mapHeaderGroup.put(cPanel.getHeader(), cPanel);

    return cPanel;
  }
コード例 #2
0
  @Test
  public void onModuleLoad() {
    // Arrange
    MyGXTApp app = new MyGXTApp();

    // Act
    app.onModuleLoad();

    // Assert
    ContentPanel cp = (ContentPanel) RootPanel.get().getWidget(0);
    assertEquals(10, cp.getPosition(true).x);
    assertEquals(10, cp.getPosition(true).y);
    assertEquals("my title", cp.getTitle());
    assertEquals(250, cp.getSize().width);
    // assertEquals(140, cp.getSize().height);
    assertTrue(cp.getCollapsible());
    assertTrue(cp.getFrame());
    assertEquals("backgroundColor: white;", cp.getBodyStyle());
    assertEquals(3, cp.getHeader().getToolCount());

    ToolButton tool0 = (ToolButton) cp.getHeader().getTool(0);
    assertEquals("x-nodrag x-tool-gear x-tool x-component", tool0.getStyleName());

    ToolButton tool1 = (ToolButton) cp.getHeader().getTool(1);
    assertEquals("x-nodrag x-tool-close x-tool x-component", tool1.getStyleName());

    ToolButton tool2 = (ToolButton) cp.getHeader().getTool(2);
    assertEquals("x-nodrag x-tool-toggle x-tool x-component", tool2.getStyleName());
  }
コード例 #3
0
  protected void addHelpTool(ContentPanel panel) {
    if (helpTextId == null) return;

    ToolButton helpBtn = new ToolButton("x-tool-help");
    //		if (GXT.isAriaEnabled()) {
    //			helpBtn.setTitle(GXT.MESSAGES.pagingToolBar_beforePageText());
    //		}
    helpBtn.addListener(
        Events.Select,
        new Listener<ComponentEvent>() {
          public void handleEvent(ComponentEvent ce) {
            HelpTextDialog htd = new HelpTextDialog(helpTextId);
            htd.show();
          }
        });
    panel.getHeader().addTool(helpBtn);
  }
コード例 #4
0
  @Override
  public void addPanelContent() {
    //		contentPanel = new ContentPanel();
    contentPanel.setLayout(new FitLayout());
    //		contentPanel.setHeading("Snapshot Terms Chart View");
    IconSupplier.setIcon(contentPanel, IconSupplier.getPieChartIconName());

    if (store == null) store = getNewStore();

    if (chart == null) createChart();

    addHelpTool(contentPanel);
    contentPanel.getHeader().addTool(getParametersTool());

    contentPanel.setTopComponent(getButtonsBar());

    contentPanel.add(chart, new MarginData(20));

    add(contentPanel);

    if (snapshot != null && localStore) store.getLoader().load();
  }
コード例 #5
0
  public TaskGrid() {
    setLayout(new FlowLayout(10));
    getAriaSupport().setPresentation(true);

    final NumberFormat currency = NumberFormat.getCurrencyFormat();
    final NumberFormat number = NumberFormat.getFormat("0.00");
    // final NumberCellRenderer<Grid<Stock>> numberRenderer = new NumberCellRenderer<Grid<Stock>>(
    //		currency);

    /*
    GridCellRenderer<Stock> change = new GridCellRenderer<Stock>() {
    	public String render(Stock model, String property,
    			ColumnData config, int rowIndex, int colIndex,
    			ListStore<Stock> store, Grid<Stock> grid) {
    		Object o = model.get(property);

    		String v = "(not set)";
    		if(o == null) {
    			double val = (Double)o;
    			String style = val < 0 ? "red"
    					: GXT.isHighContrastMode ? "#00ff5a" : "green";
    			v = number.format(val);

    		}

    		return "<span qtitle='"
    				+ cm.getColumnById(property).getHeader() + "' qtip='"
    				+ v + "' style='font-weight: bold;color:" + style
    				+ "'>" + v + "</span>";
    	}
    };*/

    /*
    GridCellRenderer<Stock> gridNumber = new GridCellRenderer<Stock>() {
    	public String render(Stock model, String property,
    			ColumnData config, int rowIndex, int colIndex,
    			ListStore<Stock> store, Grid<Stock> grid) {
    		return numberRenderer.render(null, property,
    				model.get(property));
    	}
    };*/

    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();

    ColumnConfig column = new ColumnConfig();
    column.setId("name");
    column.setHeader("Linkset name");
    column.setWidth(200);
    column.setRowHeader(true);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("direction");
    column.setHeader("Direction");
    column.setAlignment(HorizontalAlignment.RIGHT);
    column.setWidth(100);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("sampled");
    column.setHeader("Sampled");
    column.setAlignment(HorizontalAlignment.RIGHT);
    column.setWidth(100);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("sampleSize");
    column.setHeader("Sample size");
    column.setAlignment(HorizontalAlignment.RIGHT);
    column.setWidth(75);
    // column.setRenderer(gridNumber);
    configs.add(column);

    /*
    column = new ColumnConfig("change", "Change", 100);
    column.setAlignment(HorizontalAlignment.RIGHT);
    //column.setRenderer(change);
    configs.add(column);
    */

    column = new ColumnConfig("date", "Finished", 100);
    column.setAlignment(HorizontalAlignment.RIGHT);
    column.setDateTimeFormat(DateTimeFormat.getFormat("MM/dd/yyyy"));
    configs.add(column);

    // ListStore<TaskDescription> store = new ListStore<TaskDescription>();
    // store.add(getStocks());

    // store.add(TaskData.getStocks());

    // store.add(getStocks());

    cm = new ColumnModel(configs);

    ContentPanel cp = new ContentPanel();
    cp.setBodyBorder(true);
    // cp.setIcon(Resources.ICONS.table());
    cp.setHeading("Available Linksets");
    cp.setButtonAlign(HorizontalAlignment.CENTER);
    cp.setLayout(new FitLayout());
    cp.getHeader().setIconAltText("Grid Icon");
    cp.setSize(600, 300);

    // final Grid<TaskDescription>
    grid = new Grid<TaskDescription>(getStocks(), cm);
    grid.setStyleAttribute("borderTop", "none");
    grid.setAutoExpandColumn("name");
    grid.setBorders(false);
    grid.setStripeRows(true);
    grid.setColumnLines(true);
    grid.setColumnReordering(true);
    grid.getAriaSupport().setLabelledBy(cp.getHeader().getId() + "-label");
    cp.add(grid);

    ToolBar toolBar = new ToolBar();
    toolBar.getAriaSupport().setLabel("Grid Options");

    toolBar.add(new LabelToolItem("Selection Mode: "));
    final SimpleComboBox<String> type = new SimpleComboBox<String>();
    type.getAriaSupport().setLabelledBy(toolBar.getItem(0).getId());
    type.setTriggerAction(TriggerAction.ALL);
    type.setEditable(false);
    type.setFireChangeEventOnSetValue(true);
    type.setWidth(100);
    type.add("Row");
    type.add("Cell");
    type.setSimpleValue("Row");
    type.addListener(
        Events.Change,
        new Listener<FieldEvent>() {
          public void handleEvent(FieldEvent be) {
            boolean cell = type.getSimpleValue().equals("Cell");
            grid.getSelectionModel().deselectAll();
            if (cell) {
              grid.setSelectionModel(new CellSelectionModel<TaskDescription>());
            } else {
              grid.setSelectionModel(new GridSelectionModel<TaskDescription>());
            }
          }
        });
    toolBar.add(type);

    cp.setTopComponent(toolBar);

    add(cp);

    // needed to enable quicktips (qtitle for the heading and qtip for the
    // content) that are setup in the change GridCellRenderer
    new QuickTip(grid);
  }
コード例 #6
0
ファイル: Smape.java プロジェクト: rabbbit/mock-up-with-GWT
  private Window createAccordionWindow() {
    final Window w = new Window();
    w.setMinimizable(true);
    w.setMaximizable(true);
    w.setIcon(IconHelper.createStyle("accordion"));
    w.setHeading("Contact list");
    w.setWidth(200);
    w.setHeight(350);

    ToolBar toolBar = new ToolBar();
    Button item = new Button();
    item.setIcon(IconHelper.createStyle("icon-connect"));
    toolBar.add(item);

    toolBar.add(new SeparatorToolItem());
    w.setTopComponent(toolBar);

    item = new Button();
    item.setIcon(IconHelper.createStyle("icon-user-add"));
    toolBar.add(item);

    item = new Button();
    item.setIcon(IconHelper.createStyle("icon-user-delete"));
    toolBar.add(item);

    w.setLayout(new AccordionLayout());

    ContentPanel cp = new ContentPanel();
    cp.setAnimCollapse(false);
    cp.setHeading("Online Users");
    cp.setScrollMode(Scroll.AUTO);
    cp.getHeader().addTool(new ToolButton("x-tool-refresh"));

    w.add(cp);

    TreeStore<ModelData> store = new TreeStore<ModelData>();
    TreePanel<ModelData> tree = new TreePanel<ModelData>(store);
    tree.setIconProvider(
        new ModelIconProvider<ModelData>() {

          public AbstractImagePrototype getIcon(ModelData model) {
            if (model.get("icon") != null) {
              return IconHelper.createStyle((String) model.get("icon"));
            } else {
              return null;
            }
          }
        });
    tree.setDisplayProperty("name");

    ModelData m = newItem("Eurecom", null);
    store.add(m, false);
    tree.setExpanded(m, true);

    store.add(m, newItem("Emerson Milton", "user-suit"), false);
    store.add(m, newItem("Christina Blake", "user-girl"), false);
    store.add(m, newItem("Heriberto Rush", "user-kid"), false);
    store.add(m, newItem("Candice Carson", "user-girl"), false);
    store.add(m, newItem("Bell Snedden", "user-kid"), false);
    store.add(m, newItem("Dirk Newman", "user-kid"), false);
    store.add(m, newItem("Chad Andrews", "user-suit"), false);

    m = newItem("Italy", null);
    store.add(m, false);
    tree.setExpanded(m, true);
    store.add(m, newItem("Benito Meeks", "user-suit"), false);
    store.add(m, newItem("Gail Horton", "user-girl"), false);

    m = newItem("Paris", null);
    store.add(m, false);
    tree.setExpanded(m, true);
    store.add(m, newItem("Claudio Engle", "user-suit"), false);
    store.add(m, newItem("Sine", "user-girl"), false);

    m = newItem("Hometown", null);
    store.add(m, false);
    tree.setExpanded(m, true);
    store.add(m, newItem("Hollie Voss", "user-girl"), false);

    cp.add(tree);

    cp = new ContentPanel();
    cp.setAnimCollapse(false);
    cp.setHeading("Settings");
    cp.setBodyStyleName("pad-text");
    cp.addText("Smape1");
    w.add(cp);

    cp = new ContentPanel();
    cp.setAnimCollapse(false);
    cp.setHeading("Blocked");
    cp.setBodyStyleName("pad-text");
    cp.addText("Smape2");
    w.add(cp);

    return w;
  }