protected void reloadFoglioOre() {

      setHeight(480);
      setWidth(680);

      dtfldGiorno.setValue(giornoRiferimento.getValue());

      cmbxDipendente.setFieldLabel("Dipendente");
      cmbxDipendente.setEnabled(true);
      cmbxDipendente.setEmptyText("Selezionare il dipendente..");
      cmbxDipendente.setEditable(false);
      cmbxDipendente.setVisible(true);
      cmbxDipendente.setTriggerAction(TriggerAction.ALL);
      cmbxDipendente.setAllowBlank(false);
      cmbxDipendente.setDisplayField("nomeCompleto");
      cmbxDipendente.addListener(
          Events.OnClick,
          new Listener<BaseEvent>() {
            @Override
            public void handleEvent(BaseEvent be) {
              getAllDipendenti();
            }
          });

      ButtonBar buttonBarTop = new ButtonBar();
      buttonBarTop.setAlignment(HorizontalAlignment.CENTER);
      buttonBarTop.setStyleAttribute("padding-bottom", "5px");
      buttonBarTop.setBorders(false);
      buttonBarTop.setWidth(570);
      buttonBarTop.setItemId("buttonBar");

      buttonBarTop.add(giornoRiferimento);
      buttonBarTop.add(cmbxDipendente);
      buttonBarTop.add(btnSend);

      ButtonBar btnBarOperazioni = new ButtonBar();
      btnBarOperazioni.setAlignment(HorizontalAlignment.LEFT);
      btnBarOperazioni.setBorders(false);
      btnBarOperazioni.add(btnRiepilogoCommesse);
      btnBarOperazioni.add(btnInviaCommenti);
      btnBarOperazioni.add(btnConferma);

      left.removeAll();
      right.removeAll();

      left.add(btnBarOperazioni);
      left.add(buttonBarTop);
      // left.add(new FldsetIntervalliIU());
      left.add(new FldsetIntervalliCommesse());

      // right.add(new FldsetGiustificativi());
      // right.add(new FldsetRiepilogo());

      main.removeAll();
      main.add(left);
      main.add(right);
      main.layout(true);

      frm.layout(true);
    }
  /**
   * Creates the center view in viewport by the user role, if the role is building modeler, then
   * show the building modeler view, else show the ui designer view.
   *
   * @param authority the authority
   */
  private void createCenter(Authority authority) {
    List<String> roles = authority.getRoles();
    modelerContainer = new LayoutContainer();
    modelerContainer.setLayout(new FitLayout());
    WidgetSelectionUtil widgetSelectionUtil = new WidgetSelectionUtil(eventBus);
    if (roles.contains(Role.ROLE_ADMIN)
        || (roles.contains(Role.ROLE_DESIGNER) && roles.contains(Role.ROLE_MODELER))) {
      this.buildingModelerView = new BuildingModelerView(eventBus);
      this.uiDesignerView = new UIDesignerView(widgetSelectionUtil);
      this.uiDesignerPresenter =
          new UIDesignerPresenter(eventBus, this.uiDesignerView, widgetSelectionUtil);
      if (Role.ROLE_DESIGNER.equals(Cookies.getCookie(Constants.CURRETN_ROLE))) {
        modelerContainer.add(uiDesignerView);
      } else {
        modelerContainer.add(buildingModelerView);
      }
    } else if (roles.contains(Role.ROLE_MODELER) && !roles.contains(Role.ROLE_DESIGNER)) {
      this.buildingModelerView = new BuildingModelerView(eventBus);
      modelerContainer.add(buildingModelerView);
    } else if (roles.contains(Role.ROLE_DESIGNER) && !roles.contains(Role.ROLE_MODELER)) {
      this.uiDesignerView = new UIDesignerView(widgetSelectionUtil);
      this.uiDesignerPresenter =
          new UIDesignerPresenter(eventBus, this.uiDesignerView, widgetSelectionUtil);
      modelerContainer.add(uiDesignerView);
    }

    BorderLayoutData data = new BorderLayoutData(Style.LayoutRegion.CENTER);
    data.setMargins(new Margins(0, 5, 0, 5));
    viewport.add(modelerContainer, data);
  }
  public void initWidgets(
      Component leftTree,
      Component topTable,
      Component bottomTabs,
      Component topToolbar,
      Component statusBar) {
    if (topToolbar != null) {
      topToolbar.setId("JahiaGxtManagerToolbar");
      setTopComponent(topToolbar);
    }

    if (statusBar != null) {
      statusBar.setId("JahiaGxtManagerStatusbar");
      setBottomComponent(statusBar);
    }

    // east panels may contain either a table and the details, or only a table
    LayoutContainer eastPanels = new LayoutContainer();
    eastPanels.setLayout(new BorderLayout());
    if (bottomTabs != null) {
      centerData.setSplit(true);
      bottomTabs.setId("JahiaGxtManagerBottomTabs");
      eastPanels.add(bottomTabs, centerData);
    }

    if (topTable != null) {

      northData.setSplit(true);
      topTable.setId("JahiaGxtManagerTobTable");
      eastPanels.add(topTable, northData);
    }

    // this is the main layout, containing a toolbar at the top, an optional tree on the left,
    // and the layout defined previously (table + details)
    LayoutContainer layout = new LayoutContainer();
    layout.setLayout(new BorderLayout());

    if (leftTree != null) {
      westData.setSplit(true);
      westData.setCollapsible(true);
      leftTree.setId("JahiaGxtManagerLeftTree");
      layout.add(leftTree, westData);
    }

    layout.add(eastPanels, new BorderLayoutData(Style.LayoutRegion.CENTER));

    layout.setId("JahiaGxtManagerMain");

    layout.setId("JahiaGxtManagerMain");

    // layout is the main widget contained in the viewport
    add(layout);
  }
 private LayoutContainer getFirstRowRightSide() {
   if (firstRowRightSide == null) {
     firstRowRightSide = new LayoutContainer();
     FormLayout formLayout = new FormLayout();
     formLayout.setLabelWidth(50);
     firstRowRightSide.setLayout(formLayout);
     firstRowRightSide.add(getCheckBox(), new FormData("100%"));
     FormData formData = new FormData("");
     formData.setWidth(150);
     firstRowRightSide.add(getEmailTextField(), formData);
   }
   return firstRowRightSide;
 }
 private LayoutContainer getFirstRowLeftSide() {
   if (firstRowLeftSide == null) {
     firstRowLeftSide = new LayoutContainer();
     firstRowLeftSide.setLayout(new FormLayout());
     FormData formData = new FormData(null);
     formData.setWidth(155);
     formData.setMargins(new Margins(0, 0, 0, 0));
     firstRowLeftSide.add(getJobnameTextField(), formData);
     FormData formData_1 = new FormData(null);
     formData_1.setWidth(155);
     firstRowLeftSide.add(getVoComboBox(), formData_1);
   }
   return firstRowLeftSide;
 }
