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 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;
  }
示例#3
0
 private final LayoutContainer createAccountChoice() {
   LayoutContainer panel = new LayoutContainer();
   panel.setLayout(new FillLayout());
   panel.add(createAccountPanel());
   panel.setHeight(30);
   return panel;
 }
  /**
   * 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);
  }
 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;
 }
 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;
 }
示例#7
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;
  }
 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;
 }
 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;
 }
示例#10
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;
 }
示例#11
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;
 }
示例#12
0
 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;
 }
示例#13
0
 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;
 }
示例#14
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);
  }
示例#15
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);
  }
示例#16
0
  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);
  }
                       // 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);
  }
示例#18
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;
 }
示例#19
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;
  }
示例#20
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);
  }
示例#21
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;
 }
示例#22
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;
  }
示例#23
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);
  }
示例#24
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);
  }
示例#25
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);
  }
示例#26
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;
  }
示例#27
0
  /**
   * 客户资料
   *
   * @return
   */
  private LayoutContainer CreateCCodeDetailPanel() {
    LayoutContainer main = new LayoutContainer();
    TableLayout tl = new TableLayout(2);

    main.setLayout(new TableLayout(2));
    BaseFormPanel leftpanel = new BaseFormPanel(store);
    leftpanel.setLayout(new FormLayout());
    FormData fd = new FormData(200, 30);
    leftpanel.setHeaderVisible(false);
    leftpanel.setBodyBorder(false);

    BaseFormPanel rightpanel = new BaseFormPanel(store);
    rightpanel.setBodyBorder(false);
    rightpanel.setHeaderVisible(false);

    TextField<String> ccode = new TextField<String>();
    ccode.setName("ccode");
    ccode.setAllowBlank(false);
    ccode.setFieldLabel("编码");

    TextField<String> name = new TextField<String>();
    name.setName("cname");
    name.setAllowBlank(false);
    name.setFieldLabel("名称");

    TextField<String> shortcode = new TextField<String>();
    shortcode.setName("shortcode");
    shortcode.setFieldLabel("简码");
    TextField<String> ccodesource = new TextField<String>();
    ccodesource.setName("ccodesource");
    ccodesource.setFieldLabel("客户来源");

    TextField<String> ncode = new TextField<String>();
    ncode.setName("ncode");
    ncode.setFieldLabel("国别");

    TextField<String> httpurl = new TextField<String>();
    httpurl.setName("httpurl");
    httpurl.setFieldLabel("网址");

    DateField setupdate = new DateField();
    setupdate.setName("setupdate");
    setupdate.setFieldLabel("成立时间");
    TextField<String> registercapital = new TextField<String>();
    registercapital.setName("registercapital");
    registercapital.setFieldLabel("注册资金");

    TextField<String> employeenum = new TextField<String>();
    employeenum.setName("employeenum");
    employeenum.setFieldLabel("雇用人数");

    TextField<String> branchorgnum = new TextField<String>();
    branchorgnum.setName("branchorgnum");
    branchorgnum.setFieldLabel("分支机构数");

    TextField<String> artperson = new TextField<String>();
    artperson.setName("artperson");
    artperson.setFieldLabel("法人代表");

    TextField<String> taxno = new TextField<String>();
    taxno.setName("taxno");
    taxno.setFieldLabel("税务登记号");

    TextField<String> partner = new TextField<String>();
    partner.setName("partner");
    partner.setFieldLabel("合伙人");

    /*
     * TextField<String> artno = new TextField<String>();
     * artno.setName("artno"); artno.setFieldLabel("企业代码");
     */

    TextField<String> comholsdatedesc = new TextField<String>();
    comholsdatedesc.setName("comholsdatedesc");
    comholsdatedesc.setFieldLabel("公司特殊假日");

    BaseGrid gudong = CreateCCodeGudongPanel();
    gudong.setAutoHeight(true);
    gudong.setAutoWidth(true);
    leftpanel.add(ccode, fd);
    rightpanel.add(name, fd);
    leftpanel.add(shortcode, fd);
    rightpanel.add(ccodesource, fd);
    leftpanel.add(httpurl, fd);
    rightpanel.add(setupdate, fd);
    leftpanel.add(registercapital, fd);
    rightpanel.add(employeenum, fd);
    leftpanel.add(branchorgnum, fd);
    rightpanel.add(artperson, fd);
    leftpanel.add(taxno, fd);
    rightpanel.add(partner, fd);
    leftpanel.add(comholsdatedesc, fd);

    TableData td = new TableData();
    td.setColspan(1);
    td.setRowspan(1);
    // 对齐方式
    td.setHorizontalAlign(HorizontalAlignment.LEFT);
    td.setVerticalAlign(VerticalAlignment.TOP);
    // rightpanel.add(gudong,td2);
    leftpanel.inited();
    rightpanel.inited();
    FieldSet fieldSet = new FieldSet();
    fieldSet.setHeading("股东占股比例");
    fieldSet.add(gudong);
    main.add(leftpanel, td);
    main.add(rightpanel, td);
    main.add(fieldSet, td);
    return main;
  }
  protected void onRender(Element target, int index) {
    super.onRender(target, index);

    final FitLayout fl = new FitLayout();

    LayoutContainer layoutContainer = new LayoutContainer();
    layoutContainer.setBorders(false);
    layoutContainer.setLayout(fl);

    VerticalPanel vp = new VerticalPanel();
    vp.setSpacing(3);

    ContentPanel cpGrid = new ContentPanel();
    cpGrid.setHeaderVisible(true);
    cpGrid.setHeading("Lista Dipendenti.");
    cpGrid.setBorders(false);
    cpGrid.setFrame(true);
    cpGrid.setHeight((h - 65));
    cpGrid.setWidth(w - 250);
    cpGrid.setScrollMode(Scroll.AUTO);
    cpGrid.setLayout(new FitLayout());
    cpGrid.setButtonAlign(HorizontalAlignment.CENTER);
    Resizable r = new Resizable(cpGrid);

    btnPrint = new Button();
    btnPrint.setEnabled(true);
    btnPrint.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.print24()));
    btnPrint.setIconAlign(IconAlign.TOP);
    btnPrint.setToolTip("Stampa");
    btnPrint.setSize(26, 26);
    btnPrint.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(ButtonEvent ce) {
            SessionManagementService.Util.getInstance()
                .setDatiReportCostiDip(
                    "RIEP.COSTI",
                    store.getModels(),
                    new AsyncCallback<Boolean>() {

                      @Override
                      public void onFailure(Throwable caught) {
                        Window.alert("Error on setNomeReport()");
                      }

                      @Override
                      public void onSuccess(Boolean result) {
                        if (result) fp.submit();
                        else
                          Window.alert(
                              "Problemi durante il settaggio dei parametri in Sessione (http)");
                      }
                    });
          }
        });

    btnAdd = new Button();
    btnAdd.setStyleAttribute("padding-left", "2px");
    btnAdd.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.add()));
    btnAdd.setIconAlign(IconAlign.TOP);
    btnAdd.setSize(26, 26);
    btnAdd.setToolTip("Nuova Offerta");
    btnAdd.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            RiepilogoCostiDipendentiModel am =
                new RiepilogoCostiDipendentiModel(
                    0, 0, "", "0.00", "", "0", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "",
                    "", "");

            gridRiepilogo.stopEditing();
            store.insert(am, 0);
            gridRiepilogo.startEditing(store.indexOf(am), 0);
          }
        });

    btnConfirm = new Button();
    btnConfirm.setEnabled(true);
    btnConfirm.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.confirm()));
    btnConfirm.setIconAlign(IconAlign.TOP);
    btnConfirm.setToolTip("Conferma modifiche");
    btnConfirm.setSize(26, 26);
    btnConfirm.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(ButtonEvent ce) {

            RiepilogoCostiDipendentiModel c = new RiepilogoCostiDipendentiModel();

            for (Record record : store.getModifiedRecords()) {

              c = (RiepilogoCostiDipendentiModel) record.getModel();

              AdministrationService.Util.getInstance()
                  .editDatiCostiAzienda(
                      c,
                      new AsyncCallback<Boolean>() {

                        @Override
                        public void onFailure(Throwable caught) {
                          Window.alert("Errore di connessione on insertNewOffertaWithRda();");
                        }

                        @Override
                        public void onSuccess(Boolean result) {
                          if (result) {
                            caricaTabellaDati();
                          } else {
                            Window.alert(
                                "error: Impossibile effettuare l'inserimento/modifica dei dati!");
                          }
                        }
                      });
            }
          }
        });

    if ((ruolo.compareTo("PM") == 0)) {
      btnConfirm.disable();
      btnAdd.disable();
    }

    smplcmbxSede = new SimpleComboBox<String>();
    smplcmbxSede.setFieldLabel("Sede");
    smplcmbxSede.setWidth(65);
    smplcmbxSede.setEmptyText("Sede..");
    smplcmbxSede.setAllowBlank(false);
    smplcmbxSede.add("T");
    smplcmbxSede.add("B");
    smplcmbxSede.setStyleAttribute("padding-left", "2px");
    smplcmbxSede.addListener(
        Events.Select,
        new Listener<BaseEvent>() {
          @Override
          public void handleEvent(BaseEvent be) {
            caricaTabellaDati();
          }
        });

    // caricaTabellaDati();

    cm = new ColumnModel(createColumns());
    gridRiepilogo = new EditorGrid<RiepilogoCostiDipendentiModel>(store, cm);
    gridRiepilogo.setBorders(false);
    gridRiepilogo.setColumnLines(true);
    gridRiepilogo.setStripeRows(true);
    gridRiepilogo.setItemId("grid");
    gridRiepilogo.setSelectionModel(csm);

    fp.setMethod(FormPanel.METHOD_POST);
    fp.setAction(url);
    fp.addSubmitCompleteHandler(new FormSubmitCompleteHandler());
    fp.add(btnPrint);
    ContentPanel cp = new ContentPanel();
    cp.setHeaderVisible(false);
    cp.add(fp);

    ToolBar tlBar = new ToolBar();
    tlBar.add(smplcmbxSede);
    tlBar.add(btnAdd);
    tlBar.add(btnConfirm);
    tlBar.add(new SeparatorToolItem());
    tlBar.add(cp);

    cpGrid.setTopComponent(tlBar);
    cpGrid.add(gridRiepilogo);

    layoutContainer.add(cpGrid, new FitData(3, 3, 3, 3));

    add(layoutContainer);
  }
