public StyledLayerDescriptorLayoutView() {

    generalContentPanel = new VLayout();
    generalContentPanel.setWidth100();
    // minimal initial height
    generalContentPanel.setHeight(10);

    rulesContentPanel = new VLayout();
    rulesContentPanel.setWidth100();
    // take all the remaining space
    rulesContentPanel.setHeight("*");
    rulesContentPanel.setResizeBarTarget("next");
    rulesContentPanel.setShowResizeBar(true);

    ruleContentPanel = new VLayout();
    ruleContentPanel.setWidth100();
    // minimal initial height
    ruleContentPanel.setHeight(300);

    actionContentPanel = new VLayout();
    actionContentPanel.setWidth100();
    actionContentPanel.setHeight(10);

    widget = new VLayout();
    widget.setWidth100();
    widget.setHeight100();
    widget.setMembersMargin(5);
    widget.setMargin(5);
    widget.addMember(generalContentPanel);
    widget.addMember(rulesContentPanel);
    widget.addMember(ruleContentPanel);
    widget.addMember(actionContentPanel);
  }
  public Canvas getViewPanel() {
    VLayout layout = new VLayout();
    layout.setWidth100();
    layout.setHeight100();

    // Map with ID mapGeoTools is defined in the XML configuration. (mapGeoTools.xml)
    final MapWidget map = new MapWidget("mapGeoTools", "appGeoTools");
    // Select the layer, so we can also create features !
    map.getMapModel()
        .runWhenInitialized(
            new Runnable() {

              @Override
              public void run() {
                // select to create new features
                map.getMapModel().getLayer("clientLayerCountriesGeoTools").setSelected(true);
              }
            });

    // Set a panning controller on the map:
    map.setController(new PanController(map));
    // Create a tool-bar for this map:
    final Toolbar toolbar = new Toolbar(map);
    toolbar.setButtonSize(WidgetLayout.toolbarLargeButtonSize);

    layout.addMember(toolbar);
    layout.addMember(map);
    return layout;
  }
Exemplo n.º 3
0
  private Layout() {

    vLayout = new VLayout();
    vLayout.setWidth100();
    vLayout.setHeight100();

    messageWindow = new MessageWindow(vLayout);

    vLayout.addMember(MainToolStrip.getInstance());

    mainSectionStack = new SectionStack();
    mainSectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
    mainSectionStack.setAnimateSections(true);
    mainSectionStack.setCanResizeSections(true);

    SectionStackSection mainTabSection = new SectionStackSection();
    mainTabSection.setCanCollapse(false);
    mainTabSection.setShowHeader(false);

    centerTabSet = CenterTabSet.getInstance();
    mainTabSection.addItem(centerTabSet);

    mainSectionStack.setSections(mainTabSection);

    vLayout.addMember(mainSectionStack);

    modal = new ModalWindow(vLayout);

    vLayout.draw();
  }
Exemplo n.º 4
0
  /** This is the entry point method. */
  public void onModuleLoad() {
    loading = new LoadingWindow();

    VLayout main = new VLayout();
    main.setWidth("100%");
    main.setHeight100();
    main.setAlign(Alignment.CENTER);

    Layout imgLayout = new Layout();
    content = new HLayout();
    content.setHeight100();

    Img header = new Img("GarsComLogo.jpg");
    header.setWidth(600);
    header.setHeight(130);
    header.setAlign(Alignment.CENTER);
    imgLayout.addMember(header);
    imgLayout.setWidth("100%");
    imgLayout.setAlign(Alignment.CENTER);

    main.addMember(imgLayout);
    main.addMember(content);

    Tabs tabs = new Tabs();
    content.addMember(tabs);

    main.draw();
  }
Exemplo n.º 5
0
  public CalendarCanvas() {
    VLayout mainLayout = new VLayout();
    mainLayout.setWidth100();
    mainLayout.setHeight100();

    HLayout calendarLayout = new HLayout();
    calendarLayout.setWidth100();
    calendarLayout.setHeight100();

    NavigationView view = new NavigationView(NavigationView.VIEW_CALENDER);
    view.setWidth("25%");
    view.setShowResizeBar(true);
    view.setOverflow(Overflow.CLIP_H);

    VLayout addressListLayout = new VLayout();
    addressListLayout.addMember(new AddressFilterToolbar());

    HLayout addressHLayout = new HLayout();
    AddressList list = new AddressList();
    list.setWidth("220px");
    addressHLayout.addMember(list);
    addressHLayout.addMember(new AddressEditForm());
    addressListLayout.addMember(addressHLayout);

    calendarLayout.setMembers(view, addressListLayout);

    mainLayout.addMember(calendarLayout);
    addChild(mainLayout);
  }
Exemplo n.º 6
0
  private VLayout createSearchPanel() {

    VLayout searchLayout = new VLayout();
    searchLayout.setWidth100();
    searchLayout.setHeight100();
    searchLayout.setLayoutMargin(10);
    searchLayout.setLayoutMargin(6);
    searchLayout.setMembersMargin(15);

    searchLayout.addMember(createSearchLayout());
    searchLayout.addMember(i_searchListGrid);

    i_searchListGrid
        .getField(SearchValueSetsListGrid.ID_ADD)
        .addCellSavedHandler(
            new CellSavedHandler() {
              @Override
              public void onCellSaved(CellSavedEvent event) {

                boolean hasRecordsToAdd = i_searchListGrid.hasAddRecords();
                i_addButton.setDisabled(!hasRecordsToAdd);
              }
            });

    return searchLayout;
  }
Exemplo n.º 7
0
  /**
   * Constructor requires message text
   *
   * @param text
   */
  public ActionMessage(String text) {

    VLayout vLayout = new VLayout();
    vLayout.setShowEdges(false);

    vLayout.setWidth100();
    vLayout.setHeight100();

    vLayout.setMembersMargin(0);
    vLayout.setLayoutMargin(0);

    StringBuffer sb = new StringBuffer();

    sb.append(
        "<img style=\"margin:16px;margin-top:24px;margin-left:auto;margin-right:auto;display:block;\" ");
    sb.append("src=\"" + GuiStyles.LOADING_IMAGE + "\" width=\"64\" height=\"64\" />");

    sb.append(
        "<p style=\"font:normal 11px tahoma, arial, helvetica, sans-serif;color:"
            + GuiStyles.FONT_COLOR
            + ";text-align:center;\">"
            + text
            + "</p>");

    HTMLFlow flow = new HTMLFlow();
    flow.setContents(sb.toString());

    vLayout.addMember(flow);
    this.addItem(vLayout);

    this.setTitle(GUIGlobals.APP_TITLE);

    this.setShowCloseButton(false);
    this.setShowMinimizeButton(false);

    this.setBodyColor(GuiStyles.BG_COLOR);

    this.setWidth(240);
    this.setHeight(160);

    this.centerInPage();
    this.draw();
  }
  private Layout buildHeader() {
    HLayout header = new HLayout();
    header.setWidth100();
    header.setLayoutMargin(10);
    header.setBackgroundImage(GWT.getModuleBaseURL() + "admin/images/header_bg.png");

    LayoutSpacer sp = new LayoutSpacer();
    sp.setWidth(20);
    header.addMember(sp);
    header.addMember(buildLogo());
    header.addMember(new LayoutSpacer());

    VLayout userAndLocale = new VLayout();
    userAndLocale.setHeight100();
    userAndLocale.addMember(buildUserInfo());
    // userAndLocale.addMember(buildLocaleSelection());

    header.addMember(userAndLocale);
    return header;
  }
  public void build(DataSource entityDataSource, DataSource... additionalDataSources) {
    VLayout leftVerticalLayout = new VLayout();
    leftVerticalLayout.setID("staticFolderAssetsGridLayout");
    leftVerticalLayout.setHeight100();
    leftVerticalLayout.setWidth("40%");
    leftVerticalLayout.setShowResizeBar(true);

    listDisplay = new DynamicEntityListView(entityDataSource);
    listDisplay.getGrid().setHoverMoveWithMouse(true);
    listDisplay.getGrid().setCanHover(true);
    listDisplay.getGrid().setShowHover(true);
    listDisplay.getGrid().setHoverOpacity(75);
    listDisplay
        .getGrid()
        .setHoverCustomizer(
            new HoverCustomizer() {
              @Override
              public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
                if (record != null
                    && record.getAttribute("lockedFlag") != null
                    && record.getAttributeAsBoolean("lockedFlag")) {
                  return BLCMain.getMessageManager()
                      .replaceKeys(
                          BLCMain.getMessageManager().getString("lockedMessage"),
                          new String[] {"userName", "date"},
                          new String[] {
                            record.getAttribute("auditable.updatedBy.name"),
                            record.getAttribute("auditable.dateUpdated")
                          });
                }
                return null;
              }
            });

    leftVerticalLayout.addMember(listDisplay);

    dynamicFormDisplay = new DynamicFormView(entityDataSource);

    addMember(leftVerticalLayout);
    addMember(dynamicFormDisplay);
  }
Exemplo n.º 10
0
  private void initLayout() {
    headerView = new HeaderView();
    actionMenubarView = new ActionMenubarView();
    navigationView = new NavigationView();
    baseContainerView = BaseContainerView.getContainer();

    VLayout mainLayout = new VLayout();
    mainLayout.setCanSelectText(true);
    mainLayout.setStyleName("mainLayout");
    mainLayout.setWidth100();
    mainLayout.setHeight100();

    HLayout headerLayout = new HLayout();
    headerLayout.setWidth100();
    headerLayout.setHeight(UIConstants.HEADER_HEIGHT);
    headerLayout.addMember(headerView);
    mainLayout.addMember(headerLayout);

    HLayout centerLayout = new HLayout();

    navigationView.setShowResizeBar(true);
    centerLayout.addMember(navigationView);

    VLayout containerLayout = new VLayout();
    containerLayout.setBorder("1px solid #a1a1a1");
    containerLayout.setLayoutMargin(2);
    // containerLayout.addMember(actionMenubarView);
    containerLayout.addMember(baseContainerView);
    centerLayout.addMember(containerLayout);
    mainLayout.addMember(centerLayout);

    HLayout southLayout = new HLayout();
    southLayout.setWidth100();
    southLayout.setHeight(30);
    mainLayout.addMember(southLayout);

    initWidget(mainLayout);
  }
Exemplo n.º 11
0
  public void build(DataSource entityDataSource, DataSource... additionalDataSources) {
    VLayout leftVerticalLayout = new VLayout();
    leftVerticalLayout.setID("customerLeftVerticalLayout");
    leftVerticalLayout.setHeight100();
    leftVerticalLayout.setWidth("50%");
    leftVerticalLayout.setShowResizeBar(true);

    listDisplay =
        new DynamicEntityListView(
            BLCMain.getMessageManager().getString("customerListTitle"),
            entityDataSource,
            false,
            false);
    leftVerticalLayout.addMember(listDisplay);

    dynamicFormDisplay =
        new DynamicFormView(
            BLCMain.getMessageManager().getString("customerDetailsTitle"), entityDataSource);
    dynamicFormDisplay.setWidth("50%");
    ToolStrip toolbar = dynamicFormDisplay.getToolbar();
    toolbar.addFill();
    Label label = new Label();
    label.setContents(BLCMain.getMessageManager().getString("resetPasswordPrompt"));
    label.setWrap(false);
    toolbar.addMember(label);

    updateLoginButton = new ToolStripButton();
    updateLoginButton.setIcon(
        GWT.getModuleBaseURL() + "sc/skins/Enterprise/images/headerIcons/settings.png");
    updateLoginButton.setDisabled(true);
    toolbar.addButton(updateLoginButton);
    toolbar.addSpacer(6);

    addMember(leftVerticalLayout);
    addMember(dynamicFormDisplay);
  }
