Esempio n. 1
0
  public ContentPanel initWeiget() {
    // ----

    // ----
    ContentPanel panel = new ContentPanel();
    panel.setLayout(new BorderLayout());
    BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 150);
    westData.setSplit(true);
    westData.setCollapsible(true);
    westData.setMargins(new Margins(0));
    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
    centerData.setMargins(new Margins(5, 0, 5, 0));

    panel.add(CreateCcodeLeftPanel(), westData);

    TabPanel tabpanel = new TabPanel();

    tabpanel.setWidth(450);
    tabpanel.setHeight(450);
    tabpanel.setAutoHeight(true);
    TabItem normal = new TabItem("基本信息");
    normal.add(CreateCCodeDetailPanel());

    ContentPanel branchorg = new ContentPanel(); // createCcodebranchorgaddPanel
    TabItem bangogndizhi = new TabItem("办公地点和分支机构");

    branchorg.setHeight(400);
    branchorg.setHeaderVisible(false);
    branchorg.setLayout(new RowLayout(Orientation.VERTICAL));
    branchorg.add(createOfficePanel(), new RowData(1, 0.5));
    branchorg.add(createCcodebranchorgaddPanel(), new RowData(1, 0.5));
    bangogndizhi.add(branchorg);

    TabItem lianxiren = new TabItem("联系人信息");
    lianxiren.add(createLinkManPanel());

    final TabItem searchframe = new TabItem("查询相关信息");
    searchframe.setAutoHeight(true);
    final BaseSerchHtml bsh = new BaseSerchHtml();
    searchframe.add(bsh.getSearchFrame());
    searchframe.addListener(
        Events.Select,
        new Listener() {

          @Override
          public void handleEvent(BaseEvent be) {
            bsh.SearchHtml(
                store.getValue("cname") == null ? "" : store.getValue("cname").toString());
          }
        });
    /** store 换行的时候进行关键字的搜索 */
    store.addBaseStoreListener(
        BaseStoreEvent.EventType.ROW_CHANGED,
        new BaseStoreListener() {

          @Override
          public void BaseStoreEventHandle(BaseStoreEvent evt) {
            if (evt.getEventType() == BaseStoreEvent.EventType.ROW_CHANGED) {

              if (searchframe.isVisible()) {
                bsh.SearchHtml(
                    store.getValue("cname") == null ? "" : store.getValue("cname").toString());
              }
            }
          }

          @Override
          public void onBrowserEvent(Event event) {
            // TODO Auto-generated method stub

          }
        });
    tabpanel.add(normal);
    tabpanel.add(bangogndizhi);
    tabpanel.add(lianxiren);
    tabpanel.add(searchframe);

    panel.add(tabpanel, centerData);

    registerMainStore(store);
    registerStore(store);
    return panel;
  }
  @Inject
  public ProjectIndicatorsContainer(
      ProjectSiteGridPanel siteEditor,
      SiteMap siteMap,
      final DesignPanel designPanel,
      Dispatcher service,
      EventBus eventBus) {

    this.siteEditor = siteEditor;
    this.siteMap = siteMap;
    this.designPanel = designPanel;
    this.service = service;
    this.eventBus = eventBus;

    BorderLayout borderLayout = new BorderLayout();
    borderLayout.setContainerStyle("x-border-layout-ct main-background");
    setLayout(borderLayout);

    ContentPanel mainPanel = new ContentPanel();
    mainPanel.setIcon(null);
    mainPanel.setLayout(new FitLayout());
    mainPanel.setSize(600, 300);

    // setIcon(IconImageBundle.ICONS.design());
    // map tab panel
    tabPanel = new TabPanel();
    tabPanel.setPlain(true);

    // map tab item
    mapTabItem = new TabItem("map");
    mapTabItem.setLayout(new FitLayout());
    mapTabItem.setEnabled(false);
    mapTabItem.setAutoHeight(true);
    mapTabItem.setEnabled(true);
    mapTabItem.add(siteMap);
    tabPanel.add(mapTabItem);

    // sites tab item
    sitesTabItem = new TabItem("sites");
    sitesTabItem.setLayout(new FitLayout());
    sitesTabItem.setEnabled(false);
    sitesTabItem.setAutoHeight(true);
    sitesTabItem.setEnabled(true);
    sitesTabItem.add(siteEditor);
    tabPanel.add(sitesTabItem);

    // buttons for indicator view
    newIndicatorButton = new Button("new indicator");
    newGroupButton = new Button("new group");
    reloadButton = new Button("reload button");

    mainPanel.add(newIndicatorButton);
    mainPanel.add(newGroupButton);
    mainPanel.add(reloadButton);

    BorderLayoutData centerLayout = new BorderLayoutData(Style.LayoutRegion.CENTER);
    centerLayout.setMargins(new Margins(0, 0, 0, 0));
    centerLayout.setSplit(true);
    centerLayout.setCollapsible(true);

    BorderLayoutData layout = new BorderLayoutData(Style.LayoutRegion.EAST);
    layout.setSplit(true);
    layout.setCollapsible(true);
    layout.setSize(375);
    layout.setMargins(new Margins(0, 0, 0, 5));

    add(designPanel, centerLayout);
    designPanel
        .getMappedIndicator()
        .addValueChangeHandler(
            new ValueChangeHandler<IndicatorDTO>() {

              @Override
              public void onValueChange(ValueChangeEvent<IndicatorDTO> event) {
                onMappedIndicatorChanged(event.getValue());
              }
            });

    add(tabPanel, layout);
    // setHeading(I18N.CONSTANTS.design() + " - " );

    siteEditor.addActionListener(
        new Listener<ComponentEvent>() {

          @Override
          public void handleEvent(ComponentEvent be) {
            if (UIActions.add.equals(be.getComponent().getItemId())) {
              addSite();
            }
          }
        });
  }