示例#29
0
  public LayoutContainer getRightSide() {
    RowLayout layout = new RowLayout();
    // layout.setMargin(0);
    // layout.setSpacing(0);

    ButtonBar south = new ButtonBar();
    south.setAlignment(HorizontalAlignment.RIGHT);
    final Button complete =
        new Button(
            "Complete Split",
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent ce) {
                onClose();
              }
            });
    south.add(complete);
    complete.setEnabled(false);

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

    final DataList moveList = new DataList();
    final ListBox listBox = new ListBox();
    listBox.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            moveList.removeAll();
            ArrayList<String> list =
                parentToChildList.get(listBox.getValue(listBox.getSelectedIndex()));
            if (list == null) return;
            Iterator<String> iterator = list.listIterator();
            while (iterator.hasNext()) {
              // FIXME: look at this, i just fix this and dont know if it's right. CS
              String nodeID = iterator.next();
              Taxon cur = TaxonomyCache.impl.getTaxon(nodeID);
              DataListItem li = new DataListItem(cur.getFullName());
              li.setData("nodeID", nodeID);
              li.setData("node", cur);
              moveList.add(li);
            }
            layout();
          }
        });

    Menu m = new Menu();
    MenuItem item = new MenuItem();
    item.setText("Remove");
    item.addSelectionListener(
        new SelectionListener<MenuEvent>() {
          @Override
          public void componentSelected(MenuEvent ce) {
            DataListItem item = (DataListItem) ce.getSource();
            ArrayList<String> list =
                parentToChildList.get(listBox.getValue(listBox.getSelectedIndex()));
            if (list != null) list.remove(item.getData("nodeID"));

            moveList.remove(item);
            children.add(item);
            layout();
          }
        });
    m.add(item);
    moveList.setContextMenu(m);

    VerticalPanel table = new VerticalPanel();
    table.add(new HTML("Current Taxonomic Group: "));
    table.add(listBox);
    listBox.setWidth("100%");
    listBox.setEnabled(false);

    final ButtonBar bar = new ButtonBar();
    bar.setAlignment(HorizontalAlignment.RIGHT);
    final Button addChild =
        new Button(
            "Add Child",
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent ce) {
                List<DataListItem> sel = children.getSelectedItems();
                if (sel == null) return;
                ArrayList<String> list =
                    parentToChildList.get(listBox.getValue(listBox.getSelectedIndex()));
                for (DataListItem selected : sel) {
                  children.remove(selected);
                  String nodeID = selected.getData("nodeID");
                  if (!list.contains(nodeID)) {
                    list.add(nodeID);
                    DataListItem item = new DataListItem(selected.getText());
                    item.setData("nodeID", nodeID);
                    item.setData("node", selected.getData("node"));
                    moveList.add(item);
                  }
                }
                layout();
              }
            });
    addChild.setEnabled(false);
    bar.add(addChild);
    bar.add(
        new Button(
            "Create New Taxon",
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent ce) {
                TaxonomyCache.impl.fetchTaxon(
                    currentNode.getParentId(),
                    false,
                    new GenericCallback<Taxon>() {
                      public void onFailure(Throwable caught) {
                        WindowUtils.errorAlert(
                            "Error",
                            "Could not " + "find parent level to attach new taxonomic concept to.");
                      }

                      public void onSuccess(Taxon result) {
                        complete.setEnabled(true);

                        final CreateNewTaxonPanel panel = new CreateNewTaxonPanel(result);
                        panel.addListener(
                            Events.StateChange,
                            new Listener<BaseEvent>() {
                              public void handleEvent(BaseEvent be) {
                                Taxon newNode = (Taxon) be.getSource();
                                parentToChildList.put(
                                    newNode.getId() + "", new ArrayList<String>());
                                listBox.addItem(newNode.getFullName(), newNode.getId() + "");
                                listBox.setSelectedIndex(listBox.getItemCount() - 1);
                                listBox.setEnabled(true);
                                moveList.removeAll();
                                addChild.setEnabled(true);
                              }
                            });
                        panel.show();
                      }
                    });
              }
            }));

    container.add(table, new RowData(1d, 25));
    container.add(bar, new RowData(1d, 25));
    container.add(new HTML("Children to add to new taxon:"), new RowData(1d, 25));
    container.add(moveList, new RowData(1d, 1d));
    container.add(south, new RowData(1d, 25));

    return container;
  }
    CreateFormIntervalliOre() {

      setLabelWidth(30);
      setFrame(true);
      setButtonAlign(HorizontalAlignment.CENTER);
      setHeading("Dettaglio Ore.");
      setHeaderVisible(false);
      setWidth(700);
      setHeight(95);
      setStyleAttribute("padding-left", "10px");
      setStyleAttribute("padding-top", "10px");
      setBorders(false);

      Date retVal = null;
      try {
        retVal = DateTimeFormat.getFormat("dd-MM-yyyy").parse(01 + "-" + 03 + "-" + 2013);
      } catch (Exception e) {
        retVal = null;
      }

      giornoRiferimento.setValue(new Date());
      giornoRiferimento.setMinValue(retVal);
      giornoRiferimento.setItemId("data");
      dtfldGiorno.setValue(giornoRiferimento.getValue());

      ListStore<PersonaleModel> store = new ListStore<PersonaleModel>();
      cmbxDipendente.setStore(store);
      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(btnPrev);
      buttonBarTop.add(giornoRiferimento);
      buttonBarTop.add(cmbxDipendente);
      buttonBarTop.add(btnSend);
      // buttonBarTop.add(btnNext);

      btnInviaCommenti.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.escl1()));
      btnInviaCommenti.setToolTip("Segnala eventuali problemi o anomalie.");
      btnInviaCommenti.setSize(26, 26);
      btnInviaCommenti.setIconAlign(IconAlign.TOP);
      btnInviaCommenti.addSelectionListener(
          new SelectionListener<ButtonEvent>() {
            @Override
            public void componentSelected(ButtonEvent ce) {
              Dialog d = new DialogInvioCommenti(txtfldUsername.getValue().toString(), new Date());
              d.show();
            }
          });

      btnRiepilogoCommesse.setEnabled(true);
      btnRiepilogoCommesse.setSize(26, 26);
      btnRiepilogoCommesse.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.riep_comm()));
      btnRiepilogoCommesse.setToolTip("Riepilogo Commesse");
      btnRiepilogoCommesse.addSelectionListener(
          new SelectionListener<ButtonEvent>() {

            @Override
            public void componentSelected(ButtonEvent ce) {
              /*Dialog d= new Dialog();
              d.setHeaderVisible(true);
              d.setHeading("Riepilogo dettagliato (Commesse).");
              d.setSize(550, 605);
              d.add(new PanelRiepilogoGiornalieroCommesse(txtfldUsername.getValue().toString(), giornoRiferimento.getValue()));
              d.setButtons("");
              d.show();*/
              Date data = dtfldGiorno.getValue();
              Dialog d = new Dialog();
              d.setHeaderVisible(true);
              d.setConstrain(false);
              d.setHeading("Riepilogo dettagliato (Commesse).");
              d.setSize(1500, 650);
              d.add(
                  new PanelRiepilogoMeseGiornalieroCommesseHorizontal(
                      0,
                      txtfldUsername.getValue().toString(),
                      data,
                      "0.00",
                      "0.00",
                      "0.00",
                      "0.00"));
              d.setButtons("");
              d.show();
            }
          });

      frm.setHeaderVisible(false);
      frm.setBorders(false);
      frm.setItemId("formPanel");
      frm.setWidth(1060);
      frm.setHeight(890);
      frm.setStyleAttribute("padding-left", "0px");
      frm.setStyleAttribute("padding-top", "0px");
      frm.setScrollMode(Scroll.AUTO);

      main.setLayout(new ColumnLayout());
      main.setBorders(false);
      main.setStyleAttribute("margin-top", "-10px");
      main.setItemId("main");

      left.setStyleAttribute("padding-left", "10px");
      FormLayout layout = new FormLayout();
      left.setLayout(layout);
      left.setItemId("left");

      right.setStyleAttribute("padding-left", "30px");
      layout = new FormLayout();
      right.setLayout(layout);
      right.setItemId("right");

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

      left.add(btnBarOperazioni);
      left.add(buttonBarTop);

      main.add(left);
      frm.add(main);
      frm.layout(true);
      add(frm);

      btnSend.setSize(26, 26);
      btnSend.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.reload()));
      btnSend.setToolTip("Carica Dati");
      btnSend.addSelectionListener(
          new SelectionListener<ButtonEvent>() {
            @Override
            public void componentSelected(ButtonEvent ce) {
              txtfldUsername.setValue(
                  cmbxDipendente
                      .getValue()
                      .get("username")
                      .toString()); // setto il valore globale dell'username per il caricamento dei
                                    // vari fieldset
              dtfldGiorno.setValue(
                  giornoRiferimento
                      .getValue()); // setto il valore globale della data con la data selezionata
              reloadFoglioOre();
            }
          });

      // btnConferma.setSize(46, 46);
      btnConferma.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.saveLittle()));
      btnConferma.setIconAlign(IconAlign.TOP);
      btnConferma.setToolTip("Conferma");
      btnConferma.setSize(26, 26);
      btnConferma.addSelectionListener(
          new SelectionListener<ButtonEvent>() {

            @Override
            public void componentSelected(ButtonEvent ce) {

              if (frm.isValid()) {
                String username = new String();
                Date giorno = new Date();
                DateField dtfld = new DateField();

                username = cmbxDipendente.getValue().get("username");
                List<IntervalliCommesseModel> intervalliC =
                    new ArrayList<IntervalliCommesseModel>();

                FldsetIntervalliCommesse fldSetIntervalliC;
                LayoutContainer lc = new LayoutContainer();
                LayoutContainer lcR = new LayoutContainer();
                ButtonBar bttnBar = new ButtonBar();

                lc = (LayoutContainer) frm.getItemByItemId("main");
                // Intervalli IU
                lc = (LayoutContainer) lc.getItemByItemId("left");

                // Data
                bttnBar = (ButtonBar) lc.getItemByItemId("buttonBar");
                dtfld = (DateField) bttnBar.getItemByItemId("data");
                giorno = dtfld.getValue();

                // Intervalli Comm
                fldSetIntervalliC =
                    (FldsetIntervalliCommesse) lc.getItemByItemId("fldSetIntervalliC");
                if (fldSetIntervalliC.getItemCount() > 1)
                  intervalliC = elaboraIntervalliC(fldSetIntervalliC);

                // Giustificativi
                lcR = (LayoutContainer) frm.getItemByItemId("main");
                lcR = (LayoutContainer) lcR.getItemByItemId("right");

                // txtfldOreTotali=fldSetGiustificativi.txtfldOreTotEffettive;

                AdministrationService.Util.getInstance()
                    .insertFoglioOreGiorno(
                        username,
                        giorno,
                        intervalliC,
                        new AsyncCallback<Boolean>() {

                          @Override
                          public void onFailure(Throwable caught) {
                            Window.alert("Errore di connessione on insertFoglioOreGiorno()!");
                          }

                          @Override
                          public void onSuccess(Boolean result) {
                            if (result) {
                              Window.alert("Caricamento avvenuto con successo.");
                              reloadFoglioOre();
                            } else {
                              Window.alert("error: Impossibile salvare i dati!");
                            }
                          }
                        });
              }
            }
          });
    }