Exemplo n.º 12
0
    public FieldsDialog() {

      super();
      setIsModal(true);
      setShowHeader(false);
      setShowEdges(true);
      setEdgeSize(2);
      setWidth(DIALOG_WIDTH);
      setHeight(DIALOG_HEIGHT);
      setAlign(Alignment.LEFT);

      Map<String, Integer> bodyDefaults = new HashMap<String, Integer>();
      bodyDefaults.put("layoutLeftMargin", 2);
      bodyDefaults.put("layoutTopMargin", 20);
      bodyDefaults.put("layoutButtonMargin", 2);
      setBodyDefaults(bodyDefaults);

      VLayout layout = new VLayout();
      layout.setOverflow(Overflow.HIDDEN);
      layout.setHeight100();
      layout.setWidth100();

      DynamicForm fieldForm = new DynamicForm();
      fieldForm.setTitleWidth(5);
      fieldForm.setAutoHeight();

      this.checkBoxFrom =
          new CheckboxItem(
              MessageListFields.FROM.name(), TextProvider.get().extended_search_panel_from());
      this.checkBoxTo =
          new CheckboxItem(
              MessageListFields.TO.name(), TextProvider.get().extended_search_panel_to());
      this.checkBoxCc =
          new CheckboxItem(
              MessageListFields.CC.name(), TextProvider.get().extended_search_panel_cc());
      this.checkBoxSubject =
          new CheckboxItem(
              MessageListFields.SUBJECT.name(), TextProvider.get().extended_search_panel_subject());
      this.checkBoxContent =
          new CheckboxItem(
              MessageListFields.CONTENT.name(), TextProvider.get().extended_search_panel_body());

      final IButton searchButton = new IButton(TextProvider.get().extended_search_panel_search());
      searchButton.setAutoFit(true);
      searchButton.setAlign(Alignment.CENTER);
      searchButton.addClickHandler(
          new ClickHandler() {

            public void onClick(ClickEvent event) {

              searchFields = getFields();
              hide();
              fireSearchEvent();
            }
          });

      fieldForm.setItems(
          this.checkBoxFrom,
          this.checkBoxTo,
          this.checkBoxCc,
          this.checkBoxSubject,
          this.checkBoxContent);

      layout.setMembers(fieldForm, searchButton);
      setMembers(layout);

      addMouseOutHandler(
          new MouseOutHandler() {

            public void onMouseOut(MouseOutEvent event) {

              FieldsDialog dialog = (FieldsDialog) event.getSource();

              // Workaround because the mouse out handler doesn't work
              // correctly
              if ((event.getX() < dialog.getAbsoluteLeft()
                      || event.getX() > (dialog.getAbsoluteLeft() + dialog.getWidth() - 5))
                  || (event.getY() < dialog.getAbsoluteTop()
                      || event.getY() > (dialog.getAbsoluteTop() + dialog.getHeight() - 10))) {
                hide();
              }
            }
          });
    }
Exemplo n.º 13
0
  public DlgSortOrderOrgs(TabOrganization tabOrganization, Record records[]) {
    try {
      this.tabOrganization = tabOrganization;
      setTitle(CallCenter.constants.sortOrgs());

      setHeight(710);
      setWidth(1000);
      setShowMinimizeButton(false);
      setIsModal(true);
      setShowModalMask(true);
      setCanDrag(false);
      setCanDragReposition(false);
      setCanDragResize(false);
      setCanDragScroll(false);
      centerInPage();

      hLayout = new VLayout(5);
      hLayout.setWidth100();
      hLayout.setHeight100();
      hLayout.setPadding(10);

      //			ToolStrip toolStrip = new ToolStrip();
      //			toolStrip.setWidth100();
      //			toolStrip.setPadding(5);
      //			hLayout.addMember(toolStrip);
      //
      //			upBtn = new ToolStripButton(CallCenter.constants.sortUp(),
      //					"sortUp.png");
      //			upBtn.setLayoutAlign(Alignment.LEFT);
      //			upBtn.setWidth(50);
      //			toolStrip.addButton(upBtn);
      //
      //			downBtn = new ToolStripButton(CallCenter.constants.sortDown(),
      //					"sortDown.png");
      //			downBtn.setLayoutAlign(Alignment.LEFT);
      //			downBtn.setWidth(50);
      //			toolStrip.addButton(downBtn);

      listGrid =
          new ListGrid() {
            protected String getCellCSSText(ListGridRecord record, int rowNum, int colNum) {
              ListGridRecord countryRecord = (ListGridRecord) record;
              if (countryRecord == null) {
                return super.getCellCSSText(record, rowNum, colNum);
              }
              Integer deleted = countryRecord.getAttributeAsInt("deleted");
              if (deleted != null && !deleted.equals(0)) {
                return "color:red;";
              } else {
                Integer statuse = countryRecord.getAttributeAsInt("statuse");
                switch (statuse) {
                  case 1: // not functions
                    return "color:pink;";
                  case 2: // disabled
                    return "text-decoration:line-through;";
                  default:
                    return super.getCellCSSText(record, rowNum, colNum);
                }
              }
            };
          };
      listGrid.setWidth100();
      listGrid.setHeight(625);
      listGrid.setCanReorderRecords(true);
      listGrid.setCanAcceptDroppedRecords(true);
      listGrid.setAutoSaveEdits(false);
      listGrid.setCanSelectAll(false);
      listGrid.setData(records);

      ListGridField nameField = new ListGridField("org_name", CallCenter.constants.orgName(), 400);

      ListGridField identcode =
          new ListGridField("identcode", CallCenter.constants.identCode(), 150);

      ListGridField director = new ListGridField("director", CallCenter.constants.director(), 150);

      ListGridField real_address =
          new ListGridField("real_address", CallCenter.constants.orgAddress(), 230);

      identcode.setAlign(Alignment.CENTER);
      director.setAlign(Alignment.CENTER);
      real_address.setAlign(Alignment.LEFT);

      listGrid.setFields(nameField, identcode, director, real_address);

      hLayout.addMember(listGrid);

      HLayout hLayoutItem = new HLayout(5);
      hLayoutItem.setWidth100();
      hLayoutItem.setAlign(Alignment.RIGHT);

      IButton saveItem = new IButton();
      saveItem.setTitle(CallCenter.constants.save());
      saveItem.setWidth(100);

      IButton cancItem = new IButton();
      cancItem.setTitle(CallCenter.constants.close());
      cancItem.setWidth(100);

      hLayoutItem.setMembers(saveItem, cancItem);

      hLayout.addMember(hLayoutItem);

      cancItem.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              destroy();
            }
          });
      saveItem.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              save();
            }
          });

      addItem(hLayout);
    } catch (Exception e) {
      e.printStackTrace();
      SC.say(e.toString());
    }
  }
Exemplo n.º 14
0
  public SmsQueueWindow(final Integer smsInfoId, String sms, String name) {
    setTitle(TicketMaster.constants.sms_numbers());
    setWidth(600);
    setHeight(500);
    setIsModal(true);
    setShowModalMask(true);
    setShowMaximizeButton(true);
    setShowMinimizeButton(false);
    setShowCloseButton(true);
    setAutoDraw(true);
    centerInPage();

    VLayout vLayout = new VLayout();
    vLayout.setWidth100();
    vLayout.setHeight100();
    form = new DynamicForm();
    form.setPadding(15);
    form.setWidth100();
    form.setNumCols(2);
    smsField = new StaticTextItem("sms", TicketMaster.constants.sms_sms());
    smsField.setValue(sms);
    smsField.setTitleVAlign(VerticalAlignment.TOP);

    StaticTextItem nameField = new StaticTextItem("name", TicketMaster.constants.name());
    nameField.setValue(name);
    form.setFields(nameField, smsField);

    Criteria c = new Criteria();
    c.setAttribute("timestamp", new Date().getTime());
    c.setAttribute("sms_info_id", smsInfoId);

    grid = new ListGrid();
    grid.setWidth100();
    grid.setHeight100();
    grid.setDataSource(DataSource.get("SMSBroadcastDS"));
    grid.setFetchOperation("getNumbers");
    grid.setCriteria(c);
    grid.setAutoFetchData(true);
    ListGridField sendDateField =
        new ListGridField("send_date", TicketMaster.constants.sms_sendDate(), 120);
    sendDateField.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);
    ListGridField deliveryDateField =
        new ListGridField("delivery_date", TicketMaster.constants.sms_deliveryDate(), 120);
    deliveryDateField.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);
    grid.setFields(
        new ListGridField("id", "ID", 60),
        new ListGridField("phone_number", TicketMaster.constants.sms_number()),
        new ListGridField("state", TicketMaster.constants.sms_state()),
        sendDateField,
        deliveryDateField);

    IButton exportBtn = new IButton(TicketMaster.constants.sms_export());
    exportBtn.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent clickEvent) {
            com.google.gwt.user.client.Window.open(
                "./SMSBroadcast/ExportNumbers?sms_info_id=" + smsInfoId, "_self", "");
          }
        });
    exportBtn.setIcon("excel.gif");

    HLayout bbar = new HLayout();
    bbar.setAlign(Alignment.RIGHT);
    bbar.setMembersMargin(5);
    bbar.setPadding(5);
    bbar.addMembers(exportBtn);
    vLayout.addMembers(form, grid, bbar);

    addItem(vLayout);
  }
  public UserPermissionView(Boolean canReorder, Boolean canEdit) {
    setHeight100();
    setWidth100();
    setBackgroundColor("#eaeaea");
    setOverflow(Overflow.AUTO);

    HStack hStack = new HStack(10);
    hStack.setID("userPermissionHStack");

    hStack.setHeight("45%");
    hStack.setWidth100();
    hStack.setBackgroundColor("#eaeaea");
    hStack.setAlign(Alignment.CENTER);

    VLayout stack = new VLayout();
    stack.setID("userPermissionVerticalLayout");
    stack.setHeight100();
    stack.setWidth100();

    toolBar = new ToolStrip();
    toolBar.setHeight(30);
    toolBar.setWidth100();
    toolBar.setMinWidth(300);
    toolBar.addSpacer(6);
    addButton = new ToolStripButton();
    addButton.setTitle(BLCMain.getMessageManager().getString("addTitle"));
    addButton.setIcon(GWT.getModuleBaseURL() + "sc/skins/Enterprise/images/actions/add.png");
    addButton.setDisabled(true);
    toolBar.addButton(addButton);
    removeButton = new ToolStripButton();
    removeButton.setTitle(BLCMain.getMessageManager().getString("removeTitle"));
    removeButton.setIcon(GWT.getModuleBaseURL() + "sc/skins/Enterprise/images/actions/remove.png");
    removeButton.setDisabled(true);
    toolBar.addButton(removeButton);
    toolBar.addSpacer(6);
    toolBar.setDisabled(false);
    toolBar.addFill();
    stack.addMember(toolBar);

    grid = new ListGrid();
    grid.setAutoFetchData(false);
    grid.setShowHeader(true);
    grid.setShowHeaderContextMenu(false);
    grid.setPreventDuplicates(true);
    grid.setCanReorderRecords(canReorder);
    grid.setDisabled(true);
    grid.setCanSort(false);
    grid.setCellPadding(5);
    grid.setCanEdit(canEdit);
    grid.setEditEvent(ListGridEditEvent.DOUBLECLICK);
    grid.setEditByCell(true);
    grid.setAutoSaveEdits(true);
    grid.setSaveByCell(true);
    grid.setAlternateRecordStyles(true);
    grid.setCanGroupBy(false);
    if (!canEdit) {
      grid.setAlternateBodyStyleName("editRowDisabled");
    }
    stack.addMember(grid);

    hStack.addMember(stack);
    hStack.setOverflow(Overflow.AUTO);

    addMember(hStack);
  }