示例#6
0
  private void initUI() {
    long time = new java.util.Date().getTime();
    GWT.log("Initializing the UI ", null);

    permissions = Registry.get(Constants.LOGIN_USER_PERMISSIONS);

    //		container = new LayoutContainer();
    container = new ContentPanel();
    container.setLayout(new BorderLayout());
    container.setHeading("User Profile");

    formButtonContainer = new LayoutContainer();
    formButtonContainer.setScrollMode(Scroll.AUTO);

    TableLayout identlayout = new TableLayout(2);
    identlayout.setWidth("100%");
    identlayout.setCellSpacing(5);
    identlayout.setCellVerticalAlign(VerticalAlignment.TOP);

    TableLayout formlayout = new TableLayout(2);
    formlayout.setWidth("100%");
    formlayout.setCellSpacing(5);
    formlayout.setCellVerticalAlign(VerticalAlignment.TOP);

    formContainer = new LayoutContainer();
    //			formContainer.setBorders(true);
    formContainer.setLayout(formlayout);
    leftFormPanel = setupUserLeftForm("", 1);
    rightFormPanel = setupUserRightForm("", 8);

    formContainer.add(leftFormPanel);
    formContainer.add(rightFormPanel);
    buttonPanel = setupButtonPanel(17);

    formButtonContainer.add(formContainer);
    formButtonContainer.add(buttonPanel);

    // check permissions
    checkPermissins();

    BorderLayoutData data = new BorderLayoutData(LayoutRegion.CENTER);
    data.setMargins(new Margins(4, 2, 4, 2));
    container.add(formButtonContainer, data);

    LayoutContainer wrapper = (LayoutContainer) Registry.get(Constants.CENTER_PANEL);
    wrapper.removeAll();
    wrapper.add(container);
    wrapper.layout();
    GWT.log("Done Initializing the UI in " + (new java.util.Date().getTime() - time), null);
  }
  public void load() {

    BorderLayout layout = new BorderLayout();
    // layout.setMargin(2);

    LayoutContainer full = new LayoutContainer();
    full.setLayout(layout);
    full.setLayoutOnChange(true);

    full.add(getInstructions(), new BorderLayoutData(LayoutRegion.NORTH, HEADER_HEIGHT));
    full.add(getLeftSide(), new BorderLayoutData(LayoutRegion.WEST, PANEL_WIDTH / 2 - 5));
    full.add(getRightSide(), new BorderLayoutData(LayoutRegion.CENTER, PANEL_WIDTH / 2 - 5));
    // full.setSize(PANEL_WIDTH + 10, PANEL_HEIGHT + 5);
    add(full);
  }
示例#8
0
 private final LayoutContainer createAccountChoice() {
   LayoutContainer panel = new LayoutContainer();
   panel.setLayout(new FillLayout());
   panel.add(createAccountPanel());
   panel.setHeight(30);
   return panel;
 }
示例#9
0
  @Override
  public void initialize() {

    mainPanel = Panels.content("");
    mainPanel.setHeaderVisible(false);

    Label label = new Label(I18N.CONSTANTS.projectCoreSelectVersion());

    mainPanel.add(label);

    amendmentsComboBox1 = new ComboBox<AmendmentDTO>();
    amendmentsComboBox1.setStore(new ListStore<AmendmentDTO>());
    amendmentsComboBox1.setDisplayField("name");
    amendmentsComboBox1.setTriggerAction(ComboBox.TriggerAction.ALL);

    amendmentsComboBox2 = new ComboBox<AmendmentDTO>();
    amendmentsComboBox2.setStore(new ListStore<AmendmentDTO>());
    amendmentsComboBox2.setDisplayField("name");
    amendmentsComboBox2.setTriggerAction(ComboBox.TriggerAction.ALL);

    final LayoutContainer container = Layouts.hBox(HBoxLayoutAlign.TOP);

    container.add(amendmentsComboBox1, Layouts.hBoxData(Margin.LEFT));
    container.add(amendmentsComboBox2, Layouts.hBoxData(Margin.LEFT));

    projectFields = buildGrid();

    mainPanel.setScrollMode(Scroll.AUTO);
    mainPanel.add(container);
    mainPanel.add(projectFields);

    initPopup(mainPanel);
  }
示例#10
0
  private <T> void buildField(
      Config config, String label, Field<T> field, LayoutContainer c1, LayoutContainer c2) {
    assert null != field : "field shouldn't be null";

    field.setFieldLabel(label);
    field.addListener(Events.SelectionChange, this);
    field.addListener(Events.Change, this);
    field.addListener(Events.Focus, this);
    field.addListener(Events.KeyPress, this);
    field.addListener(Events.KeyDown, this);
    field.addListener(Events.KeyUp, this);
    field.addListener(Events.SpecialKey, this);
    MessageWidget messageWidget = new MessageWidget();
    c1.add(field, new FormData("-20"));
    c2.add(messageWidget);
    mapKeyStatus.put(config, messageWidget);
  }
示例#11
0
  private void createDesignPanel() {

    // create main panel
    mainContainer = new LayoutContainer();
    final BorderLayout layout = new BorderLayout();
    mainContainer.setLayout(layout);
    mainContainer.setAutoWidth(true);
    mainContainer.setHeight(HEIGHT);
    mainContainer.addStyleName("design-main-panel");

    // north zone
    final BorderLayoutData upperLayoutData = new BorderLayoutData(LayoutRegion.NORTH);
    NorthPanel upperPanel = PmsFactory.getInstance().getNorthPanel();
    upperPanel.init(page, pageLayoutDto);
    upperLayoutData.setSize(UPPER_PANEL_HEIGHT);

    // west zone
    final BorderLayoutData leftLayoutData = new BorderLayoutData(LayoutRegion.WEST, 220, 150, 320);
    palettesPanel = PmsFactory.getInstance().getPalettesPanel();
    palettesPanel.init(pageLayoutDto);
    leftLayoutData.setSplit(true);
    leftLayoutData.setCollapsible(true);
    leftLayoutData.setSize(LEFT_PANEL_WIDTH);
    leftLayoutData.setMargins(new Margins(PANEL_MARGIN));

    // east zone
    final BorderLayoutData rightLayoutData = new BorderLayoutData(LayoutRegion.EAST);
    ComponentsTreePanel rightPanel = PmsFactory.getInstance().getRightPanel();
    rightPanel.init(page);
    rightLayoutData.setSplit(true);
    rightLayoutData.setCollapsible(true);
    // rightLayoutData.setSize(RIGHT_PANEL_WIDTH);
    rightLayoutData.setMargins(new Margins(PANEL_MARGIN));

    // design zone
    final BorderLayoutData centerLayoutData = new BorderLayoutData(LayoutRegion.CENTER);
    designPanel = new DesignPanel(pageLayoutDto);
    centerLayoutData.setMargins(new Margins(PANEL_MARGIN, 0, PANEL_MARGIN, 0));

    mainContainer.add(upperPanel, upperLayoutData);
    mainContainer.add(palettesPanel, leftLayoutData);
    mainContainer.add(designPanel, centerLayoutData);
    mainContainer.add(rightPanel, rightLayoutData);
    add(mainContainer);
  }
