예제 #1
0
 /**
  * DOC bessaies Comment method "updateBlockLayout".
  *
  * @param event
  */
 private void updateBlockLayout(Object source) {
   ContentPanel contentPanel = mapHeaderGroup.get(source);
   if (null != contentPanel) {
     if (contentPanel.isCollapsed()) {
       contentPanel.expand();
     } else {
       contentPanel.collapse();
     }
     contentPanel.layout(true);
   }
 }
예제 #2
0
파일: AppView.java 프로젝트: nmco/geofence
  /** Creates the south. */
  private void createSouth() {
    BorderLayoutData data =
        new BorderLayoutData(LayoutRegion.SOUTH, Constants.SOUTH_PANEL_DIMENSION + 25);
    // data.setMargins(new Margins(5, 5, 5, 5));
    // data.setHideCollapseTool(false);
    data.setMargins(new Margins(5, 0, 0, 0));
    data.setCollapsible(true);
    data.setSplit(false);

    /*
     * south = new ContentPanel(); south.setBodyBorder(false); south.setAnimCollapse(true);
     * south.setCollapsible(true); south.setLayout(new FitLayout());
     * south.setLayoutOnChange(true); south.setScrollMode(Scroll.AUTOY);
     * south.setHeaderVisible(true);
     * south.setHeading(I18nProvider.getMessages().accordionLabel());
     * south.setMonitorWindowResize(true); south.setLayoutOnChange(true); south.layout();
     */
    south = new ContentPanel();
    south.setBodyBorder(false);
    south.setLayout(new FitLayout());
    south.setScrollMode(Scroll.AUTOY);
    south.setHeaderVisible(true);
    // south.setHeading(I18nProvider.getMessages().accordionLabel());
    south.setMonitorWindowResize(true);
    south.setLayoutOnChange(true);
    south.layout();

    south.addListener(
        Events.Resize,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            Dispatcher.forwardEvent(GeoGWTEvents.UPDATE_MAP_SIZE);
            // Dispatcher.forwardEvent(GeofenceEvents.UPDATE_SOUTH_SIZE);
          }
        });
    south.addListener(
        Events.Move,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            Dispatcher.forwardEvent(GeoGWTEvents.UPDATE_MAP_SIZE);
            // Dispatcher.forwardEvent(GeofenceEvents.UPDATE_SOUTH_SIZE);
          }
        });
    this.tabWidget = new TabWidget();

    south.add(this.tabWidget);

    Dispatcher.forwardEvent(GeofenceEvents.ATTACH_BOTTOM_TAB_WIDGETS, this.tabWidget);

    center.add(south, data);
  }
예제 #3
0
 @Override
 public void fillContainer(Widget widget) {
   container.add(widget);
   container.layout();
 }
예제 #4
0
 /**
  * Remove a generic widget from Panel
  *
  * @param w
  */
 public static void removeComponentFromPanel(ContentPanel cp, Widget w) {
   cp.remove(w);
   cp.layout();
 }
예제 #5
0
  @Override
  protected void initialize() {
    super.initialize();

    final CardLayout layout = new CardLayout();
    final ContentPanel sectionPanel = new ContentPanel();
    sectionPanel.setHeaderVisible(Boolean.FALSE);
    sectionPanel.setLayout(layout);
    sectionPanel.setBodyBorder(Boolean.FALSE);
    sectionPanel.setBorders(Boolean.FALSE);
    sectionPanel.setBodyStyle("border: 0px solid black;");

    TreeStore<TreeModel> treeStore = new TreeStore<TreeModel>();
    TreePanel<TreeModel> treePanel = new TreePanel<TreeModel>(treeStore);
    treePanel.setWidth(150);
    treePanel.setDisplayProperty("id");
    treePanel.addStyleName("pige-help-topic-list-panel");
    TreePanelSelectionModel treeSelectionModel = new TreePanelSelectionModel();
    treeSelectionModel.setSelectionMode(SelectionMode.SINGLE);
    treeSelectionModel.bindTree(treePanel);
    treeSelectionModel.addSelectionChangedListener(
        new SelectionChangedListener<SectionNode>() {

          @Override
          public void selectionChanged(SelectionChangedEvent<SectionNode> se) {
            SectionNode node = se.getSelectedItem();
            ContentPanel c = node.getContent();
            if (c != null) {
              layout.setActiveItem(c);
              sectionPanel.layout();
            }
          }
        });

    Role role = Registry.get(PIGE.ROLE_OBJECT);
    if (role.getAppManagement()) {
      sectionPanel.add(getGeneralSection());
      SectionNode generalSectionNode = new SectionNode(messages.general(), getGeneralSection());
      treeStore.add(generalSectionNode, true);
    }
    if (role.getManageLoan()) {
      sectionPanel.add(getLateLoanReportSection());
      SectionNode reportSectionNode = new SectionNode(messages.reports());
      SectionNode lateLoanReportSectionNode =
          new SectionNode(messages.lateLoans(), getLateLoanReportSection());
      reportSectionNode.add(lateLoanReportSectionNode);
      treeStore.add(reportSectionNode, true);
    }

    BorderLayoutData westLD = new BorderLayoutData(LayoutRegion.WEST, 175);
    westLD.setMargins(new Margins(0, 0, 0, 0));
    westLD.setSplit(Boolean.TRUE);
    BorderLayoutData centerLD = new BorderLayoutData(LayoutRegion.CENTER);

    contentPanel.setBodyStyle("background-color: white;");
    contentPanel.add(treePanel, westLD);
    contentPanel.add(sectionPanel, centerLD);

    contentPanel.layout();

    ContentPanel panel = Registry.get(AppWidgets.APP_CONTENT_PANEL);
    panel.add(contentPanel);
    panel.layout();
  }
 public void setCenterContent(Widget w) {
   centerPanel.removeAll();
   if (w != null) centerPanel.add(w);
   centerPanel.layout();
 }
 public void refreshTree() {
   westPanel.removeAll();
   westPanel.add(new MenuTreePanel(new MenuDataStore()));
   westPanel.layout();
 }