Exemplo n.º 16
0
  public TabCalendar() {
    try {
      setTitle(CallCenter.constants.menuCalendar());
      setCanClose(true);

      datasource = DataSource.get("CalSecDS");

      mainLayout = new VLayout(5);
      mainLayout.setWidth100();
      mainLayout.setHeight100();
      mainLayout.setMargin(5);

      searchForm = new DynamicForm();
      searchForm.setAutoFocus(true);
      searchForm.setWidth(780);
      searchForm.setTitleWidth(300);
      searchForm.setNumCols(4);
      mainLayout.addMember(searchForm);

      calendarStateItem = new ComboBoxItem();
      calendarStateItem.setTitle(CallCenter.constants.type());
      calendarStateItem.setWidth(300);
      calendarStateItem.setName("calendar_state_id");
      calendarStateItem.setValueMap(ClientMapUtil.getInstance().getCalendarStates());
      calendarStateItem.setAddUnknownValues(false);

      secCalendarTypeItem = new ComboBoxItem();
      secCalendarTypeItem.setTitle(CallCenter.constants.moonPhase());
      secCalendarTypeItem.setWidth(300);
      secCalendarTypeItem.setName("calendar_event_id");
      secCalendarTypeItem.setValueMap(ClientMapUtil.getInstance().getSecCalendarTypes());
      secCalendarTypeItem.setAddUnknownValues(false);

      calendarDayItem = new DateItem();
      calendarDayItem.setTitle(CallCenter.constants.date());
      calendarDayItem.setWidth(300);
      calendarDayItem.setValue(new Date());
      calendarDayItem.setName("calendar_day");
      calendarDayItem.setHint(CallCenter.constants.choose());

      descriptionItem = new TextItem();
      descriptionItem.setTitle(CallCenter.constants.description());
      descriptionItem.setName("calendar_description");
      descriptionItem.setWidth(300);

      commentItem = new TextItem();
      commentItem.setTitle(CallCenter.constants.comment());
      commentItem.setName("calendar_comment");
      commentItem.setWidth(300);

      byCalendarDayItem = new CheckboxItem();
      byCalendarDayItem.setTitle(CallCenter.constants.searchByDate());
      byCalendarDayItem.setWidth(300);
      byCalendarDayItem.setName("buCalDaySearch");
      byCalendarDayItem.setValue(false);

      searchForm.setFields(
          calendarStateItem,
          secCalendarTypeItem,
          descriptionItem,
          commentItem,
          byCalendarDayItem,
          calendarDayItem);

      HLayout buttonLayout = new HLayout(5);
      buttonLayout.setWidth(780);
      buttonLayout.setHeight(30);
      buttonLayout.setAlign(Alignment.RIGHT);

      clearButton = new IButton();
      clearButton.setTitle(CallCenter.constants.clear());

      findButton = new IButton();
      findButton.setTitle(CallCenter.constants.find());

      buttonLayout.setMembers(findButton, clearButton);
      mainLayout.addMember(buttonLayout);

      ToolStrip toolStrip = new ToolStrip();
      toolStrip.setWidth(780);
      toolStrip.setPadding(5);
      mainLayout.addMember(toolStrip);

      addBtn = new ToolStripButton(CallCenter.constants.add(), "addIcon.png");
      addBtn.setLayoutAlign(Alignment.LEFT);
      addBtn.setWidth(50);
      toolStrip.addButton(addBtn);

      editBtn = new ToolStripButton(CallCenter.constants.modify(), "editIcon.png");
      editBtn.setLayoutAlign(Alignment.LEFT);
      editBtn.setWidth(50);
      toolStrip.addButton(editBtn);

      disableBtn = new ToolStripButton(CallCenter.constants.disable(), "deleteIcon.png");
      disableBtn.setLayoutAlign(Alignment.LEFT);
      disableBtn.setWidth(50);
      toolStrip.addButton(disableBtn);

      activateBtn = new ToolStripButton(CallCenter.constants.enable(), "restoreIcon.gif");
      activateBtn.setLayoutAlign(Alignment.LEFT);
      activateBtn.setWidth(50);
      toolStrip.addButton(activateBtn);

      toolStrip.addSeparator();

      copyBtn = new ToolStripButton(CallCenter.constants.copy(), "copy.png");
      copyBtn.setLayoutAlign(Alignment.LEFT);
      copyBtn.setWidth(50);
      toolStrip.addButton(copyBtn);

      listGrid =
          new ListGrid() {
            protected String getCellCSSText(ListGridRecord record, int rowNum, int colNum) {
              ListGridRecord countryRecord = (ListGridRecord) record;
              if (countryRecord == null) {
                return super.getCellCSSText(record, rowNum, colNum);
              }
              Integer deleted = countryRecord.getAttributeAsInt("deleted");
              if (deleted != null && !deleted.equals(0)) {
                return "color:red;";
              } else {
                return super.getCellCSSText(record, rowNum, colNum);
              }
            };
          };

      listGrid.setWidth(780);
      listGrid.setHeight(260);
      listGrid.setAlternateRecordStyles(true);
      listGrid.setDataSource(datasource);
      listGrid.setAutoFetchData(false);
      listGrid.setShowFilterEditor(false);
      listGrid.setCanEdit(false);
      listGrid.setCanRemoveRecords(false);
      listGrid.setFetchOperation("searchAllSecularCalendars");
      listGrid.setShowRowNumbers(true);
      listGrid.setCanHover(true);
      listGrid.setShowHover(true);
      listGrid.setShowHoverComponents(true);

      datasource.getField("calendar_day").setTitle(CallCenter.constants.date());
      datasource.getField("event").setTitle(CallCenter.constants.moonPhase());
      datasource.getField("state").setTitle(CallCenter.constants.type());
      datasource.getField("sun_rise").setTitle(CallCenter.constants.order());
      datasource.getField("calendar_description").setTitle(CallCenter.constants.description());

      datasource.getField("calendar_comment").setTitle(CallCenter.constants.comment());
      datasource.getField("rec_date").setTitle(CallCenter.constants.recDate());
      datasource.getField("rec_user").setTitle(CallCenter.constants.recUser());
      datasource.getField("upd_date").setTitle(CallCenter.constants.updDate());
      datasource.getField("upd_user").setTitle(CallCenter.constants.updUser());

      ListGridField calendar_day =
          new ListGridField("calendar_day", CallCenter.constants.date(), 150);
      ListGridField event = new ListGridField("event", CallCenter.constants.moonPhase(), 150);
      ListGridField state = new ListGridField("state", CallCenter.constants.type(), 80);
      ListGridField sun_rise = new ListGridField("sun_rise", CallCenter.constants.sunRise(), 100);
      ListGridField calendar_description =
          new ListGridField("calendar_description", CallCenter.constants.description(), 250);

      calendar_day.setAlign(Alignment.LEFT);
      event.setAlign(Alignment.LEFT);
      state.setAlign(Alignment.CENTER);
      sun_rise.setAlign(Alignment.CENTER);

      listGrid.setFields(calendar_day, event, state, sun_rise, calendar_description);

      mainLayout.addMember(listGrid);
      findButton.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              search();
            }
          });
      clearButton.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              calendarStateItem.clearValue();
              secCalendarTypeItem.clearValue();
              calendarDayItem.clearValue();
              descriptionItem.clearValue();
              commentItem.clearValue();
            }
          });
      addBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              DlgAddEditSecCalendar dlgEditSecCalendar =
                  new DlgAddEditSecCalendar(listGrid, null, false);
              dlgEditSecCalendar.show();
            }
          });

      editBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              ListGridRecord listGridRecord = listGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenter.constants.pleaseSelrecord());
                return;
              }
              DlgAddEditSecCalendar dlgEditSecCalendar =
                  new DlgAddEditSecCalendar(listGrid, listGridRecord, false);
              dlgEditSecCalendar.show();
            }
          });

      copyBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              ListGridRecord listGridRecord = listGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenter.constants.pleaseSelrecord());
                return;
              }
              DlgAddEditSecCalendar dlgEditSecCalendar =
                  new DlgAddEditSecCalendar(listGrid, listGridRecord, true);
              dlgEditSecCalendar.show();
            }
          });

      disableBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              ListGridRecord listGridRecord = listGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenter.constants.pleaseSelrecord());
                return;
              }
              Integer deleted = listGridRecord.getAttributeAsInt("deleted");
              if (!deleted.equals(0)) {
                SC.say(CallCenter.constants.recordAlrDisabled());
                return;
              }
              final Integer calendar_id = listGridRecord.getAttributeAsInt("calendar_id");
              SC.ask(
                  CallCenter.constants.askForDisable(),
                  new BooleanCallback() {
                    @Override
                    public void execute(Boolean value) {
                      if (value) {
                        changeStatus(calendar_id, 1);
                      }
                    }
                  });
            }
          });
      activateBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              ListGridRecord listGridRecord = listGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenter.constants.pleaseSelrecord());
                return;
              }
              Integer deleted = listGridRecord.getAttributeAsInt("deleted");
              if (deleted.equals(0)) {
                SC.say(CallCenter.constants.recordAlrEnabled());
                return;
              }
              final Integer calendar_id = listGridRecord.getAttributeAsInt("calendar_id");
              SC.ask(
                  CallCenter.constants.askForEnable(),
                  new BooleanCallback() {
                    @Override
                    public void execute(Boolean value) {
                      if (value) {
                        changeStatus(calendar_id, 0);
                      }
                    }
                  });
            }
          });

      TabSet tabSet = new TabSet();
      tabSet.setWidth(780);
      Tab tabDetViewer = new Tab(CallCenter.constants.view());
      final DetailViewer detailViewer = new DetailViewer();
      detailViewer.setDataSource(datasource);
      detailViewer.setWidth(750);
      tabDetViewer.setPane(detailViewer);

      listGrid.addRecordClickHandler(
          new RecordClickHandler() {
            public void onRecordClick(RecordClickEvent event) {
              detailViewer.viewSelectedData(listGrid);
            }
          });

      listGrid.addRecordDoubleClickHandler(
          new RecordDoubleClickHandler() {
            @Override
            public void onRecordDoubleClick(RecordDoubleClickEvent event) {
              ListGridRecord listGridRecord = listGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenter.constants.pleaseSelrecord());
                return;
              }
              DlgAddEditSecCalendar dlgEditSecCalendar =
                  new DlgAddEditSecCalendar(listGrid, listGridRecord, false);
              dlgEditSecCalendar.show();
            }
          });

      tabSet.setTabs(tabDetViewer);
      mainLayout.addMember(tabSet);
      setPane(mainLayout);
    } catch (Exception e) {
      e.printStackTrace();
      SC.say(e.getMessage().toString());
    }
  }
  public ItemRemoveModalPanel(
      String title,
      String itemsString,
      final ListModel model,
      ObjectNameResolver nameResolver,
      final GridController gridController) {
    super(panelWidth, panelHeight, title);

    this.model = model;

    VLayout inPanel = new VLayout();
    inPanel.setHeight100();
    inPanel.setWidth100();

    Label message = new Label("Are you sure you want to remove the following " + itemsString + "?");
    message.setStyleName("removePanelLabel");
    message.setAutoHeight();
    inPanel.addMember(message);

    for (Object item : model.getSelectedItems()) {
      Label l = new Label("- " + nameResolver.getItemName(item));
      l.setStyleName("removePanelItems");
      l.setAutoHeight();
      l.setValign(VerticalAlignment.TOP);
      inPanel.addMember(l);
    }

    model
        .getPropertyChangedEvent()
        .addListener(
            new IEventListener() {
              @Override
              public void eventRaised(Event ev, Object sender, EventArgs args) {
                String propertyName = ((PropertyChangedEventArgs) args).PropertyName;
                GWT.log("DERBA: " + propertyName);
                if (propertyName.equals("Window") || propertyName.equals("ConfirmationModel")) {
                  destroy();
                  model.getPropertyChangedEvent().removeListener(this);
                  if (gridController != null) gridController.gridChangePerformed();
                }
              }
            });

    Button okButton = new Button("OK");
    okButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            model.ExecuteCommand(new UICommand("OnRemove", model));
          }
        });

    Button cancelButton = new Button("Cancel");
    cancelButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            onClose();
          }
        });

    setFooterButtons(Alignment.RIGHT, okButton, cancelButton);

    addItem(inPanel);
  }
  public Canvas getSearchCanvas() {
    final VLayout mainLayout = new VLayout(20);
    mainLayout.setWidth100();
    mainLayout.setHeight100();
    mainLayout.setPadding(5);

    Label titleBar = new Label(MESSAGES.geometricSearchWidgetFreeDrawingSearchTitle());
    titleBar.setBackgroundColor("#E0E9FF");
    titleBar.setWidth100();
    titleBar.setHeight(20);
    titleBar.setPadding(5);

    HLayout geomsButtonBar = new HLayout();
    geomsButtonBar.setWidth100();
    geomsButtonBar.setAutoHeight();
    geomsButtonBar.setMembersMargin(10);
    HLayout actionsButtonBar = new HLayout();
    actionsButtonBar.setWidth100();
    actionsButtonBar.setAutoHeight();
    actionsButtonBar.setMembersMargin(10);

    btnPoint = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingPoint());
    btnPoint.setIcon(WidgetLayout.iconPointCreate);
    btnPoint.setWidth(
        btnPoint.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset);
    btnPoint.setActionType(SelectionType.RADIO);
    btnPoint.setRadioGroup("drawType");
    btnPoint.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onDrawPoint();
          }
        });

    btnLine = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingLine());
    btnLine.setIcon(WidgetLayout.iconLineCreate);
    btnLine.setWidth(
        btnLine.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset);
    btnLine.setActionType(SelectionType.RADIO);
    btnLine.setRadioGroup("drawType");
    btnLine.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onDrawLine();
          }
        });

    btnPolygon = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingPolygon());
    btnPolygon.setIcon(WidgetLayout.iconPolygonCreate);
    btnPolygon.setWidth(
        btnPolygon.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset);
    btnPolygon.setActionType(SelectionType.RADIO);
    btnPolygon.setRadioGroup("drawType");
    btnPolygon.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onDrawPolygon();
          }
        });

    btnUndo = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingUndo());
    btnUndo.setIcon(WidgetLayout.iconUndo);
    btnUndo.setWidth(
        btnUndo.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset);
    btnUndo.setDisabled(true);
    btnUndo.setShowDisabledIcon(false);
    btnUndo.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onUndo();
          }
        });

    btnRedo = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingRedo());
    btnRedo.setIcon(WidgetLayout.iconRedo);
    btnRedo.setWidth(
        btnRedo.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset);
    btnRedo.setDisabled(true);
    btnRedo.setShowDisabledIcon(false);
    btnRedo.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onRedo();
          }
        });

    frmBuffer = new DynamicForm();
    frmBuffer.setWidth100();
    spiBuffer = new SpinnerItem();
    spiBuffer.setTitle(MESSAGES.geometricSearchWidgetBufferLabel());
    spiBuffer.setDefaultValue(5);
    spiBuffer.setMin(0);
    spiBuffer.setWidth(60);
    spiBuffer.addChangedHandler(
        new ChangedHandler() {
          public void onChanged(ChangedEvent event) {
            updateView();
          }
        });
    frmBuffer.setFields(spiBuffer);

    // ----------------------------------------------------------

    geomsButtonBar.addMember(btnPoint);
    geomsButtonBar.addMember(btnLine);
    geomsButtonBar.addMember(btnPolygon);

    actionsButtonBar.addMember(btnUndo);
    actionsButtonBar.addMember(btnRedo);

    mainLayout.addMember(titleBar);
    mainLayout.addMember(geomsButtonBar);
    mainLayout.addMember(actionsButtonBar);
    mainLayout.addMember(frmBuffer);

    return mainLayout;
  }