示例#12
0
 private final LayoutContainer createTreePanel() {
   LayoutContainer panel = new LayoutContainer();
   panel.setLayout(new RowLayout());
   panel.add(new LabelField(constants.views() + ":"));
   LayoutContainer treePanel = new LayoutContainer();
   selectionTree = new ViewSelectionTree(importViews, false);
   Tree viewTree = selectionTree.getTree();
   viewTree.setCheckable(true);
   //		treePanel.setSize(210, 200);
   treePanel.setWidth("100%");
   treePanel.setHeight(200);
   treePanel.setBorders(true);
   treePanel.setScrollMode(Scroll.AUTOY);
   treePanel.setStyleAttribute("backgroundColor", "white");
   treePanel.add(viewTree);
   panel.add(treePanel);
   return panel;
 }
示例#13
0
 private LayoutContainer getLayoutContainer_1() {
   if (layoutContainer_1 == null) {
     layoutContainer_1 = new LayoutContainer();
     FormLayout formLayout = new FormLayout();
     formLayout.setLabelAlign(LabelAlign.TOP);
     layoutContainer_1.setLayout(formLayout);
     layoutContainer_1.add(getVersionComboBox(), new FormData("100%"));
   }
   return layoutContainer_1;
 }
示例#14
0
 private LayoutContainer getTextAreaContainer() {
   if (textAreaContainer == null) {
     textAreaContainer = new LayoutContainer();
     FormLayout formLayout = new FormLayout();
     formLayout.setLabelAlign(LabelAlign.TOP);
     textAreaContainer.setLayout(formLayout);
     textAreaContainer.add(getCommandLineTextArea(), new FormData("-40 -35"));
   }
   return textAreaContainer;
 }
示例#15
0
  public LayoutContainer getRightSide() {
    BorderLayout layout = new BorderLayout();

    LayoutContainer container = new LayoutContainer();
    container.setLayout(layout);

    container.add(getButtonBar(), new BorderLayoutData(LayoutRegion.SOUTH, .1F));

    selected = new DataList();
    selected.setContextMenu(getListMenu());

    LayoutContainer right = new LayoutContainer();
    right.setLayout(new FillLayout());
    right.add(selected);

    container.add(selected, new BorderLayoutData(LayoutRegion.CENTER, .8F));
    container.setHeight(PANEL_HEIGHT - 20);
    return container;
  }
示例#16
0
 private LayoutContainer getLayoutContainer() {
   if (layoutContainer == null) {
     layoutContainer = new LayoutContainer();
     layoutContainer.setWidth("167px");
     FormLayout formLayout = new FormLayout();
     formLayout.setLabelAlign(LabelAlign.TOP);
     layoutContainer.setLayout(formLayout);
     layoutContainer.add(getCpusComboBox(), new FormData("100%"));
   }
   return layoutContainer;
 }
示例#17
0
 private LayoutContainer getMinutesContainer() {
   if (minutesContainer == null) {
     minutesContainer = new LayoutContainer();
     FormLayout formLayout = new FormLayout();
     formLayout.setLabelAlign(LabelAlign.TOP);
     minutesContainer.setLayout(formLayout);
     FormData formData = new FormData(null);
     formData.setWidth(70);
     minutesContainer.add(getMinutesComboBox(), formData);
   }
   return minutesContainer;
 }
示例#18
0
 private LayoutContainer getHoursContainer() {
   if (hoursContainer == null) {
     hoursContainer = new LayoutContainer();
     FormLayout formLayout = new FormLayout();
     formLayout.setLabelAlign(LabelAlign.TOP);
     hoursContainer.setLayout(formLayout);
     FormData formData = new FormData("");
     formData.setWidth(70);
     hoursContainer.add(getHoursComboBox(), formData);
   }
   return hoursContainer;
 }
示例#19
0
 private LayoutContainer getDaysContainer() {
   if (daysContainer == null) {
     daysContainer = new LayoutContainer();
     FormLayout formLayout = new FormLayout();
     formLayout.setLabelAlign(LabelAlign.TOP);
     daysContainer.setLayout(formLayout);
     FormData formData = new FormData("");
     formData.setWidth(70);
     formData.setMargins(new Margins(0, 0, 0, 0));
     daysContainer.add(getDaysComboBox(), formData);
   }
   return daysContainer;
 }
示例#20
0
  private LayoutContainer getLeftSide() {
    // BorderLayout layout = new BorderLayout();
    RowLayout layout = new RowLayout(Orientation.VERTICAL);
    // layout.setMargin(0);
    // layout.setSpacing(0);

    LayoutContainer container = new LayoutContainer();
    container.setLayout(layout);
    container.setLayoutOnChange(true);
    container.setSize(PANEL_WIDTH / 2, PANEL_HEIGHT);

    children = new DataList();
    children.setSelectionMode(SelectionMode.MULTI);

    TaxonomyCache.impl.getTaxonChildren(
        currentNode.getId() + "",
        new GenericCallback<List<Taxon>>() {
          public void onFailure(Throwable caught) {
            WindowUtils.errorAlert("Error", "Could not fetch children, please try again later.");
          }

          public void onSuccess(List<Taxon> result) {
            for (Taxon taxon : result) {
              DataListItem li = new DataListItem(taxon.getFullName());
              li.setData("nodeID", "" + taxon.getId());
              li.setData("node", taxon);
              children.add(li);
            }
          }
        });

    container.add(
        new HTML("Children currently in " + currentNode.getFullName() + ":"), new RowData(1d, 25));
    container.add(children, new RowData(1d, 1d));

    return container;
  }
