Пример #1
0
  public TradeTab() {
    HorizontalSplitPanel mainPanel = new HorizontalSplitPanel();
    mainPanel.setHeight("100%");

    VerticalLayout leftPanel = new VerticalLayout();
    leftPanel.setMargin(true);
    leftPanel.setSpacing(true);
    leftPanel.setHeight("100%");

    itemContainer.addContainerProperty("auction", AuctionService.class, null);
    itemContainer.addContainerProperty("id", String.class, null);
    itemContainer.addContainerProperty("description", String.class, null);
    itemContainer.addContainerProperty("startingPrice", Long.class, null);
    itemContainer.addContainerProperty("item", AuctionItem.class, null);

    itemTable.addStyleName("h1");
    //		itemTable.addStyleName("noheader");
    itemTable.setSelectable(true);
    itemTable.setImmediate(true);
    itemTable.setVisibleColumns(new String[] {"description", "startingPrice"});
    itemTable.setColumnHeaders(new String[] {"Description", "Starting Price"});
    itemTable.setSizeFull();

    itemTable.addListener(
        new Property.ValueChangeListener() {
          public void valueChange(ValueChangeEvent event) {
            Application application = getApplication();
            if (application instanceof UriFragmentService)
              ((UriFragmentService) application).setUriFragment(getCurrentUriFragment(), false);

            Object itemId = itemTable.getValue();
            AuctionItem item =
                itemId != null
                    ? (AuctionItem) itemTable.getContainerProperty(itemId, "item").getValue()
                    : null;
            for (Iterator<Component> iter = dynamicLayout.getComponentIterator();
                iter.hasNext(); ) {
              Component component = iter.next();
              if (component instanceof SelectionListener<?>) {
                ((SelectionListener<AuctionItem>) component).selectionChanged(item);
              }
            }
          }
        });

    leftPanel.addComponent(itemTable);
    leftPanel.setExpandRatio(itemTable, 1f);

    // Button panel
    VerticalLayout buttonBarLayout = new VerticalLayout();
    buttonBar = new DynamicContainer(buttonBarLayout);
    buttonBar.setWidth("100%");
    leftPanel.addComponent(buttonBar);

    // Progress Indicator (hidden)
    ProgressIndicator progress = new ProgressIndicator(ProgressIndicator.SIZE_UNDEFINED);
    progress.addStyleName("hidden");
    progress.setPollingInterval(POLL_INTERVAL);
    leftPanel.addComponent(progress);
    leftPanel.setExpandRatio(progress, 0f);

    mainPanel.addComponent(leftPanel);
    mainPanel.addComponent(container);

    Table table = new Table();
    table.setSizeFull();

    setCompositionRoot(mainPanel);
    setCaption("Trade");
    setSizeFull();
  }
Пример #2
0
 protected void unbindComponent(ComponentFactory factory) {
   container.unbindComponent(factory);
 }
Пример #3
0
 protected void unbindCommandFactory(ComponentFactory factory) {
   buttonBar.unbindComponent(factory);
 }
Пример #4
0
 @Reference(type = '*', target = "(component.factory=org.example.trader.gui.panels.trade/*)")
 protected void bindComponent(ComponentFactory factory) {
   container.bindComponent(factory);
 }
Пример #5
0
 @Reference(
     type = '*',
     target = "(component.factory=org.example.trader.gui.panels.trade.commands/*)")
 protected void bindCommandFactory(ComponentFactory factory) {
   buttonBar.bindComponent(factory);
 }