Exemplo n.º 19
0
  private void build() {
    final VLayout layout = new VLayout();
    layout.setMargin(5);

    final VStack infraLayout = new VStack();
    infraLayout.setHeight(26);
    final Label infraLabel = new Label("Updating available Infrastructures and Policies");
    infraLabel.setIcon("loading.gif");
    infraLabel.setHeight(26);
    infraLabel.setAlign(Alignment.CENTER);
    infraLayout.addMember(infraLabel);

    final DynamicForm infraForm = new DynamicForm();
    infraForm.setEncoding(Encoding.MULTIPART);
    infraForm.setMethod(FormMethod.POST);
    infraForm.setAction(GWT.getModuleBaseURL() + "createnodesource");
    infraForm.setTarget("__hiddenFrame");

    infraLayout.addMember(infraForm);

    final Label label =
        new Label(
            "A Node Source is a combination of an Infrastructure, which defines how resources"
                + " will be acquired, and a Policy, that dictates when resources can be acquired.");
    label.setHeight(40);

    final HashMap<String, List<FormItem>> allForms = new HashMap<String, List<FormItem>>();

    controller.fetchSupportedInfrastructuresAndPolicies(
        new Runnable() {
          public void run() {

            infraSelect = new SelectItem("infra", "Infrastructure");
            infraSelect.setRequired(true);
            policySelect = new SelectItem("policy", "Policy");
            policySelect.setRequired(true);

            infraSelect.setWidth(300);
            policySelect.setWidth(300);

            HiddenItem name = new HiddenItem("nsName");
            HiddenItem callback = new HiddenItem("nsCallback");
            HiddenItem session = new HiddenItem("sessionId");

            ArrayList<FormItem> tmpAll = new ArrayList<FormItem>();
            tmpAll.add(name);
            tmpAll.add(callback);
            tmpAll.add(session);
            tmpAll.add(infraSelect);

            LinkedHashMap<String, String> values = new LinkedHashMap<String, String>();
            for (PluginDescriptor inf :
                controller.getModel().getSupportedInfrastructures().values()) {
              String shortName =
                  inf.getPluginName().substring(inf.getPluginName().lastIndexOf('.') + 1);
              values.put(inf.getPluginName(), shortName);

              List<Field> configurableFields = inf.getConfigurableFields();
              ArrayList<FormItem> forms = new ArrayList<FormItem>(configurableFields.size());
              for (Field f : configurableFields) {
                FormItem infra = null;
                if (f.isPassword()) {
                  infra = new PasswordItem(inf.getPluginName() + f.getName(), f.getName());
                } else if (f.isFile() || f.isCredential()) {
                  infra = new UploadItem(inf.getPluginName() + f.getName(), f.getName());
                  if (f.isCredential()) {
                    PickerIcon cred =
                        new PickerIcon(
                            new Picker(Images.instance.key_16().getSafeUri().asString()),
                            new FormItemClickHandler() {
                              @Override
                              public void onFormItemClick(FormItemIconClickEvent event) {
                                CredentialsWindow win = new CredentialsWindow();
                                win.show();
                              }
                            });
                    cred.setPrompt("Create a Credential file");
                    cred.setWidth(16);
                    cred.setHeight(16);
                    cred.setAttribute("hspace", 6);
                    infra.setIcons(cred);
                  }
                } else {
                  infra = new TextItem(inf.getPluginName() + f.getName(), f.getName());
                }
                infra.setValue(f.getValue());
                infra.setWidth(250);
                infra.setHint("<nobr>" + f.getDescription() + "</nobr>");
                forms.add(infra);
                tmpAll.add(infra);
              }
              allForms.put(inf.getPluginName(), forms);
            }
            infraSelect.setValueMap(values);

            tmpAll.add(new SpacerItem());
            values.clear();
            tmpAll.add(policySelect);
            for (PluginDescriptor inf : controller.getModel().getSupportedPolicies().values()) {
              String shortName =
                  inf.getPluginName().substring(inf.getPluginName().lastIndexOf('.') + 1);
              values.put(inf.getPluginName(), shortName);

              List<Field> configurableFields = inf.getConfigurableFields();
              ArrayList<FormItem> forms = new ArrayList<FormItem>(configurableFields.size());
              for (Field f : configurableFields) {
                FormItem pol = null;
                if (f.isPassword()) {
                  pol = new PasswordItem(inf.getPluginName() + f.getName(), f.getName());
                } else if (f.isFile() || f.isCredential()) {
                  pol = new UploadItem(inf.getPluginName() + f.getName(), f.getName());
                  if (f.isCredential()) {
                    PickerIcon cred =
                        new PickerIcon(
                            new Picker(Images.instance.key_16().getSafeUri().asString()),
                            new FormItemClickHandler() {
                              @Override
                              public void onFormItemClick(FormItemIconClickEvent event) {
                                CredentialsWindow win = new CredentialsWindow();
                                win.show();
                              }
                            });
                    cred.setPrompt("Create a Credential file");
                    cred.setWidth(16);
                    cred.setHeight(16);
                    cred.setAttribute("hspace", 6);
                    pol.setIcons(cred);
                  }
                } else {
                  pol = new TextItem(inf.getPluginName() + f.getName(), f.getName());
                }
                pol.setValue(f.getValue());
                pol.setWidth(250);
                pol.setHint("<nobr>" + f.getDescription() + "</nobr>");
                forms.add(pol);
                tmpAll.add(pol);
              }
              allForms.put(inf.getPluginName(), forms);
            }
            policySelect.setValueMap(values);

            infraSelectChanged =
                new Runnable() {
                  @Override
                  public void run() {
                    if (policySelect.getValueAsString() == null) {
                      return;
                    }

                    String nsName = infraSelect.getValueAsString();
                    if (oldInfra != null) {
                      for (FormItem f : allForms.get(oldInfra)) {
                        f.hide();
                      }
                    }
                    for (FormItem f : allForms.get(nsName)) {
                      f.show();
                    }

                    if (oldInfra == null) {
                      oldInfra = nsName;
                      policySelectChanged.run();
                    } else {
                      oldInfra = nsName;
                    }
                  }
                };

            policySelectChanged =
                new Runnable() {
                  @Override
                  public void run() {
                    if (infraSelect.getValueAsString() == null) {
                      return;
                    }

                    String policy = policySelect.getValueAsString();
                    if (oldPolicy != null) {
                      for (FormItem f : allForms.get(oldPolicy)) {
                        f.hide();
                      }
                    }
                    for (FormItem f : allForms.get(policy)) {
                      f.show();
                    }

                    if (oldPolicy == null) {
                      oldPolicy = policy;
                      infraSelectChanged.run();
                    } else {
                      oldPolicy = policy;
                    }
                  }
                };

            infraSelect.addChangedHandler(
                new ChangedHandler() {
                  public void onChanged(ChangedEvent event) {
                    infraSelectChanged.run();
                  }
                });

            policySelect.addChangedHandler(
                new ChangedHandler() {
                  public void onChanged(ChangedEvent event) {
                    policySelectChanged.run();
                  }
                });

            infraForm.setFields(tmpAll.toArray(new FormItem[tmpAll.size()]));
            infraLabel.hide();
            infraForm.show();

            for (List<FormItem> li : allForms.values()) {
              for (FormItem it : li) {
                it.hide();
              }
            }
          }
        },
        new Runnable() {
          @Override
          public void run() {
            window.hide();
          }
        });

    final TextItem nameItem = new TextItem("nsName", "Name");
    DynamicForm nameForm = new DynamicForm();
    nameForm.setFields(nameItem);

    HLayout buttons = new HLayout();

    buttons.setWidth100();
    buttons.setHeight(22);
    buttons.setMargin(5);
    buttons.setAlign(Alignment.RIGHT);
    buttons.setMembersMargin(5);

    final IButton okButton = new IButton("Ok");
    okButton.setIcon(Images.instance.ok_16().getSafeUri().asString());
    okButton.setShowDisabledIcon(false);
    final IButton cancelButton = new IButton("Cancel");
    cancelButton.setIcon(Images.instance.cancel_16().getSafeUri().asString());
    cancelButton.setShowDisabledIcon(false);

    okButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            infraForm.setValue("infra", infraSelect.getValueAsString());
            infraForm.setValue("nsName", nameItem.getValueAsString());
            infraForm.setValue("policy", policySelect.getValueAsString());
            infraForm.setValue("sessionId", LoginModel.getInstance().getSessionId());
            infraForm.setCanSubmit(true);

            /* this smartGWT form looks nice but cannot do callbacks ;
             * we register a native JS function to the document, send it to
             * the servlet so that it writes it back when returning
             * when the browser reads the return value and interprets it as JS,
             * the callback is called */
            infraForm.setValue(
                "nsCallback",
                JSUtil.register(
                    new JSUtil.JSCallback() {
                      public void execute(JavaScriptObject obj) {
                        JSONObject js = new JSONObject(obj);
                        if (js.containsKey("result")
                            && js.get("result").isBoolean().booleanValue()) {
                          window.hide();
                          LogModel.getInstance()
                              .logMessage(
                                  "Successfully created nodesource: "
                                      + nameItem.getValueAsString());
                        } else {
                          String msg;
                          if (js.get("errorMessage").isString() != null) {
                            msg = js.get("errorMessage").isString().stringValue();
                          } else {
                            msg = js.toString();
                          }
                          label.setContents(
                              "<span style='color:red'>Failed to create Node Source :<br>"
                                  + msg
                                  + "</span>");
                          LogModel.getInstance()
                              .logImportantMessage(
                                  "Failed to create nodesource "
                                      + nameItem.getValueAsString()
                                      + ": "
                                      + msg);
                          layout.scrollToTop();
                        }
                        infraLabel.hide();
                        infraForm.show();
                        okButton.setDisabled(false);
                        cancelButton.setDisabled(false);
                      }
                    }));
            infraForm.submitForm();

            cancelButton.setDisabled(true);
            okButton.setDisabled(true);

            infraLabel.setContents("Node Source creation requested...");
            infraLabel.show();
            infraForm.hide();
          }
        });
    cancelButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            window.hide();
          }
        });
    buttons.setMembers(okButton, cancelButton);

    VLayout scroll = new VLayout();
    scroll.setHeight100();
    scroll.setWidth100();
    scroll.setMembers(infraLayout);
    scroll.setOverflow(Overflow.AUTO);
    scroll.setBorder("1px solid #ddd");
    scroll.setBackgroundColor("#fafafa");

    layout.addMember(label);
    layout.addMember(nameForm);
    layout.addMember(scroll);
    layout.addMember(buttons);

    int winWidth = com.google.gwt.user.client.Window.getClientWidth() * 80 / 100;
    int winHeight = com.google.gwt.user.client.Window.getClientHeight() * 80 / 100;
    winWidth = Math.min(1000, winWidth);
    winHeight = Math.min(1000, winHeight);

    this.window = new Window();
    this.window.setTitle("Create Node Source");
    this.window.setShowMinimizeButton(false);
    this.window.setIsModal(true);
    this.window.setShowModalMask(true);
    this.window.addItem(layout);
    this.window.setWidth(winWidth);
    this.window.setHeight(winHeight);
    this.window.setCanDragResize(true);
    this.window.setCanDragReposition(true);
    this.window.centerInPage();
  }
  public DlgOrgInfoViewByPhone(String phone) {
    super();
    setWidth(600);
    setHeight(700);
    setTitle("ორგანიზაციები ნომრის მიხედვით");
    setShowMinimizeButton(false);
    setIsModal(true);
    setShowModalMask(true);
    setCanDrag(false);
    setCanDragReposition(false);
    setCanDragResize(false);
    setCanDragScroll(false);
    centerInPage();

    VLayout hLayout = new VLayout(5);
    hLayout.setWidth100();
    hLayout.setHeight100();

    DataSource dataSource = DataSource.get("OrgInfoByPhoneDS");
    dataSource.getField("org_name").setTitle("ორგანიზაციის დასახელება");
    dataSource.getField("note").setTitle("შენიშვნა");
    dataSource.getField("workinghours").setTitle("სამუშაო საათები");
    dataSource.getField("director").setTitle("დირექტორი");
    dataSource.getField("identcode").setTitle("საიდ. კოდი");
    dataSource.getField("founded").setTitle("დაარსდა");
    dataSource.getField("legaladdress").setTitle("მისამართი");
    dataSource.getField("mail").setTitle("ელ. ფოსტა");
    dataSource.getField("webaddress").setTitle("ვებ გვერდი");
    dataSource.getField("org_info").setTitle("ორგ. ინფორმაცია");
    dataSource.getField("contactperson").setTitle("საკონტაქტო პიროვნება");
    dataSource.getField("dayoffs").setTitle("დასვენების დღეები");
    dataSource.getField("legal_statuse").setTitle("სტატუსი");
    dataSource.getField("partnerbank").setTitle("პარტნიორი ბანკი");
    dataSource.getField("workpersoncountity").setTitle("თანამშრომლების რაოდენობა");
    dataSource.getField("upd_user").setTitle("ვინ განაახლა");
    dataSource.getField("upd_date").setTitle("როდის განახლდა");
    dataSource.getField("ind").setTitle("ინდექსი");
    dataSource.getField("org_name_eng").setTitle("ორგ. დასახელება(ინგლისურად)");
    dataSource.getField("new_identcode").setTitle("ახალი კოდი");

    ListGridField org_name = new ListGridField("org_name", "ორგანიზაციის დასახელება", 250);
    ListGridField director = new ListGridField("director", "დირექტორი", 150);
    ListGridField identcode = new ListGridField("identcode", "საიდ. კოდი", 120);

    final ListGrid orgGrid = new ListGrid();
    orgGrid.setWidth100();
    orgGrid.setHeight(100);
    orgGrid.setAlternateRecordStyles(true);
    orgGrid.setShowFilterEditor(false);
    orgGrid.setCanEdit(false);
    orgGrid.setCanRemoveRecords(false);
    orgGrid.setShowRowNumbers(true);
    orgGrid.setCanHover(true);
    orgGrid.setShowHover(true);
    orgGrid.setShowHoverComponents(true);

    orgGrid.setAutoFetchData(true);
    Criteria criteria = new Criteria();
    criteria.setAttribute("phone", phone);
    orgGrid.setCriteria(criteria);
    orgGrid.setDataSource(dataSource);
    orgGrid.setFetchOperation("getOrgInfoByPhoneForAbonent");
    orgGrid.setFields(org_name, director, identcode);

    final DetailViewer detailViewer = new DetailViewer();
    detailViewer.setCanSelectText(true);
    detailViewer.setHeight(520);
    detailViewer.setWidth100();
    detailViewer.setDataSource(dataSource);

    orgGrid.addRecordClickHandler(
        new RecordClickHandler() {
          public void onRecordClick(RecordClickEvent event) {
            detailViewer.viewSelectedData(orgGrid);
          }
        });

    HLayout hLayoutItem = new HLayout(5);
    hLayoutItem.setWidth100();
    hLayoutItem.setAlign(Alignment.RIGHT);
    hLayoutItem.setMargin(10);

    IButton cancItem = new IButton();
    cancItem.setTitle("დახურვა");
    cancItem.setWidth(100);

    hLayoutItem.setMembers(cancItem);
    hLayout.setMembers(orgGrid, detailViewer, hLayoutItem);
    addItem(hLayout);

    cancItem.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            destroy();
          }
        });
  }