示例#21
0
  public void load() {

    currentNode = TaxonomyCache.impl.getCurrentNode();

    BorderLayout layout = new BorderLayout();
    // layout.setMargin(5);
    // layout.setSpacing(5);

    LayoutContainer full = new LayoutContainer();
    full.setLayout(layout);
    full.setLayoutOnChange(true);

    TaxonomyBrowserPanel tp = getTaxonomyBrowserPanel();

    if (currentNode != null) {
      tp.update(currentNode.getId() + "");
    } else {
      tp.update();
    }

    int size = PANEL_WIDTH / 2;

    LayoutContainer left = new LayoutContainer();
    left.setLayout(new FillLayout());
    left.setSize(size, PANEL_HEIGHT);
    left.add(tp);

    full.add(
        new HTML("<b> Instructions:</b> " + getDescription()),
        new BorderLayoutData(LayoutRegion.NORTH, HEADER_HEIGHT));
    full.add(left, new BorderLayoutData(LayoutRegion.WEST, size));
    full.add(getRightSide(), new BorderLayoutData(LayoutRegion.CENTER, size));

    full.setSize(PANEL_WIDTH, PANEL_HEIGHT);

    add(full);
  }
                       // interno
  // quando viene cambiata la data viene resettato anche questo
  protected void onRender(Element target, int index) {
    super.onRender(target, index);

    final FitLayout fl = new FitLayout();

    layoutContainer.setBorders(false);
    layoutContainer.setLayout(fl);
    layoutContainer.setWidth(w - 225);
    layoutContainer.setHeight(h - 54);

    txtfldUsername.setVisible(false);

    selectLayout();

    LayoutContainer bodyContainer = new LayoutContainer();
    bodyContainer.setLayout(new FlowLayout());
    bodyContainer.setBorders(false);

    bodyContainer.add(new CreateFormIntervalliOre());
    bodyContainer.add(txtfldUsername);

    layoutContainer.add(bodyContainer, new FitData(5, 5, 5, 8));
    add(layoutContainer);
  }
  private LayoutContainer createContentContainer() {
    LayoutContainer contentContainer = new LayoutContainer();
    contentContainer.setBorders(false);
    contentContainer.setSize(340, 170);
    HBoxLayout tabbarContainerLayout = new HBoxLayout();
    tabbarContainerLayout.setHBoxLayoutAlign(HBoxLayoutAlign.TOP);
    contentContainer.setLayout(tabbarContainerLayout);

    LayoutContainer contentItemsContainer = new LayoutContainer();
    contentItemsContainer.setBorders(true);
    contentItemsContainer.setWidth(230);
    contentItemsContainer.setHeight(160);
    contentItemsContainer.setLayout(new FitLayout());
    contentItemsContainer.setStyleAttribute("backgroundColor", "white");
    // overflow-auto style is for IE hack.
    contentItemsContainer.addStyleName("overflow-auto");

    TreeStore<BeanModel> deviceContentTreeStore = new TreeStore<BeanModel>();
    deviceContentTree = TreePanelBuilder.buildDeviceContentTree(deviceContentTreeStore);
    contentItemsContainer.add(deviceContentTree);

    LayoutContainer buttonsContainer = new LayoutContainer();
    buttonsContainer.setSize(110, 160);
    buttonsContainer.setBorders(false);
    buttonsContainer.setLayout(new RowLayout(Orientation.VERTICAL));

    Button addCommandBtn = new Button("Add command");
    addCommandBtn.addSelectionListener(new AddCommandListener());

    Button addSensorBtn = new Button("Add sensor");
    addSensorBtn.addSelectionListener(new AddSensorListener());

    Button addSwitchBtn = new Button("Add switch");
    addSwitchBtn.addSelectionListener(new AddSwitchListener());

    Button addSliderBtn = new Button("Add slider");
    addSliderBtn.addSelectionListener(new AddSliderListener());

    Button deleteBtn = new Button("Delete");
    deleteBtn.addSelectionListener(new DeleteContentListener());

    buttonsContainer.add(addCommandBtn, new RowData(110, -1, new Margins(5)));
    buttonsContainer.add(addSensorBtn, new RowData(110, -1, new Margins(5)));
    buttonsContainer.add(addSwitchBtn, new RowData(110, -1, new Margins(5)));
    buttonsContainer.add(addSliderBtn, new RowData(110, -1, new Margins(5)));
    buttonsContainer.add(deleteBtn, new RowData(110, -1, new Margins(5)));

    contentContainer.add(contentItemsContainer);
    contentContainer.add(buttonsContainer);
    return contentContainer;
  }
示例#24
0
 private static Widget createClientDetails() {
   LayoutContainer ct = new LayoutContainer();
   ct.setLayout(new BorderLayout());
   ContentPanel clientDetailsEast = new ContentPanel();
   ContentPanel clientDetailsWest = new ContentPanel();
   clientDetailsWest.setHeading("Clients");
   BorderLayoutData eastClientData = new BorderLayoutData(LayoutRegion.EAST, 500);
   eastClientData.setCollapsible(false);
   eastClientData.setSplit(false);
   BorderLayoutData westClientData = new BorderLayoutData(LayoutRegion.WEST, 230);
   westClientData.setCollapsible(false);
   westClientData.setSplit(false);
   ct.setBorders(false);
   ct.add(clientDetailsEast, eastClientData);
   ct.add(clientDetailsWest, westClientData);
   return ct;
 }
示例#25
0
  private final LayoutContainer createAccountPanel() {
    LayoutContainer panel = new LayoutContainer();
    FormLayout layout = new FormLayout();
    layout.setLabelAlign(LabelAlign.LEFT);
    layout.setPadding(0);
    layout.setLabelWidth(80);
    panel.setLayout(layout);
    FormData formData = new FormData("100%");

    // add alias field editor;
    accounts = new AccountComboBox(constants.account(), constants.lowerCaseAccount());
    //				"Account");
    ComboBox<XObjectModel> accountsCombo = accounts.getComboBox();
    panel.add(accountsCombo, formData);

    return panel;
  }
