Exemple #1
0
  /** @return the design's main column */
  public static Column getMainColumn() {

    if (designPanel != null) {
      return designPanel.getMainColum();
    } else {
      return null;
    }
  }
  public void loadProject(ProjectDTO projectDTO) {

    // load design panel
    designPanel.load(projectDTO.getId());

    // load site grid
    Filter siteFilter = new Filter();
    siteFilter.addRestriction(DimensionType.Database, projectDTO.getId());
    siteEditor.load(siteFilter);
  }
  @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();
            }
          }
        });
  }