Exemplo n.º 21
0
  private void buildInstallInfoCanvas(AgentInstallInfo info) {
    DynamicForm infoForm = new DynamicForm();
    infoForm.setMargin(20);
    infoForm.setWidth100();
    infoForm.setHeight100();

    HeaderItem infoHeader = new HeaderItem();
    infoHeader.setValue(MSG.view_remoteAgentInstall_installInfo());

    StaticTextItem version = new StaticTextItem("version", MSG.common_title_version());
    version.setValue(info.getVersion());

    StaticTextItem path = new StaticTextItem("path", MSG.common_title_path());
    path.setValue(info.getPath());

    StaticTextItem owner = new StaticTextItem("owner", MSG.common_title_owner());
    owner.setValue(info.getOwner());

    StaticTextItem config = new StaticTextItem("config", MSG.common_title_configuration());
    config.setValue(info.getConfigurationStartString());

    CanvasItem listCanvas = new CanvasItem();
    listCanvas.setShowTitle(false);
    listCanvas.setColSpan(2);

    VLayout listLayout = new VLayout(0);
    listLayout.setWidth100();
    listLayout.setHeight100();

    ListGrid listGrid =
        new ListGrid() {
          @Override
          protected Canvas getExpansionComponent(ListGridRecord record) {
            Canvas canvas = super.getExpansionComponent(record);
            canvas.setPadding(5);
            return canvas;
          }
        };
    listGrid.setWidth100();
    listGrid.setHeight100();
    listGrid.setCanExpandRecords(true);
    listGrid.setExpansionMode(ExpansionMode.DETAIL_FIELD);
    listGrid.setDetailField("result");
    ListGridField step = new ListGridField("description", MSG.view_remoteAgentInstall_step());
    ListGridField result = new ListGridField("result", MSG.view_remoteAgentInstall_result());
    ListGridField resultCode =
        new ListGridField("resultCode", MSG.view_remoteAgentInstall_resultCode(), 90);
    ListGridField duration = new ListGridField("duration", MSG.common_title_duration(), 90);
    listGrid.setFields(step, result, resultCode, duration);
    listGrid.setData(getStepRecords(info));

    listLayout.addMember(listGrid);
    listCanvas.setCanvas(listLayout);

    // Replace the current info with just the install steps
    for (Canvas canvas : this.getChildren()) {
      canvas.markForDestroy();
    }

    createAgentStatusTextItem();
    infoForm.setFields(infoHeader, version, path, owner, config, agentStatusText, listCanvas);

    addMember(infoForm);

    this.setMembersMargin(1);
    this.markForRedraw();
  }