示例#26
0
  // RefRecordInfoDialog
  private void buildRefRecordInfoDialog() {

    if (refRecordInfoDialog != null) {
      return;
    }
    refRecordInfoDialog = new Dialog();
    refRecordInfoDialog.setBodyBorder(false);
    refRecordInfoDialog.setWidth(940);
    refRecordInfoDialog.setHeight(540);
    refRecordInfoDialog.setIcon(IconHelper.create("images/information.png"));
    refRecordInfoDialog.setHeading("Reference Record Information");
    refRecordInfoDialog.setButtons(Dialog.OK);
    refRecordInfoDialog.setModal(true);
    refRecordInfoDialog
        .getButtonById(Dialog.OK)
        .addSelectionListener(
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent ce) {

                // refPersonInfoDialog.hide();
                refRecordInfoDialog.close();
              }
            });

    ContentPanel cp = new ContentPanel();
    cp.setFrame(false);
    cp.setLayout(new BorderLayout());
    cp.setSize(930, 500);

    formButtonContainer = new LayoutContainer();
    formButtonContainer.setScrollMode(Scroll.AUTOY);

    TableLayout identlayout = new TableLayout(2);
    identlayout.setWidth("100%");
    identlayout.setCellSpacing(5);
    identlayout.setCellVerticalAlign(VerticalAlignment.TOP);

    FormLayout toplayout = new FormLayout();

    TableLayout formlayout = new TableLayout(2);
    formlayout.setWidth("930"); // "100%"
    formlayout.setCellSpacing(5);
    formlayout.setCellVerticalAlign(VerticalAlignment.TOP);

    identifierContainer = new LayoutContainer();
    ;
    identifierContainer.setLayout(identlayout);
    FormPanel identifierPanel = setupForm("", 150, 854);
    identifierPanel.add(setupIdentifierfieldSet(865, 1));
    identifierContainer.add(identifierPanel);

    topContainer = new LayoutContainer();
    ;
    topContainer.setLayout(toplayout);
    topFormPanel = setupForm("", 150, 400);
    topFormPanel.setStyleAttribute("padding-left", "15px");

    formContainer = new LayoutContainer();
    formContainer.setLayout(formlayout);
    leftFormPanel = setupForm("", 150, 400);
    rightFormPanel = setupForm("", 150, 400);

    if (currentEntity != null) {

      if (currentEntity.getAttributes() != null) {

        // Groups
        List<EntityAttributeGroupWeb> sortedAttributeGroups = null;
        if (currentEntity.getEntityAttributeGroups() != null) {
          sortedAttributeGroups =
              new ArrayList<EntityAttributeGroupWeb>(
                  currentEntity.getEntityAttributeGroups().size());
          for (EntityAttributeGroupWeb entityGroup : currentEntity.getEntityAttributeGroups()) {
            // Info.display("Entity Group:", entityGroup.getName()+ ";
            // "+entityGroup.getDisplayOrder());
            sortedAttributeGroups.add(entityGroup);
          }
          Collections.sort(sortedAttributeGroups, GROUP_DISPLAY_ORDER);
        }

        // Attributes
        List<EntityAttributeWeb> sortedEntityAttributes =
            new ArrayList<EntityAttributeWeb>(currentEntity.getAttributes().size());
        if (currentEntity.getAttributes() != null) {
          for (EntityAttributeWeb entityAttribute : currentEntity.getAttributes()) {
            sortedEntityAttributes.add(entityAttribute);
          }
          // sort by display order
          Collections.sort(sortedEntityAttributes, ATTRIBUTE_DISPLAY_ORDER);
        }

        attributeFieldMap = new HashMap<String, Field<?>>();

        // Attributes with no group
        for (EntityAttributeWeb entityAttribute : sortedEntityAttributes) {
          // Info.display("Attribute:", entityAttribute.getName()
          // +"; "+entityAttribute.getDatatype().getDataTypeCd());

          if (entityAttribute.getEntityAttributeGroup() == null) {
            Field<?> field = createField(entityAttribute, true, false);
            if (field != null) {
              attributeFieldMap.put(entityAttribute.getName(), field);
              topFormPanel.add(field);
            }
          }
        }

        // Attributes with group
        if (sortedAttributeGroups != null) {
          boolean leftForm = true;
          for (EntityAttributeGroupWeb attributeGroup : sortedAttributeGroups) {

            FieldSet groupfieldSet =
                createGroupFields(attributeFieldMap, attributeGroup, sortedEntityAttributes, false);

            if (groupfieldSet != null) {
              if (leftForm) {
                leftFormPanel.add(groupfieldSet);
                leftForm = false;
              } else {
                rightFormPanel.add(groupfieldSet);
                leftForm = true;
              }
            }
          }
        }
      }
    }

    topContainer.add(topFormPanel);
    formContainer.add(leftFormPanel);
    formContainer.add(rightFormPanel);

    formButtonContainer.add(identifierContainer);
    formButtonContainer.add(topContainer);
    formButtonContainer.add(formContainer);

    BorderLayoutData data = new BorderLayoutData(LayoutRegion.CENTER);
    data.setMargins(new Margins(4, 2, 4, 2));

    cp.add(formButtonContainer, data);

    refRecordInfoDialog.add(cp);
  }
示例#27
0
  private void initUI() {
    long time = new java.util.Date().getTime();
    GWT.log("Initializing the UI ", null);

    container = new LayoutContainer();
    container.setLayout(new CenterLayout());

    // Rpc Proxy setup
    pagingToolBar = setupRpcProxy();

    // Audit event grid setup
    grid = setupGrid();

    // Panel
    ContentPanel cp = new ContentPanel();
    cp.setHeading("Entity Event Viewer");
    cp.setFrame(true);
    cp.setIcon(IconHelper.create("images/search_icon_16x16.png"));
    cp.setLayout(new FormLayout());
    cp.setSize(1100, 630);

    // Search Container
    ContentPanel searchContainer = new ContentPanel();
    searchContainer.setHeaderVisible(false);
    FormLayout searchFormLayout = new FormLayout();
    searchFormLayout.setLabelWidth(130);
    searchFormLayout.setDefaultWidth(770);

    searchContainer.setLayout(searchFormLayout);

    selectedEvenyTypes = new TextField<String>();
    selectedEvenyTypes.setFieldLabel("Selected Event Types");
    selectedEvenyTypes.setReadOnly(true);

    evenyTypes = new ListView<AuditEventTypeWeb>();
    evenyTypes.setDisplayProperty("auditEventTypeName");
    evenyTypes.setWidth(220);
    evenyTypes.setHeight(110);
    evenyTypes.setStore(eventTypesStore);
    evenyTypes
        .getSelectionModel()
        .addListener(
            Events.SelectionChange,
            new Listener<SelectionChangedEvent<AuditEventTypeWeb>>() {

              public void handleEvent(SelectionChangedEvent<AuditEventTypeWeb> be) {
                List<AuditEventTypeWeb> selections = be.getSelection();
                String selectedTypes = "";
                for (AuditEventTypeWeb type : selections) {
                  if (selectedTypes.isEmpty()) {
                    selectedTypes = type.getAuditEventTypeName();
                  } else {
                    selectedTypes = selectedTypes + ", " + type.getAuditEventTypeName();
                  }
                }
                selectedEvenyTypes.setValue(selectedTypes);

                if (selectedTypes.isEmpty()) {
                  searchButton.disable();
                } else {
                  searchButton.enable();
                }
              }
            });

    DateTimePropertyEditor dateFormat = new DateTimePropertyEditor("yyyy-MM-dd HH:mm");
    startDate = new DateField();
    startDate.setFieldLabel("Start Date Time");
    startDate.setToolTip("yyyy-MM-dd HH:mm");
    startDate.setPropertyEditor(dateFormat);

    endDate = new DateField();
    endDate.setFieldLabel("End Date Time");
    endDate.setToolTip("yyyy-MM-dd HH:mm");
    endDate.setPropertyEditor(dateFormat);

    LayoutContainer main = new LayoutContainer();
    main.setLayout(new ColumnLayout());

    LayoutContainer left = new LayoutContainer();
    left.setStyleAttribute("paddingRight", "10px");
    FormLayout layout = new FormLayout();
    layout.setLabelWidth(130);
    layout.setDefaultWidth(220);
    // layout.setLabelAlign(LabelAlign.TOP);
    left.setLayout(layout);
    left.add(startDate);

    LayoutContainer right = new LayoutContainer();
    right.setStyleAttribute("paddingLeft", "10px");
    layout = new FormLayout();
    // layout.setLabelAlign(LabelAlign.TOP);
    layout.setLabelWidth(130);
    layout.setDefaultWidth(220);
    right.setLayout(layout);
    right.add(endDate);

    main.add(left, new ColumnData(.5));
    main.add(right, new ColumnData(.5));

    HBoxLayoutData dataSelectedTypes = new HBoxLayoutData(new Margins(5, 0, 0, 0));
    searchContainer.add(selectedEvenyTypes, dataSelectedTypes);
    HBoxLayoutData dataTypes = new HBoxLayoutData(new Margins(5, 0, 5, 135));
    searchContainer.add(evenyTypes, dataTypes);

    searchContainer.add(main);
    HBoxLayoutData dataButtons = new HBoxLayoutData(new Margins(0, 0, 5, 0));
    searchContainer.add(setupButtonPanel(3), dataButtons);

    cp.add(searchContainer);
    cp.add(grid);
    cp.setBottomComponent(pagingToolBar);

    container.add(cp);

    LayoutContainer wrapper = (LayoutContainer) Registry.get(Constants.CENTER_PANEL);
    wrapper.removeAll();
    wrapper.add(container);
    wrapper.layout();
    GWT.log("Done Initializing the UI in " + (new java.util.Date().getTime() - time), null);
  }