예제 #8
0
  protected void receiveGroups(Map groups2Permissions) {
    this.groups2Permissions = groups2Permissions;
    mainPanel.clear();

    ContentPanel cp = new FullContentPanel();
    cp.setHeading(administrationConstants.usersGroup());

    // add inline help string and widget
    //        cp.setTopComponent(new
    // InlineHelpPanel(galaxy.getRepositoryConstants().repo_Security_Tip(), 15));
    mainPanel.add(cp);

    table = createRowTable();
    cp.add(table);

    int col = 1;
    table.setWidget(0, 0, new Image("images/clearpixel.gif"));
    for (Iterator itr = permissions.iterator(); itr.hasNext(); ) {
      WPermission p = (WPermission) itr.next();
      table.setWidget(0, col, createTitleText(p.getDescription()));

      col++;
    }

    rows = new ArrayList<String>();
    for (Iterator itr = groups2Permissions.keySet().iterator(); itr.hasNext(); ) {
      rows.add(((WGroup) itr.next()).getName());
    }
    Collections.sort(rows);

    for (Iterator itr = groups2Permissions.entrySet().iterator(); itr.hasNext(); ) {
      Map.Entry e = (Map.Entry) itr.next();

      final WGroup role = (WGroup) e.getKey();
      final String groupName = role.getName();
      final Hyperlink hl = new Hyperlink(groupName, "groups/" + role.getId());

      int row = rows.indexOf(groupName) + 1;

      // certain groups should not be removed or edited via the GUI
      boolean isUberGroup = groupName.equals("Administrators") || groupName.equals("Anonymous");
      if (isUberGroup) {
        table.setWidget(row, 0, new Label(groupName));
      } else {
        table.setWidget(row, 0, hl);
      }

      Collection grants = (Collection) e.getValue();
      for (Iterator gItr = grants.iterator(); gItr.hasNext(); ) {
        WPermissionGrant pg = (WPermissionGrant) gItr.next();
        int permCol = getPermissionColumn(pg.getPermission().getName());
        if (permCol != -1) {
          Widget w = createGrantWidget(pg, isUberGroup);
          table.setWidget(row, permCol, w);
        }
      }
      row++;
    }

    // table.getFlexCellFormatter().setColSpan(rows.size() + 1, 0, col);

    SelectionListener listener =
        new SelectionListener<ComponentEvent>() {
          public void componentSelected(ComponentEvent ce) {
            Button btn = (Button) ce.getComponent();

            if (btn == applyButton) {
              beginApply();
            }
            if (btn == resetButton) {
              // Go back to the previously saved state.
              errorPanel.clearErrorMessage();
              doShowPage();
            }
          }
        };

    applyButton = new Button(administrationConstants.save(), listener);
    resetButton = new Button(administrationConstants.cancel(), listener);

    ButtonBar bb = new ButtonBar();
    bb.add(applyButton);
    bb.add(resetButton);
    bb.add(createHistoryButton(administrationConstants.newAdmin(), "groups/new"));

    // table.setWidget(rows.size() + 1, 0, bb);
    cp.add(bb);

    cp.layout(true);
  }