Exemplo n.º 22
0
  public TabBillingComps() {
    try {

      setTitle(CallCenterBK.constants.billingComps());
      setCanClose(true);

      billingCompsDS = DataSource.get("BillingCompsDS");

      mainLayout = new VLayout(5);
      mainLayout.setWidth100();
      mainLayout.setHeight100();
      mainLayout.setMargin(5);

      searchForm = new DynamicForm();
      searchForm.setAutoFocus(true);
      searchForm.setWidth(830);
      searchForm.setTitleWidth(250);
      searchForm.setNumCols(4);
      mainLayout.addMember(searchForm);

      billingCompNameItem = new TextItem();
      billingCompNameItem.setTitle(CallCenterBK.constants.companyName());
      billingCompNameItem.setWidth(250);
      billingCompNameItem.setName("billingCompNameItem");

      phoneIndexItem = new TextItem();
      phoneIndexItem.setTitle(CallCenterBK.constants.index());
      phoneIndexItem.setWidth(250);
      phoneIndexItem.setName("phoneIndexItem");

      hasCalcItem = new SelectItem();
      hasCalcItem.setTitle(CallCenterBK.constants.hasCalculation());
      hasCalcItem.setWidth(250);
      hasCalcItem.setName("hasCalcItem");
      hasCalcItem.setDefaultToFirstOption(true);
      hasCalcItem.setValueMap(ClientMapUtil.getInstance().getHasCalculations());

      operatorItem = new SelectItem();
      operatorItem.setTitle(CallCenterBK.constants.operator());
      operatorItem.setWidth(200);
      operatorItem.setName("operator_src");
      operatorItem.setDefaultToFirstOption(true);
      ClientUtils.fillCombo(
          operatorItem, "OperatorsDS", "searchOperators", "operator_src", "operator_src_descr");

      searchForm.setFields(billingCompNameItem, phoneIndexItem, hasCalcItem, operatorItem);

      HLayout buttonLayout = new HLayout(5);
      buttonLayout.setWidth(830);
      buttonLayout.setHeight(30);
      buttonLayout.setAlign(Alignment.RIGHT);

      clearButton = new IButton();
      clearButton.setTitle(CallCenterBK.constants.clear());

      findButton = new IButton();
      findButton.setTitle(CallCenterBK.constants.find());

      buttonLayout.setMembers(findButton, clearButton);
      mainLayout.addMember(buttonLayout);

      ToolStrip toolStrip = new ToolStrip();
      toolStrip.setWidth100();
      toolStrip.setPadding(5);
      mainLayout.addMember(toolStrip);

      addBtn = new ToolStripButton(CallCenterBK.constants.add(), "addIcon.png");
      addBtn.setLayoutAlign(Alignment.LEFT);
      addBtn.setWidth(50);
      toolStrip.addButton(addBtn);

      editBtn = new ToolStripButton(CallCenterBK.constants.modify(), "editIcon.png");
      editBtn.setLayoutAlign(Alignment.LEFT);
      editBtn.setWidth(50);
      toolStrip.addButton(editBtn);

      deleteBtn = new ToolStripButton(CallCenterBK.constants.disable(), "deleteIcon.png");
      deleteBtn.setLayoutAlign(Alignment.LEFT);
      deleteBtn.setWidth(50);
      toolStrip.addButton(deleteBtn);

      toolStrip.addSeparator();

      billingCompBillByDayBtn =
          new ToolStripButton(CallCenterBK.constants.telCombBillByDay(), "billing.png");
      billingCompBillByDayBtn.setLayoutAlign(Alignment.LEFT);
      billingCompBillByDayBtn.setWidth(50);
      toolStrip.addButton(billingCompBillByDayBtn);

      billingCompBillByMonthBtn =
          new ToolStripButton(CallCenterBK.constants.telCombBillByMonth(), "billing.png");
      billingCompBillByMonthBtn.setLayoutAlign(Alignment.LEFT);
      billingCompBillByMonthBtn.setWidth(50);
      toolStrip.addButton(billingCompBillByMonthBtn);

      billingCompsGrid = new ListGrid();

      billingCompsGrid.setWidth100();
      billingCompsGrid.setHeight100();
      billingCompsGrid.setAlternateRecordStyles(true);
      billingCompsGrid.setDataSource(billingCompsDS);
      billingCompsGrid.setAutoFetchData(false);
      billingCompsGrid.setShowFilterEditor(false);
      billingCompsGrid.setCanEdit(false);
      billingCompsGrid.setCanRemoveRecords(false);
      billingCompsGrid.setFetchOperation("searchAllBillingComps");
      billingCompsGrid.setShowRowNumbers(true);
      billingCompsGrid.setCanHover(true);
      billingCompsGrid.setShowHover(true);
      billingCompsGrid.setShowHoverComponents(true);
      billingCompsGrid.setWrapCells(true);
      billingCompsGrid.setFixedRecordHeights(false);
      billingCompsGrid.setCanDragSelectText(true);

      ListGridField billing_company_name =
          new ListGridField("billing_company_name", CallCenterBK.constants.companyName());

      ListGridField our_percent =
          new ListGridField("our_percent", CallCenterBK.constants.ourPercent(), 150);

      ListGridField has_calculation_descr =
          new ListGridField("has_calculation_descr", CallCenterBK.constants.hasCalculation(), 150);

      ListGridField call_price =
          new ListGridField("call_price", CallCenterBK.constants.callPrice(), 150);

      our_percent.setAlign(Alignment.CENTER);
      has_calculation_descr.setAlign(Alignment.CENTER);
      call_price.setAlign(Alignment.CENTER);

      billingCompsGrid.setFields(
          billing_company_name, our_percent, has_calculation_descr, call_price);

      mainLayout.addMember(billingCompsGrid);
      findButton.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              search();
            }
          });

      billingCompNameItem.addKeyPressHandler(
          new KeyPressHandler() {
            @Override
            public void onKeyPress(KeyPressEvent event) {
              if (event.getKeyName().equals("Enter")) {
                search();
              }
            }
          });

      phoneIndexItem.addKeyPressHandler(
          new KeyPressHandler() {
            @Override
            public void onKeyPress(KeyPressEvent event) {
              if (event.getKeyName().equals("Enter")) {
                search();
              }
            }
          });

      clearButton.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              billingCompNameItem.clearValue();
            }
          });

      addBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              DlgAddEditBillingComps dlgAddEditBillingComp =
                  new DlgAddEditBillingComps(billingCompsGrid, null);
              dlgAddEditBillingComp.show();
            }
          });

      editBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord();

              if (listGridRecord == null) {
                SC.say(CallCenterBK.constants.pleaseSelrecord());
                return;
              }

              DlgAddEditBillingComps dlgAddEditBillingComp =
                  new DlgAddEditBillingComps(billingCompsGrid, listGridRecord);
              dlgAddEditBillingComp.show();
            }
          });
      deleteBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              final ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenterBK.constants.pleaseSelrecord());
                return;
              }
              SC.ask(
                  CallCenterBK.constants.askForDisable(),
                  new BooleanCallback() {
                    @Override
                    public void execute(Boolean value) {
                      if (value) {
                        delete(listGridRecord);
                      }
                    }
                  });
            }
          });

      billingCompsGrid.addRecordDoubleClickHandler(
          new RecordDoubleClickHandler() {
            @Override
            public void onRecordDoubleClick(RecordDoubleClickEvent event) {
              ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord();
              DlgAddEditBillingComps dlgAddEditBillingComp =
                  new DlgAddEditBillingComps(billingCompsGrid, listGridRecord);
              dlgAddEditBillingComp.show();
            }
          });

      billingCompBillByDayBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {

              final ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenterBK.constants.pleaseSelrecord());
                return;
              }
              Integer billing_company_id = listGridRecord.getAttributeAsInt("billing_company_id");
              getBillingCompBillByDay(billing_company_id);
            }
          });
      billingCompBillByMonthBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {

              final ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenterBK.constants.pleaseSelrecord());
                return;
              }
              Integer billing_company_id = listGridRecord.getAttributeAsInt("billing_company_id");
              getBillingCompBillByMonth(billing_company_id);
            }
          });

      setPane(mainLayout);
    } catch (Exception e) {
      SC.say(e.toString());
    }
  }