示例#28
0
  /**
   * 联系人
   *
   * @return
   */
  public ContentPanel createLinkManPanel() {

    CheckBoxSelectionModel cbs = new CheckBoxSelectionModel();

    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    columns.add(cbs.getColumn());

    ColumnConfig lname = new ColumnConfig("lname", "姓名", 80);
    TextField<String> text = new TextField<String>();
    lname.setEditor(new CellEditor(text));
    columns.add(lname);

    ColumnConfig dept = new ColumnConfig("dept", "部门", 80);
    TextField<String> depttext = new TextField<String>();
    dept.setEditor(new CellEditor(depttext));
    columns.add(dept);

    ColumnConfig headship = new ColumnConfig("headship", "职务", 80);
    TextField<String> headshiptext = new TextField<String>();
    headship.setEditor(new CellEditor(headshiptext));
    columns.add(headship);

    ColumnConfig passportcode = new ColumnConfig("passportcode", "护照号", 80);
    TextField<String> passportcodetext = new TextField<String>();
    passportcode.setEditor(new CellEditor(passportcodetext));
    columns.add(passportcode);

    ColumnConfig postcode1 = new ColumnConfig("postcode", "邮编", 80);
    TextField<String> postcodetext = new TextField<String>();
    postcode1.setEditor(new CellEditor(postcodetext));
    columns.add(postcode1);
    ColumnModel cm = new ColumnModel(columns);

    ModelType type = new ModelType();
    type.setRoot("records");
    type.setRecordName("record");
    type.setTotalName("totle");
    type.addField("ccode", "ccode");

    type.addField("lname");
    type.addField("headship");
    type.addField("dept");
    type.addField("idx");
    type.addField("addr");
    type.addField("headship");
    type.addField("passportcode");

    type.addField("postcode");
    type.addField("telephone");
    type.addField("mobil");
    type.addField("privatemobil");
    type.addField("fax");
    type.addField("addrtype");

    StoreInfo info = new StoreInfo();

    info.setTablename("ccodelinkman_info");
    info.setSql("select * from ccodelinkman_info");
    info.setParent(store);
    info.setAutoinccolumn("idx");
    info.setLinkparentcolumns(new String[] {"ccode"});
    info.setKeyname(new String[] {"ccode", "idx"});

    BaseStore<JDBCModelData> branchorgadd = new BaseStore<JDBCModelData>(type, info);
    branchorgadd.setName("ccodelinkman_info");
    BaseGrid branchorgaddgrid = new BaseGrid(branchorgadd, cm);
    cbs.setSelectionMode(SelectionMode.SINGLE);
    branchorgaddgrid.setSelectionModel(cbs);
    //   officegrid.setAutoExpandColumn("ccode");
    //  panel.setLayout(new BorderLayout());

    // ----------------------------
    final BaseFormPanel formpanel = new BaseFormPanel(branchorgadd);

    TextField<String> branchtelephone = new TextField<String>();
    branchtelephone.setName("telephone");
    branchtelephone.setFieldLabel("办公电话");

    formpanel.add(branchtelephone);
    final TextField<String> mobil = new TextField<String>();
    mobil.setName("mobil");
    mobil.setFieldLabel("移动电话");

    formpanel.add(mobil);

    final TextField<String> privatemobil = new TextField<String>();
    privatemobil.setName("privatemobil");
    privatemobil.setFieldLabel("私人电话");
    formpanel.add(privatemobil);

    privatemobil.addKeyListener(
        new KeyListener() {
          public void componentKeyUp(ComponentEvent event) {
            mobil.setValue(privatemobil.getValue());
          }
        });

    TextField<String> fax = new TextField<String>();
    fax.setName("fax");
    fax.setFieldLabel("传真");

    formpanel.add(fax);

    TextField<String> addrtype = new TextField<String>();
    addrtype.setName("addrtype");
    addrtype.setFieldLabel("地址类型");

    formpanel.add(addrtype);

    final TextField<String> postcode = new TextField<String>();
    postcode.setName("postcode");
    postcode.setFieldLabel("邮编");

    formpanel.add(postcode);

    TextField<String> addr = new TextField<String>();
    addr.setName("addr");
    addr.setFieldLabel("通讯地址");

    formpanel.add(addr);

    formpanel.setScrollMode(Scroll.AUTO);
    formpanel.inited();

    // 设置联系人界面上半部分的布局
    LayoutContainer top = new LayoutContainer();
    TableLayout tl = new TableLayout(2);
    top.setLayout(tl);
    TableData td = new TableData();
    td.setColspan(1);

    td.setRowspan(1);
    td.setVerticalAlign(VerticalAlignment.TOP);
    //			TableData td2 = new TableData();
    //			td2.setColspan(1);
    //			td2.setRowspan(1);

    //		    branchorgaddgrid.setSize(300, 200);
    //   branchorgaddgrid.setAutoWidth(true);
    branchorgaddgrid.setWidth(420);
    branchorgaddgrid.setAutoHeight(true);
    // formpanel.setSize(300, 380);
    formpanel.setHeaderVisible(false);

    top.add(branchorgaddgrid, td);
    top.add(formpanel, td);

    // ----------------家庭成员ccodecustomersolicitude

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

    CheckBoxSelectionModel cbs2 = new CheckBoxSelectionModel();

    customercolumns.add(cbs2.getColumn());
    ColumnConfig leaguertype = new ColumnConfig("leaguertype", "家庭成员", 80);
    TextField<String> leaguertext = new TextField<String>();
    leaguertype.setEditor(new CellEditor(leaguertext));
    customercolumns.add(leaguertype);
    ColumnConfig leaguername = new ColumnConfig("leaguername", "姓名", 80);
    TextField<String> leaguernametext = new TextField<String>();
    leaguername.setEditor(new CellEditor(leaguernametext));
    customercolumns.add(leaguername);

    ColumnModel customercm = new ColumnModel(customercolumns);

    ModelType customertype = new ModelType();
    customertype.setRoot("records");
    customertype.setRecordName("record");

    customertype.addField("ccode", "ccode");
    customertype.addField("leaguertype");
    customertype.addField("leaguername");
    customertype.addField("idx");
    customertype.addField("birthday");
    customertype.addField("commemorateday");
    customertype.addField("religion");
    customertype.addField("bekeenon");
    customertype.addField("tourexperience");
    customertype.addField("workexperience");
    customertype.addField("occupation");
    customertype.addField("workheadship");
    customertype.addField("remark");

    StoreInfo customerinfo = new StoreInfo();

    customerinfo.setTablename("ccodecustomersolicitude");
    customerinfo.setSql("select * from ccodecustomersolicitude");
    customerinfo.setParent(store);
    customerinfo.setAutoinccolumn("idx");
    customerinfo.setLinkparentcolumns(new String[] {"ccode"});
    customerinfo.setKeyname(new String[] {"ccode", "idx"});

    BaseStore<JDBCModelData> customertypestore =
        new BaseStore<JDBCModelData>(customertype, customerinfo);
    customertypestore.setName("ccodecustomersolicitude");
    BaseGrid customertypegrid = new BaseGrid(customertypestore, customercm);

    cbs2.setSelectionMode(SelectionMode.SINGLE);
    customertypegrid.setSelectionModel(cbs2);
    // ---------------------
    // --
    BaseFormPanel formcustomerpanel = new BaseFormPanel(customertypestore);
    formcustomerpanel.setHeaderVisible(false);

    TextField<String> birthdayc = new TextField<String>();
    birthdayc.setName("birthday");
    birthdayc.setFieldLabel("生日");

    formcustomerpanel.add(birthdayc);

    TextField<String> commemorateday = new TextField<String>();
    commemorateday.setName("commemorateday");
    commemorateday.setFieldLabel("纪念日");

    formcustomerpanel.add(commemorateday);

    TextField religion = new TextField();
    religion.setName("religion");
    religion.setFieldLabel("信仰");
    formcustomerpanel.add(religion);

    TextField bekeenon = new TextField();
    bekeenon.setName("bekeenon");
    bekeenon.setFieldLabel("主要爱好");

    formcustomerpanel.add(bekeenon);

    TextField tourexperience = new TextField();
    tourexperience.setName("tourexperience");
    tourexperience.setFieldLabel("旅游经历");

    formcustomerpanel.add(tourexperience);

    TextField workexperience = new TextField();
    workexperience.setName("workexperience");
    workexperience.setFieldLabel("工作经历");

    formcustomerpanel.add(workexperience);

    TextField occupation = new TextField();
    occupation.setName("occupation");
    occupation.setFieldLabel("职业");

    formcustomerpanel.add(occupation);

    TextField workheadship = new TextField();
    workheadship.setName("workheadship");
    workheadship.setFieldLabel("工作职位");

    formcustomerpanel.add(workheadship);

    TextField remark = new TextField();
    remark.setName("remark");
    remark.setFieldLabel("备注");

    formcustomerpanel.add(remark);
    formcustomerpanel.setScrollMode(Scroll.AUTO);
    formcustomerpanel.inited();
    //			    FormBinding formcustomerBindings = new FormBinding(formcustomerpanel, true);
    //			    formcustomerBindings.setStore(customertypestore);

    // --end

    ContentPanel panel = new ContentPanel();

    panel.setLayout(new TableLayout(2));
    panel.setHeaderVisible(false);

    TableData td1 = new TableData();
    td1.setColspan(2);

    //   panel.add(formpanel,td2);
    customertypegrid.setAutoHeight(true);
    //		    customertypegrid.setAutoWidth(true);
    customertypegrid.setWidth(420);
    //  formcustomerpanel.setSize(300, 300);

    TableData td2 = new TableData();
    td2.setColspan(1);
    td2.setRowspan(1);

    LayoutContainer bottom = new LayoutContainer();

    TableLayout bottomtl = new TableLayout(2);
    bottom.setLayout(bottomtl);
    TableData bottomtd = new TableData();
    bottomtd.setVerticalAlign(VerticalAlignment.TOP);
    bottomtd.setColspan(1);
    bottomtd.setRowspan(1);

    bottom.add(customertypegrid, bottomtd);
    bottom.add(formcustomerpanel, bottomtd);
    FieldSet fieldset = new FieldSet();
    fieldset.setHeading("联系人");
    FieldSet fieldset2 = new FieldSet();
    fieldset2.setHeading("联系人家庭成员信息");
    fieldset.add(top);
    fieldset2.add(bottom);

    panel.add(fieldset, td1);
    panel.add(fieldset2, td1);
    panel.setScrollMode(Scroll.AUTO);
    panel.setAutoHeight(true);
    panel.setAutoWidth(true);
    return panel;
  }
  @Override
  public void addComponent() {
    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setSpacing(10);
    FieldSet fieldSet = new FieldSet();
    fieldSet.setHeading("Share Project to Users");
    fieldSet.setWidth(GPProjectManagementWidget.COMPONENT_WIDTH - 25);
    this.projectNameLabel = new Label();
    this.projectNameLabel.setStyleAttribute("font-size", "13");
    this.ownerLabel = new Label();
    this.ownerLabel.setStyleAttribute("font-size", "13");
    this.organizationLabel = new Label();
    this.organizationLabel.setStyleAttribute("font-size", "13");
    fieldSet.add(this.projectNameLabel, new MarginData(10));
    fieldSet.add(ownerLabel, new MarginData(10));
    fieldSet.add(organizationLabel, new MarginData(10));
    verticalPanel.add(fieldSet);
    //
    LayoutContainer labelListContainer = new LayoutContainer(new BorderLayout());
    labelListContainer.setHeight(20);
    labelListContainer.setStyleAttribute("background-color", "white");
    labelListContainer.setWidth(GPProjectManagementWidget.COMPONENT_WIDTH - 25);
    Label organizationUserLabel = new Label("Organization Users:");
    organizationUserLabel.setStyleAttribute("font-size", "13");
    organizationUserLabel.setStyleAttribute("font-weight", "bold");
    labelListContainer.add(organizationUserLabel, new BorderLayoutData(Style.LayoutRegion.WEST));
    Label projectSharedUserLabel = new Label("Project Shared Users:");
    projectSharedUserLabel.setStyleAttribute("font-size", "13");
    projectSharedUserLabel.setStyleAttribute("font-weight", "bold");
    labelListContainer.add(projectSharedUserLabel, new BorderLayoutData(Style.LayoutRegion.EAST));
    verticalPanel.add(labelListContainer);
    //
    final DualListField<GPSimpleUser> lists = new DualListField<GPSimpleUser>();
    lists.setMode(Mode.INSERT);
    lists.setHeight("" + GPProjectManagementWidget.COMPONENT_HEIGHT / 1.75);
    lists.setStyleAttribute("margin-left", "11px");
    lists.setHideLabel(Boolean.TRUE);

    ListField<GPSimpleUser> from = lists.getFromList();
    from.setDisplayField(GPSimpleUserKeyValue.NAME.toString());
    this.fromStore = new ListStore<GPSimpleUser>();
    from.setStore(this.fromStore);
    ListField<GPSimpleUser> to = lists.getToList();
    to.setDisplayField(GPSimpleUserKeyValue.NAME.toString());
    this.toStore = new ListStore<GPSimpleUser>();
    to.setStore(this.toStore);
    Button cancelButton =
        new Button(
            "GoTo Search Project",
            BasicWidgetResources.ICONS.gear(),
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent ce) {
                ShareProjectPanel.this.reset();
                projectManagementWidget.showSearchProjectPanel();
              }
            });
    super.addButton(cancelButton);
    saveButton =
        new Button(
            "Save",
            BasicWidgetResources.ICONS.save(),
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent ce) {
                toStore.commitChanges();
                List<Long> accountIDsProject =
                    Lists.newArrayListWithCapacity(toStore.getModels().size());
                IGPAccountDetail accountDetail =
                    Registry.get(UserSessionEnum.ACCOUNT_DETAIL_IN_SESSION.name());
                boolean test = false;
                for (GPSimpleUser user : toStore.getModels()) {
                  if (user.getId().equals(accountDetail.getId())) {
                    test = true;
                  }
                  accountIDsProject.add(user.getId());
                }
                final boolean isShared = test;
                ShareProjectPanel.this.reset();
                LayerRemote.Util.getInstance()
                    .shareProjectToUsers(
                        project.getId(),
                        accountIDsProject,
                        new AsyncCallback<Boolean>() {
                          @Override
                          public void onFailure(Throwable caught) {
                            System.out.println("Error on saving user to share project");
                          }

                          @Override
                          public void onSuccess(Boolean result) {
                            //                                System.out.println("Project is Shared:
                            // " + isShared);
                            if (project.isDefaultProject()) {
                              GPClientProject projInSession =
                                  Registry.get(UserSessionEnum.CURRENT_PROJECT_ON_TREE.name());
                              if (isShared) {
                                projInSession.setShared(Boolean.TRUE);
                              } else {
                                projInSession.setShared(Boolean.FALSE);
                              }
                            }
                            project.setShared(Boolean.TRUE);
                            loadData(project);
                          }
                        });
              }
            });
    super.addButton(saveButton);
    super.add(verticalPanel);
    super.add(lists, new FormData("98%"));
    LayoutContainer filterContainer = new LayoutContainer(new BorderLayout());
    this.fromFilter = this.createServerFilter(this.fromFilter, fromStore, "Organization Users");
    filterContainer.add(this.fromFilter, new BorderLayoutData(Style.LayoutRegion.WEST));
    this.toFilter = this.createServerFilter(this.toFilter, toStore, "Sharing User List");
    filterContainer.add(this.toFilter, new BorderLayoutData(Style.LayoutRegion.EAST));
    filterContainer.setStyleAttribute("margin", "11px");
    super.add(filterContainer);
  }
示例#30
0
  @Override
  protected void onRender(Element parent, int index) {
    super.onRender(parent, index);
    setLayout(new FitLayout());

    containerSizeStore = getContainerSizeStore();
    ironChestStore = getIronChestStore();
    bracketStore = getBracketStore();

    ContentPanel content = new ContentPanel();
    content.setHeaderVisible(false);
    content.setBodyBorder(false);
    content.setLayout(new RowLayout(Orientation.VERTICAL));

    LayoutContainer frame1 = new LayoutContainer();
    frame1.setStyleAttribute("padding", "10px");
    frame1.setStyleAttribute("backgroundColor", "#dfe8f6");
    frame1.setLayout(new BorderLayout());

    grid = createGrid();
    grid.getSelectionModel()
        .addListener(
            Events.SelectionChange,
            new Listener<SelectionChangedEvent<BeanModel>>() {
              public void handleEvent(SelectionChangedEvent<BeanModel> be) {
                store.rejectChanges();
                resetState();
              }
            });

    formPanel = createForm();

    BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 305);
    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);

    frame1.add(grid, westData);
    frame1.add(formPanel, centerData);

    content.add(frame1);

    LayoutContainer frame2 = new LayoutContainer();
    frame2.setStyleAttribute("backgroundColor", "#dfe8f6");
    frame2.setLayout(new RowLayout(Orientation.HORIZONTAL));

    RowData data1 = new RowData(.45, 1);
    data1.setMargins(new Margins(10));
    RowData data2 = new RowData(.55, 1);
    data2.setMargins(new Margins(10));
    frame2.add(createTypeGrid(), data1);
    frame2.add(createBracketGrid(), data2);

    RowData data = new RowData(1, 0.5);
    content.add(frame1, data);
    content.add(frame2, data);

    // 添加工具栏
    ToolBar toolBar = new ToolBar();

    addButton = new Button("添加", Resources.ICONS.add());
    addButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            beanModel = beanModelFactory.createModel(new Container());
            formPanel.reset();
            formBindings.bind(beanModel);
            formBindings.addListener(
                Events.Bind,
                new Listener<BindingEvent>() {
                  @Override
                  public void handleEvent(BindingEvent be) {
                    formBindings
                        .getModel()
                        .set("customsDeclarationHeadId", selectedCustomsDeclarationHead.getId());
                    for (Field<?> field : formPanel.getFields()) {
                      field.clearInvalid();
                    }
                    formBindings.removeAllListeners();
                  }
                });
            formPanel.setReadOnly(false);
            formPanel.getFields().get(0).focus();
            saveButton.setVisible(true);
            cancelButton.setVisible(true);
            updateButton.setVisible(false);
            resetButton.setVisible(false);
            addButton.disable();
          }
        });
    toolBar.add(addButton);

    toolBar.add(new SeparatorToolItem());

    editButton = new Button("修改", Resources.ICONS.edit());
    editButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            if (grid.getSelectionModel().getSelection().size() > 0) {
              formBindings.bind((BeanModel) grid.getSelectionModel().getSelection().get(0));
              formPanel.setReadOnly(false);
              updateButton.enable();
              resetButton.enable();
              editButton.disable();
            } else {
              formBindings.unbind();
            }
          }
        });
    toolBar.add(editButton);

    toolBar.add(new SeparatorToolItem());

    deleteButton = new Button("删除", Resources.ICONS.delete());
    toolBar.add(deleteButton);
    deleteButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            MessageBox.confirm(
                "确认",
                "确定要删除选中的条目吗?",
                new Listener<MessageBoxEvent>() {
                  @Override
                  public void handleEvent(MessageBoxEvent be) {
                    if (be.getButtonClicked().getText() == GXT.MESSAGES.messageBox_yes()) {
                      delete();
                    }
                  }
                });
          }
        });

    if (permitedEnterprise != null) {
      if (permitedEnterprise.getCanAdd()) {
        addButton.enable();
      } else {
        addButton.disable();
      }
      if (permitedEnterprise.getCanUpdate()) {
        editButton.enable();
      } else {
        editButton.disable();
      }
      if (permitedEnterprise.getCanDelete()) {
        deleteButton.enable();
      } else {
        deleteButton.disable();
      }
    }

    content.setTopComponent(toolBar);
    add(content);
  }