Exemplo n.º 23
0
  public PCAPanel(DatasetInformation datasetInfo) {
    this.setWidth("400px");
    this.setHeight("150px");
    this.setTitle("Principal component analysis");
    this.setShowMinimizeButton(false);
    this.setIsModal(false);
    this.centerInPage();
    this.addCloseClickHandler(
        new CloseClickHandler() {
          @Override
          public void onCloseClick(CloseClickEvent event) {
            hide();
            destroy();
          }
        });

    VLayout vp = new VLayout();
    vp.setWidth100();
    vp.setHeight100();
    this.addItem(vp);

    HLayout hp1 = new HLayout();
    hp1.setWidth100();
    hp1.setHeight("20px");
    Label l1 = new Label("X AXES ");
    l1.setHeight("20px");
    l1.setWidth("100px");
    pcaI = new ListBox();
    pcaI.setWidth("200px");
    pcaI.setHeight("20px");
    pcaI.setTitle("X AXES");

    hp1.addMember(l1);
    hp1.addMember(pcaI);
    hp1.setMargin(5);

    vp.addMember(hp1);
    hp1.setAlign(Alignment.LEFT);

    HLayout hp2 = new HLayout();
    hp2.setWidth100();
    hp2.setHeight("20px");
    Label l2 = new Label("Y AXES ");
    l2.setHeight("20px");
    l2.setWidth("100px");

    pcaII = new ListBox();
    pcaII.setWidth("200px");
    pcaII.setHeight("20px");
    pcaII.setTitle("Y AXES");

    hp2.addMember(l2);
    hp2.addMember(pcaII);
    hp2.setMargin(5);

    vp.addMember(hp2);
    hp2.setAlign(Alignment.LEFT);

    if (datasetInfo != null) {
      for (String str : datasetInfo.getColsNames()) {
        pcaI.addItem(str);
        pcaII.addItem(str);
      }
      pcaI.setSelectedIndex(0);
      pcaII.setSelectedIndex(1);
    }
    okBtn = new IButton("Start Process");
    okBtn.setWidth("200px");
    okBtn.setAlign(Alignment.CENTER);
    okBtn.setShowRollOver(true);
    okBtn.setShowDown(true);
    okBtn.setTitleStyle("stretchTitle");

    HLayout btnLayout = new HLayout();
    btnLayout.setWidth100();
    btnLayout.setHeight("20px");
    btnLayout.addMember(okBtn);
    btnLayout.setAlign(Alignment.CENTER);

    vp.addMember(btnLayout);
    vp.setTop(20);
    vp.setMembersMargin(15);

    this.show();
  }
  /** Instantiates a new digital object menu view. */
  @Inject
  public DigitalObjectMenuView(final LangConstants lang, final EventBus eventBus) {
    this.lang = lang;
    this.eventBus = eventBus;

    layout = new VLayout();

    layout.setHeight100();
    layout.setWidth100();
    layout.setOverflow(Overflow.AUTO);

    relatedGrid = new ListGrid();
    relatedGrid.setWidth100();
    relatedGrid.setHeight100();
    relatedGrid.setShowSortArrow(SortArrow.CORNER);
    relatedGrid.setShowAllRecords(true);
    relatedGrid.setAutoFetchData(false);
    relatedGrid.setCanHover(true);
    relatedGrid.setCanSort(false);
    ListGridField field1 = new ListGridField("relation", lang.relation());
    field1.setWidth("40%");
    ListGridField field2 = new ListGridField("uuid", "PID");
    field2.setWidth("*");
    relatedGrid.setFields(field1, field2);
    sectionRelated = new SectionStackSection();
    sectionRelated.setID(SECTION_RELATED_ID);
    sectionRelated.setTitle(lang.referencedBy());
    sectionRelated.setResizeable(true);
    sectionRelated.setItems(relatedGrid);
    sectionRelated.setExpanded(false);

    sideNavGrid =
        new ListGrid() {

          @Override
          protected Canvas getRollOverCanvas(Integer rowNum, Integer colNum) {
            final ListGridRecord rollOverRecord = this.getRecord(rowNum);
            if (rollOverCanvas == null) {
              rollOverCanvas = new HLayout();
              rollOverCanvas.setSnapTo("TR");
              rollOverCanvas.setWidth(50);
              rollOverCanvas.setHeight(22);
            }

            if (rollOverCanvas.getChildren().length > 0) {
              rollOverCanvas.removeChild(rollOverCanvas.getChildren()[0]);
            }
            final String lockOwner = rollOverRecord.getAttributeAsString(Constants.ATTR_LOCK_OWNER);
            if (lockOwner != null) {
              ImgButton lockImg = new ImgButton();
              lockImg.setShowDown(false);
              lockImg.setShowRollOver(false);
              lockImg.setLayoutAlign(Alignment.CENTER);

              if ("".equals(lockOwner)) {
                lockImg.setSrc("icons/16/lock_lock_all.png");
              } else if (lockOwner.length() > 0) {
                lockImg.setSrc("icons/16/lock_lock_all_red.png");
              }

              lockImg.setPrompt(lang.lockInfoButton());
              lockImg.setHeight(16);
              lockImg.setWidth(16);
              lockImg.addClickHandler(
                  new com.smartgwt.client.widgets.events.ClickHandler() {

                    @Override
                    public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
                      EditorSC.objectIsLock(
                          lang,
                          new LockInfo(
                              lockOwner,
                              rollOverRecord.getAttributeAsString(Constants.ATTR_LOCK_DESCRIPTION),
                              rollOverRecord.getAttributeAsStringArray(
                                  Constants.ATTR_TIME_TO_EXP_LOCK)));
                    }
                  });
              rollOverCanvas.addChild(lockImg);
            }
            return rollOverCanvas;
          }
        };
    sideNavGrid.setShowSelectionCanvas(false);

    sideNavGrid.setWidth100();
    sideNavGrid.setHeight100();
    sideNavGrid.setShowSortArrow(SortArrow.CORNER);
    sideNavGrid.setShowAllRecords(true);
    sideNavGrid.setAutoFetchData(true);
    sideNavGrid.setCanHover(true);
    sideNavGrid.setHoverOpacity(75);
    sideNavGrid.setHoverStyle("interactImageHover");
    sideNavGrid.setShowRollOverCanvas(true);

    final DynamicForm form = new DynamicForm();
    form.setHeight(1);
    form.setWidth(60);
    form.setNumCols(1);

    selectItem.setWidth(60);
    selectItem.setShowTitle(false);
    selectItem.setValueMap(lang.me(), lang.all());
    selectItem.setDefaultValue(lang.me());
    selectItem.setHoverOpacity(75);
    selectItem.setHoverStyle("interactImageHover");
    selectItem.addItemHoverHandler(
        new ItemHoverHandler() {

          @Override
          public void onItemHover(ItemHoverEvent event) {
            selectItem.setPrompt(
                DigitalObjectMenuView.this.lang.showModifiedHint() + selectItem.getValue());
          }
        });
    selectItem.addChangedHandler(
        new ChangedHandler() {

          @Override
          public void onChanged(ChangedEvent event) {
            getUiHandlers().refreshRecentlyModified();
          }
        });

    form.setFields(selectItem);
    form.setTitle("by:");

    sectionRecentlyModified = new SectionStackSection();
    sectionRecentlyModified.setTitle(lang.recentlyModified());
    sectionRecentlyModified.setResizeable(true);
    sectionRecentlyModified.setItems(sideNavGrid);
    sectionRecentlyModified.setControls(form);
    sectionRecentlyModified.setExpanded(true);

    sectionStack = new SectionStack();
    sectionStack.addSection(sectionRelated);
    sectionStack.addSection(sectionRecentlyModified);
    sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
    sectionStack.setAnimateSections(true);
    sectionStack.setWidth100();
    sectionStack.setHeight100();
    sectionStack.setOverflow(Overflow.HIDDEN);
    layout.addMember(sectionStack);
  }
  protected void initItem(int width, int height) {
    String legacyHtml = "";
    if (toolBar != null) {
      toolBar.removeFromParent();
    }
    if (textArea != null) {
      legacyHtml = textArea.getHTML();
      textArea.removeFromParent();
    }
    if (mainLayout != null) {
      removeItem(mainLayout);
      mainLayout.destroy();
    }
    textArea = new RichTextArea();
    toolBar = new RichTextToolbar(textArea, DisplayType.DETAILED);

    saveButton = new IButton(BLCMain.getMessageManager().getString("ok"));
    IButton cancelButton = new IButton(BLCMain.getMessageManager().getString("cancel"));
    cancelButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            hide();
          }
        });

    final HtmlEditingPresenter pp = HtmlEditingPresenter.getInstance();

    final HLayout buttonsLayout = new HLayout(10);
    buttonsLayout.setAlign(Alignment.CENTER);
    buttonsLayout.addMember(saveButton);
    buttonsLayout.addMember(cancelButton);
    buttonsLayout.setLayoutTopMargin(2);
    buttonsLayout.setLayoutBottomMargin(2);
    buttonsLayout.setWidth100();
    buttonsLayout.setHeight(25);

    mainLayout = new VLayout();
    mainLayout.setWidth100();
    mainLayout.setHeight100();

    toolBar.setHeight("60px");
    final VLayout toolbarLayout = new VLayout();
    toolbarLayout.setWidth100();
    toolbarLayout.setHeight(60);
    toolbarLayout.addMember(toolBar);

    int textHeight = height - 130;
    textArea.setHeight(textHeight + "px");
    textArea.setWidth(width + "px");
    final VLayout textAreaLayout = new VLayout();
    textAreaLayout.setWidth100();
    textAreaLayout.setHeight(textHeight);
    textAreaLayout.addMember(textArea);

    mainLayout.addMember(toolbarLayout);
    mainLayout.addMember(textAreaLayout);
    mainLayout.addMember(buttonsLayout);
    addItem(mainLayout);

    toolBar.addAssetHandler(
        new Command() {
          @Override
          public void execute() {
            pp.displayAssetSearchDialog(toolBar);
          }
        });

    textArea.setHTML(legacyHtml);

    saveButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            if (richTextItem != null) {
              richTextItem.setValue(toolBar.getHTML());
              richTextItem.getForm().fireEvent(new ItemChangedEvent(richTextItem.getJsObj()));
            }
            hide();
          }
        });
  }
Exemplo n.º 26
0
  public DlgAddEditTown(ListGrid cityGrid, ListGridRecord cityRecord) {
    super();
    this.lCityRecord = cityRecord;
    this.cityGrid = cityGrid;

    setTitle(cityRecord == null ? "ახალი ქალაქის დამატება" : "ქალაქის მოდიფიცირება");

    setHeight(310);
    setWidth(520);
    setShowMinimizeButton(false);
    setIsModal(true);
    setShowModalMask(true);
    setCanDrag(false);
    setCanDragReposition(false);
    setCanDragResize(false);
    setCanDragScroll(false);
    centerInPage();

    hLayout = new VLayout(5);
    hLayout.setWidth100();
    hLayout.setHeight100();
    hLayout.setPadding(10);

    dynamicForm = new DynamicForm();
    dynamicForm.setAutoFocus(true);
    dynamicForm.setWidth100();
    dynamicForm.setTitleWidth(200);
    dynamicForm.setNumCols(2);
    hLayout.addMember(dynamicForm);

    cityNameGeoItem = new TextItem();
    cityNameGeoItem.setTitle("დასახელება");
    cityNameGeoItem.setWidth(300);
    cityNameGeoItem.setName("town_name");

    cityCodeItem = new TextItem();
    cityCodeItem.setTitle("ქალაქის კოდი");
    cityCodeItem.setWidth(300);
    cityCodeItem.setName("town_code");

    cityNewCodeItem = new TextItem();
    cityNewCodeItem.setTitle("ქალაქის კოდი (ახალი)");
    cityNewCodeItem.setWidth(300);
    cityNewCodeItem.setName("town_new_code");

    ofGmtItem = new TextItem();
    ofGmtItem.setTitle("დრო");
    ofGmtItem.setWidth(300);
    ofGmtItem.setName("normal_gmt");

    ofGmtWinterItem = new TextItem();
    ofGmtWinterItem.setTitle("ზამთრის დრო");
    ofGmtWinterItem.setWidth(300);
    ofGmtWinterItem.setName("winter_gmt");

    countryItem = new ComboBoxItem();
    countryItem.setWidth(300);
    countryItem.setTitle("ქვეყანა");
    countryItem.setName("country_id");
    countryItem.setFetchMissingValues(true);
    countryItem.setFilterLocally(false);
    countryItem.setAddUnknownValues(false);

    townTypeItem = new ComboBoxItem();
    townTypeItem.setTitle("ქალაქის ტიპი");
    townTypeItem.setWidth(300);
    townTypeItem.setName("townTypeItem");
    townTypeItem.setFetchMissingValues(true);
    townTypeItem.setFilterLocally(false);
    townTypeItem.setAddUnknownValues(false);

    DataSource DescriptionsDS = DataSource.get("DescriptionsDS");
    townTypeItem.setOptionOperationId("searchDescriptionsOrderById");
    townTypeItem.setOptionDataSource(DescriptionsDS);
    townTypeItem.setValueField("description_id");
    townTypeItem.setDisplayField("description");

    Criteria criteria = new Criteria();
    criteria.setAttribute("description_type_id", "59000");
    townTypeItem.setOptionCriteria(criteria);
    townTypeItem.setAutoFetchData(false);

    townTypeItem.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            Criteria criteria = townTypeItem.getOptionCriteria();
            if (criteria != null) {
              String oldAttr = criteria.getAttribute("town_type_id");
              if (oldAttr != null) {
                Object nullO = null;
                criteria.setAttribute("town_type_id", nullO);
              }
            }
          }
        });

    countryItem.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            Criteria criteria = countryItem.getOptionCriteria();
            if (criteria != null) {
              String oldAttr = criteria.getAttribute("country_id");
              if (oldAttr != null) {
                Object nullO = null;
                criteria.setAttribute("country_id", nullO);
              }
            }
          }
        });

    isCapitalItem = new ComboBoxItem();
    isCapitalItem.setTitle("დედაქალაქი");
    isCapitalItem.setWidth(300);
    isCapitalItem.setName("capital_town");
    isCapitalItem.setValueMap(ClientMapUtil.getInstance().getIsCapital());

    dynamicForm.setFields(
        cityNameGeoItem,
        cityCodeItem,
        cityNewCodeItem,
        ofGmtItem,
        ofGmtWinterItem,
        countryItem,
        townTypeItem,
        isCapitalItem);

    HLayout hLayoutItem = new HLayout(5);
    hLayoutItem.setWidth100();
    hLayoutItem.setAlign(Alignment.RIGHT);

    IButton saveItem = new IButton();
    saveItem.setTitle("შენახვა");
    saveItem.setWidth(100);

    IButton cancItem = new IButton();
    cancItem.setTitle("დახურვა");
    cancItem.setWidth(100);

    hLayoutItem.setMembers(saveItem, cancItem);

    hLayout.addMember(hLayoutItem);

    cancItem.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            destroy();
          }
        });
    saveItem.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            saveCountry();
          }
        });

    addItem(hLayout);
    fillFields();
  }
Exemplo n.º 27
0
  public TabFindAbonent() {
    setTitle(CallCenter.constants.findAbonent());
    setCanClose(true);

    datasource = DataSource.get("AbonentsDS");

    mainLayout = new VLayout(5);
    mainLayout.setWidth100();
    mainLayout.setHeight100();
    mainLayout.setMargin(5);

    searchForm = new DynamicForm();
    searchForm.setAutoFocus(true);
    searchForm.setWidth(750);
    searchForm.setNumCols(3);
    searchForm.setTitleOrientation(TitleOrientation.TOP);
    mainLayout.addMember(searchForm);

    firstNameItem = new TextItem();
    firstNameItem.setTitle(CallCenter.constants.name());
    firstNameItem.setWidth(250);
    firstNameItem.setName("firstNameItem");

    lastNameItem = new TextItem();
    lastNameItem.setTitle(CallCenter.constants.lastName());
    lastNameItem.setWidth(250);
    lastNameItem.setName("lastNameItem");

    phoneItem = new TextItem();
    phoneItem.setTitle(CallCenter.constants.phone());
    phoneItem.setWidth(250);
    phoneItem.setName("phone");

    streetItem = new TextItem();
    streetItem.setTitle(CallCenter.constants.street());
    streetItem.setName("street_name_geo");
    streetItem.setWidth(250);

    citiesItem = new ComboBoxItem();
    citiesItem.setTitle(CallCenter.constants.city());
    citiesItem.setName("city_name_geo");
    citiesItem.setWidth(250);
    citiesItem.setFetchMissingValues(true);
    citiesItem.setFilterLocally(false);
    citiesItem.setAddUnknownValues(false);

    DataSource cityDS = DataSource.get("CityDS");
    citiesItem.setOptionOperationId("searchCitiesFromDBForCombos");
    citiesItem.setOptionDataSource(cityDS);
    citiesItem.setValueField("city_id");
    citiesItem.setDisplayField("city_name_geo");

    citiesItem.setOptionCriteria(new Criteria());
    citiesItem.setAutoFetchData(false);

    citiesItem.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            Criteria criteria = citiesItem.getOptionCriteria();
            if (criteria != null) {
              String oldAttr = criteria.getAttribute("city_id");
              if (oldAttr != null) {
                Object nullO = null;
                criteria.setAttribute("city_id", nullO);
              }
            }
          }
        });

    regionItem = new ComboBoxItem();
    regionItem.setTitle(CallCenter.constants.cityRegion());
    regionItem.setName("city_region_name_geo");
    regionItem.setWidth(250);
    regionItem.setFetchMissingValues(true);
    regionItem.setFilterLocally(false);
    regionItem.setAddUnknownValues(false);

    DataSource streetsDS = DataSource.get("CityRegionDS");
    regionItem.setOptionOperationId("searchCityRegsFromDBForCombos");
    regionItem.setOptionDataSource(streetsDS);
    regionItem.setValueField("city_region_id");
    regionItem.setDisplayField("city_region_name_geo");

    Criteria criteria = new Criterion();
    regionItem.setOptionCriteria(criteria);
    regionItem.setAutoFetchData(false);

    regionItem.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            Criteria criteria = regionItem.getOptionCriteria();
            if (criteria != null) {
              String oldAttr = criteria.getAttribute("city_region_id");
              if (oldAttr != null) {
                Object nullO = null;
                criteria.setAttribute("city_region_id", nullO);
              }
            }
          }
        });

    searchForm.setFields(
        lastNameItem, firstNameItem, phoneItem, streetItem, citiesItem, regionItem);

    HLayout buttonLayout = new HLayout(5);
    buttonLayout.setWidth(750);
    buttonLayout.setHeight(30);
    buttonLayout.setAlign(Alignment.RIGHT);

    clearButton = new IButton();
    clearButton.setTitle(CallCenter.constants.clear());

    findButton = new IButton();
    findButton.setTitle(CallCenter.constants.find());

    buttonLayout.setMembers(findButton, clearButton);
    mainLayout.addMember(buttonLayout);

    listGrid =
        new ListGrid() {
          protected String getCellCSSText(ListGridRecord record, int rowNum, int colNum) {
            ListGridRecord countryRecord = (ListGridRecord) record;
            if (countryRecord == null) {
              return super.getCellCSSText(record, rowNum, colNum);
            }
            Integer deleted = countryRecord.getAttributeAsInt("deleted");
            if (deleted != null && !deleted.equals(0)) {
              return "color:red;";
            } else {
              return super.getCellCSSText(record, rowNum, colNum);
            }
          };
        };

    listGrid.setWidth(1000);
    listGrid.setHeight100();
    listGrid.setAlternateRecordStyles(true);
    listGrid.setDataSource(datasource);
    listGrid.setAutoFetchData(false);
    listGrid.setShowFilterEditor(false);
    listGrid.setCanEdit(false);
    listGrid.setCanRemoveRecords(false);
    listGrid.setFetchOperation("customSearchForCC");
    listGrid.setCanSort(false);
    listGrid.setCanResizeFields(false);
    listGrid.setCanSelectText(true);
    listGrid.setCanDragSelectText(true);
    listGrid.setShowFilterEditor(true);
    listGrid.setFilterOnKeypress(true);

    ListGridField firstname = new ListGridField("firstname", CallCenter.constants.name(), 120);
    firstname.setCanFilter(true);

    ListGridField lastname = new ListGridField("lastname", CallCenter.constants.lastName(), 150);
    lastname.setCanFilter(true);

    ListGridField city = new ListGridField("city", CallCenter.constants.city(), 140);
    city.setCanFilter(false);

    ListGridField address = new ListGridField("address", CallCenter.constants.address());
    address.setCanFilter(true);

    ListGridField phone = new ListGridField("phone", CallCenter.constants.phone(), 100);
    phone.setCanFilter(true);

    firstname.setAlign(Alignment.LEFT);
    lastname.setAlign(Alignment.LEFT);
    city.setAlign(Alignment.LEFT);
    address.setAlign(Alignment.LEFT);
    phone.setAlign(Alignment.CENTER);

    listGrid.setFields(lastname, firstname, city, address, phone);
    mainLayout.addMember(listGrid);

    clearButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            firstNameItem.clearValue();
            lastNameItem.clearValue();
            phoneItem.clearValue();
            streetItem.clearValue();
            citiesItem.clearValue();
            regionItem.clearValue();
          }
        });

    findButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            search();
          }
        });

    citiesItem.addChangedHandler(
        new ChangedHandler() {
          @Override
          public void onChanged(ChangedEvent event) {
            String value = citiesItem.getValueAsString();
            if (value == null) {
              return;
            }
            regionItem.clearValue();
            fillCityRegionCombo(new Integer(value));
          }
        });

    firstNameItem.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            if (event.getKeyName().equals("Enter")) {
              search();
            }
          }
        });
    lastNameItem.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            if (event.getKeyName().equals("Enter")) {
              search();
            }
          }
        });
    phoneItem.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            if (event.getKeyName().equals("Enter")) {
              search();
            }
          }
        });
    streetItem.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            if (event.getKeyName().equals("Enter")) {
              search();
            }
          }
        });

    listGrid.addRecordDoubleClickHandler(
        new RecordDoubleClickHandler() {
          @Override
          public void onRecordDoubleClick(RecordDoubleClickEvent event) {
            DlgViewAbonent dlgViewAbonent =
                new DlgViewAbonent(listGrid, datasource, listGrid.getSelectedRecord());
            dlgViewAbonent.show();
          }
        });

    setPane(mainLayout);
  }