public LayerSettingsForm() {

    // 		setWidth100();
    setColWidths("125", "*");

    name = new TextItem();
    name.setTitle(MESSAGES.layerSettingsLayerName());
    name.setWidth(250);
    name.setRequired(true);

    publicLayer = new CheckboxItem();
    publicLayer.setTitle(MESSAGES.layerSettingsPublic());
    publicLayer.setTooltip(MESSAGES.layerSettingsPublicTooltip());

    active = new CheckboxItem();
    active.setTitle(MESSAGES.layerSettingsActive());
    active.setTooltip(MESSAGES.layerSettingsActiveTooltip());

    visible = new CheckboxItem();
    visible.setTitle(MESSAGES.layerSettingsVisibleByDefault());
    visible.setTooltip(MESSAGES.layerSettingsVisibleByDefaultTooltip());

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

    setFields(name, publicLayer, active, visible);
  }
  private Tab fullTextSearchTab(JcrExplorer jackrabbitExplorer) {
    Tab searchFullTextTab = new Tab();
    searchFullTextTab.setTitle("Full Text Search");
    final DynamicForm searchFullTextForm = new DynamicForm();
    searchFullTextForm.setID("searchFullTextForm");
    searchFullTextForm.setNumCols(3);
    searchFullTxt.setName("searchFullTxt");
    searchFullTxt.setTitle("Full Text Search");
    searchFullTxt.setWidth(250);
    searchFullTxt.setRequired(true);
    //		RegExpValidator regExpValidator = new RegExpValidator();
    //		regExpValidator.setExpression("^[\\w\\d\\_\\.]{1,}$");
    //		searchFullTxt.setValidateOnChange(true);
    //		searchFullTxt.setValidators(regExpValidator);
    SubmitItem searchFullTextSubmitItem = new SubmitItem("searchFullTextSubmitItem");
    searchFullTextSubmitItem.setTitle("Search");
    searchFullTextSubmitItem.setWidth(100);
    class SearchFullTextSubmitValuesHandler implements SubmitValuesHandler {
      private JcrExplorer jackrabbitExplorer;

      public SearchFullTextSubmitValuesHandler(JcrExplorer jackrabbitExplorer) {
        this.jackrabbitExplorer = jackrabbitExplorer;
      }

      public void onSubmitValues(com.smartgwt.client.widgets.form.events.SubmitValuesEvent event) {
        if (searchFullTextForm.validate()) {
          JcrExplorer.showLoadingImg();
          JcrExplorer.service.fullTextSearch(
              searchFullTxt.getValue().toString(), new SearchServiceCallback(jackrabbitExplorer));
        }
      }
    };
    searchFullTextForm.addSubmitValuesHandler(
        new SearchFullTextSubmitValuesHandler(jackrabbitExplorer));
    searchFullTextForm.setSaveOnEnter(true);
    searchFullTxt.setStartRow(true);
    searchFullTxt.setEndRow(false);
    searchFullTextSubmitItem.setStartRow(false);
    searchFullTextSubmitItem.setEndRow(true);
    searchFullTextForm.setItems(searchFullTxt, searchFullTextSubmitItem);
    searchFullTextTab.setPane(searchFullTextForm);
    return searchFullTextTab;
  }
Ejemplo n.º 3
0
  /** Prepares the repository form */
  private Tab setupRepository(final ValuesManager vm) {
    // Prepare the tab used to configure the repository where documents and
    // other data will be stored
    Tab repositoryTab = new Tab();
    repositoryTab.setTitle(I18N.message("repository"));

    final DynamicForm repositoryForm = new DynamicForm();
    repositoryForm.setID("repositoryForm");
    repositoryForm.setValuesManager(vm);
    TextItem repositoryItem = ItemFactory.newTextItem(REPOSITORY_FOLDER, "repofolder", null);
    repositoryItem.setWidth(200);
    repositoryItem.setRequired(true);
    repositoryItem.setWrapTitle(false);
    repositoryItem.setDefaultValue(getDefaultFolder());
    repositoryForm.setFields(repositoryItem);
    repositoryForm.setDisabled(true);

    repositoryTab.setPane(repositoryForm);
    return repositoryTab;
  }
Ejemplo n.º 4
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());
    }
  }
Ejemplo n.º 5
0
  /** Prepares the database tab */
  private Tab setupDatabase(final ValuesManager vm) {
    // Prepare the map with all database engines
    engines.put(
        MYSQL,
        new String[] {
          "MySQL 5.x",
          "com.mysql.jdbc.Driver",
          "jdbc:mysql://<server>[,<failoverhost>][<:3306>]/<database>",
          "org.hibernate.dialect.MySQLDialect",
          "SELECT 1"
        });
    engines.put(
        "PostgreSQL",
        new String[] {
          "PostgreSQL 9.x",
          "org.postgresql.Driver",
          "jdbc:postgresql:[<//server>[<:5432>/]]<database>",
          "org.hibernate.dialect.PostgreSQLDialect",
          "SELECT 1"
        });
    engines.put(
        ORACLE,
        new String[] {
          "Oracle 10g/11g",
          "oracle.jdbc.driver.OracleDriver",
          "jdbc:oracle:thin:@<server>[<:1521>]:<sid>",
          "org.hibernate.dialect.Oracle10gDialect",
          "SELECT 1 FROM DUAL"
        });
    engines.put(
        SQLSERVER,
        new String[] {
          "SQL Server 2005/2008",
          "net.sourceforge.jtds.jdbc.Driver",
          "jdbc:jtds:sqlserver://<server>[:<1433>]/<database>;instance=<instance>",
          "org.hibernate.dialect.SQLServerDialect",
          "SELECT 1"
        });

    Tab databaseTab = new Tab();
    databaseTab.setTitle(I18N.message("database"));

    final DynamicForm databaseForm = new DynamicForm();
    databaseForm.setWidth(450);
    databaseForm.setID("database");
    databaseForm.setValuesManager(vm);
    databaseForm.setDisabled(true);

    RadioGroupItem dbType = new RadioGroupItem();
    dbType.setName(DB_TYPE);
    dbType.setWrapTitle(false);
    dbType.setRequired(true);
    dbType.setVertical(false);
    dbType.setValueMap(I18N.message(INTERNAL), I18N.message("external"));
    dbType.setValue(I18N.message(INTERNAL));
    dbType.setRedrawOnChange(true);
    dbType.setTitle(I18N.message("dbtype"));

    // The database engine, if the External db was chosen
    SelectItem dbEngine = new SelectItem();
    dbEngine.setTitle(I18N.message("dbengine"));
    dbEngine.setWrapTitle(false);
    dbEngine.setVisible(false);
    dbEngine.setName(DB_ENGINE);
    dbEngine.setDefaultValue(MYSQL);
    LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
    for (String engine : engines.keySet()) {
      valueMap.put(engine, engines.get(engine)[0]);
    }
    dbEngine.setValueMap(valueMap);
    dbEngine.setShowIfCondition(
        new FormItemIfFunction() {
          public boolean execute(FormItem item, Object value, DynamicForm form) {
            return !I18N.message(INTERNAL).equals(databaseForm.getValue(DB_TYPE));
          }
        });
    RequiredIfValidator ifValidator = new RequiredIfValidator();
    ifValidator.setExpression(
        new RequiredIfFunction() {
          public boolean execute(FormItem formItem, Object value) {
            return !I18N.message(INTERNAL).equals(databaseForm.getValue(DB_TYPE));
          }
        });
    dbEngine.setValidators(ifValidator);
    dbEngine.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            String selectedItem = (String) event.getValue();
            databaseForm.getField(DB_DRIVER).setValue(engines.get(selectedItem)[1]);
            databaseForm.getField(DB_URL).setValue(engines.get(selectedItem)[2]);
          }
        });

    // The driver for the external DB
    TextItem dbDriver = ItemFactory.newTextItem(DB_DRIVER, "driverclass", null);
    dbDriver.setVisible(false);
    dbDriver.setDefaultValue(engines.get(MYSQL)[1]);
    dbDriver.setWrapTitle(false);
    dbDriver.setShowIfCondition(
        new FormItemIfFunction() {
          public boolean execute(FormItem item, Object value, DynamicForm form) {
            return !I18N.message(INTERNAL).equals(databaseForm.getValue(DB_TYPE));
          }
        });
    dbDriver.setValidators(ifValidator);

    // The connection URL to external DB
    TextItem dbUrl = ItemFactory.newTextItem(DB_URL, "connectionurl", null);
    dbUrl.setWidth(200);
    dbUrl.setVisible(false);
    dbUrl.setDefaultValue(engines.get(MYSQL)[2]);
    dbUrl.setWrapTitle(false);
    dbUrl.setShowIfCondition(
        new FormItemIfFunction() {
          public boolean execute(FormItem item, Object value, DynamicForm form) {
            return !I18N.message(INTERNAL).equals(databaseForm.getValue(DB_TYPE));
          }
        });
    dbUrl.setValidators(ifValidator);

    // The username to access the external DB
    TextItem dbUsername = ItemFactory.newTextItem(DB_USERNAME, "username", null);
    dbUsername.setVisible(false);
    dbUsername.setWrapTitle(false);
    dbUsername.setShowIfCondition(
        new FormItemIfFunction() {
          public boolean execute(FormItem item, Object value, DynamicForm form) {
            return !I18N.message(INTERNAL).equals(databaseForm.getValue(DB_TYPE));
          }
        });

    // The password to access the external DB
    PasswordItem dbPassword = new PasswordItem();
    dbPassword.setVisible(false);
    dbPassword.setTitle(I18N.message("password"));
    dbPassword.setName(DB_PASSWORD);
    dbPassword.setWrapTitle(false);
    dbPassword.setShowIfCondition(
        new FormItemIfFunction() {
          public boolean execute(FormItem item, Object value, DynamicForm form) {
            return !I18N.message(INTERNAL).equals(databaseForm.getValue(DB_TYPE));
          }
        });

    databaseForm.setFields(dbType, dbEngine, dbDriver, dbUrl, dbUsername, dbPassword);
    databaseTab.setPane(databaseForm);
    return databaseTab;
  }
Ejemplo n.º 6
0
  private HLayout createSearchLayout() {
    HLayout searchLayout = new HLayout();

    searchLayout.setWidth100();
    searchLayout.setHeight(20);
    searchLayout.setMembersMargin(15);

    i_searchForm = new DynamicForm();
    i_searchForm.setWidth(250);
    i_searchForm.setHeight100();
    i_searchForm.setAlign(Alignment.LEFT);
    i_searchForm.setAutoFocus(true);

    i_searchTextItem = new TextItem();
    i_searchTextItem.setTitle("Search");
    i_searchTextItem.setWidth(200);
    i_searchTextItem.setHint(SEARCH_HINT);
    i_searchTextItem.setShowHintInField(true);
    i_searchTextItem.setCanFocus(true);
    i_searchTextItem.setSelectOnFocus(true);

    i_searchTextItem.addKeyUpHandler(
        new KeyUpHandler() {

          @Override
          public void onKeyUp(KeyUpEvent event) {
            event.getKeyName();

            // ignore the arrow keys
            if (isValidSearchText()) {
              i_searchListGrid.getData(i_searchTextItem.getValueAsString());
              i_addButton.setDisabled(true);
            }
          }
        });

    i_searchForm.setFields(i_searchTextItem);

    // add button to a Vlayout so we can position it correctly with the form
    // search text.
    VLayout buttonVlayout = new VLayout();
    buttonVlayout.setWidth(40);
    buttonVlayout.setAlign(VerticalAlignment.CENTER);
    buttonVlayout.setMargin(2);

    i_clearButton = new IButton(CLEAR_BUTTON_TITLE);
    i_clearButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            i_searchTextItem.setValue("");
            i_rowsRetrievedLabel.setContents("");
            i_searchListGrid.clearData();
            i_addButton.setDisabled(true);
          }
        });
    buttonVlayout.addMember(i_clearButton);

    // add Label to a Vlayout so we can position it correctly with the form
    // search text.
    VLayout labelVlayout = new VLayout();
    labelVlayout.setWidth(100);
    labelVlayout.setAlign(VerticalAlignment.BOTTOM);
    labelVlayout.setMargin(2);

    i_rowsRetrievedLabel = new Label();
    i_rowsRetrievedLabel.setWrap(false);
    i_rowsRetrievedLabel.setWidth100();
    i_rowsRetrievedLabel.setHeight(23);

    labelVlayout.addMember(i_rowsRetrievedLabel);

    searchLayout.addMember(i_searchForm);
    searchLayout.addMember(buttonVlayout);
    searchLayout.addMember(labelVlayout);

    return searchLayout;
  }
Ejemplo n.º 7
0
  public ListaVentas(final Sgc_capa_web mainWindow) {

    String PATH_IMG = "/sgc_capa_web/images/";
    VLayout layout = new VLayout(10);
    layout.setBackgroundColor("#006633");
    final ListGrid facturaGrid = new ListGrid();

    facturaGrid.setWidth(500);
    facturaGrid.setHeight(224);
    facturaGrid.setShowAllRecords(true);
    facturaGrid.setAlternateRecordStyles(true);
    facturaGrid.setShowEdges(true);
    facturaGrid.setBorder("0px");
    facturaGrid.setBodyStyleName("normal");
    facturaGrid.setLeaveScrollbarGap(false);
    facturaGrid.setBackgroundColor("#99ffcc");

    /*-Buscar ------------------------------*/
    DynamicForm buscarFields = new DynamicForm();
    // buscarFields.setBackgroundColor("#99ffcc");
    buscarFields.setItemLayout(FormLayoutType.ABSOLUTE);

    final TextItem codigoText = new TextItem("codigo");
    codigoText.setWrapTitle(false);
    codigoText.setLeft(10);
    codigoText.setWidth(43);
    codigoText.addKeyPressHandler(
        new KeyPressHandler() {
          public void onKeyPress(KeyPressEvent event) {
            if ("Enter".equals(event.getKeyName())) {
              /* buscar por el campo correspondiente */
              if (codigoText.getValue() != null) {

                Factura factura = new Factura();
                factura.setId(Integer.parseInt(codigoText.getValue().toString()));
                listar(facturaGrid, factura, "codigo");
              }
            }
          }
        });

    ButtonItem buscarButton = new ButtonItem("find", "");
    buscarButton.setIcon("view.png");
    buscarButton.setWidth(50);
    buscarButton.setLeft(443);
    buscarButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            /* buscar por el campo correspondiente */
            Factura factura = new Factura();

            if (codigoText.getValue() != null)
              factura.setId(Integer.parseInt(codigoText.getValue().toString()));
            /*if(nombreusuarioText.getValue() != null)
            cliente.setNombreusuario(nombreusuarioText.getValue().toString());*/
            listar(facturaGrid, factura, "nombre");
          }
        });

    buscarFields.setFields(codigoText, buscarButton);
    /*--------------------------------------*/

    ListGridField codigoField = new ListGridField("codigo", "Codigo");
    ListGridField fechaField = new ListGridField("fecha", "Fecha");
    ListGridField numeroField = new ListGridField("numero", "Numero");
    ListGridField pendienteField = new ListGridField("pendiente", "Pendiente");
    ListGridField saldoField = new ListGridField("saldo", "Saldo");
    ListGridField editarField = new ListGridField("edit", "Editar");
    ListGridField borrarField = new ListGridField("remove", "Borrar");

    codigoField.setAlign(Alignment.CENTER);
    editarField.setAlign(Alignment.CENTER);
    borrarField.setAlign(Alignment.CENTER);

    editarField.setType(ListGridFieldType.IMAGE);
    borrarField.setType(ListGridFieldType.IMAGE);

    editarField.setImageURLPrefix(PATH_IMG);
    borrarField.setImageURLPrefix(PATH_IMG);

    editarField.setImageURLSuffix(".png");
    borrarField.setImageURLSuffix(".png");

    facturaGrid.addCellClickHandler(
        new CellClickHandler() {
          @Override
          public void onCellClick(CellClickEvent event) {
            ListGridRecord record = event.getRecord();
            int col = event.getColNum();
            if (col > 4) {

              Factura factura = new Factura();
              factura.setId(record.getAttributeAsInt("codigo"));
              factura.setFecha(record.getAttributeAsDate("fecha"));
              factura.setNumero(Integer.parseInt(record.getAttribute("numero")));
              factura.setPendiente(record.getAttribute("pendiente"));
              factura.setSaldo(Double.parseDouble(record.getAttribute("saldo")));

              if (col == 5) {
                /* Editar */

                new VentaDetalle(factura, mainWindow);

              } else {
                /* Borrar */

                FacturaServiceAsync service = GWT.create(FacturaService.class);
                ServiceDefTarget serviceDef = (ServiceDefTarget) service;
                serviceDef.setServiceEntryPoint(GWT.getModuleBaseURL() + "facturaService");
                try {
                  service.eliminar(
                      record.getAttributeAsInt("codigo"),
                      new AsyncCallback<Void>() {

                        @Override
                        public void onFailure(Throwable caught) {
                          Window.alert(
                              "Ocurrio un error y no se puedo eliminar (objeto referenciado)"); // "
                          // +
                          // caught.getClass().getName() + " " + caught.getMessage()) ;
                        }

                        @Override
                        public void onSuccess(Void result) {
                          new ListaVentas(mainWindow);
                        }
                      });
                } catch (NumberFormatException e) {
                  e.printStackTrace();
                } catch (Exception e) {
                  e.printStackTrace();
                }
              }
            }
          }
        });

    codigoField.setWidth(50);
    fechaField.setWidth(180);
    numeroField.setWidth(50);
    pendienteField.setWidth(50);
    saldoField.setWidth(50);
    facturaGrid.setFields(
        codigoField, fechaField, numeroField, pendienteField, saldoField, editarField, borrarField);
    facturaGrid.setCanResizeFields(true);

    ButtonItem button = new ButtonItem("add", "Agregar");
    button.setStartRow(false);
    button.setWidth(80);
    button.setIcon("add.png");
    button.setAlign(Alignment.CENTER);
    button.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            new VentaDetalle(mainWindow);
          }
        });

    listar(facturaGrid, new Factura(), "nombre");

    Label label = new Label();
    label.setBackgroundColor("#99ffcc");
    label.setHeight(30);
    label.setWidth(500);
    label.setPadding(10);
    label.setAlign(Alignment.CENTER);
    label.setValign(VerticalAlignment.CENTER);
    label.setWrap(false);
    label.setShowEdges(true);
    label.setContents("<div style='color:black;font-size:15'><b>Lista de Ventas</b></div>");

    layout.addMember(label);
    layout.addMember(buscarFields);
    layout.addMember(facturaGrid);

    DynamicForm form = new DynamicForm();
    // form.setBackgroundColor("#99ffcc");
    form.setWidth(300);
    form.setItems(button);
    layout.addMember(form);
    mainWindow.showDialog(layout);
  }
Ejemplo n.º 8
0
  private DynamicForm getConnectionForm() {
    connectionForm = new DynamicForm();
    connectionForm.setNumCols(4);
    connectionForm.setWrapItemTitles(false);
    connectionForm.setColWidths("130", "450", "110");
    connectionForm.setExtraSpace(15);
    connectionForm.setWidth(790);
    connectionForm.setPadding(5);
    connectionForm.setIsGroup(true);
    connectionForm.setGroupTitle(MSG.view_remoteAgentInstall_connInfo());
    final int textFieldWidth = 440;

    TextItem host = new TextItem("host", MSG.common_title_host());
    host.setRequired(true);
    host.setWidth(textFieldWidth);
    host.setPrompt(MSG.view_remoteAgentInstall_promptHost());
    host.setHoverWidth(300);
    host.setEndRow(true);
    host.addChangedHandler(
        new ChangedHandler() {
          @Override
          public void onChanged(ChangedEvent event) {
            hostAuthorized =
                false; // if the host changes, we need to make sure the user authorizes it if needed
          }
        });

    TextItem port = new TextItem("port", MSG.common_title_port());
    port.setRequired(false);
    port.setWidth(textFieldWidth);
    port.setPrompt(MSG.view_remoteAgentInstall_promptPort());
    port.setHoverWidth(300);
    port.setEndRow(true);
    IntegerRangeValidator portValidator = new IntegerRangeValidator();
    portValidator.setMin(1);
    portValidator.setMax(65535);
    port.setValidators(new IsIntegerValidator(), portValidator);

    TextItem username = new TextItem("username", MSG.common_title_user());
    username.setRequired(
        false); // if not specified, the server will attempt to use the default ssh user defined in
                // system settings
    username.setWidth(textFieldWidth);
    username.setPrompt(MSG.view_remoteAgentInstall_promptUser());
    username.setHoverWidth(300);
    username.setEndRow(true);

    PasswordItem password = new PasswordItem("password", MSG.common_title_password());
    password.setRequired(
        false); // if not specified, the server will attempt to use the default ssh pw defined in
                // system settings
    password.setWidth(textFieldWidth);
    password.setPrompt(MSG.view_remoteAgentInstall_promptPassword());
    password.setHoverWidth(300);
    password.setEndRow(true);
    password.setAttribute("autocomplete", "off");

    rememberMeCheckbox = new CheckboxItem("rememberme", MSG.view_remoteAgentInstall_rememberMe());
    rememberMeCheckbox.setRequired(false);
    rememberMeCheckbox.setPrompt(MSG.view_remoteAgentInstall_promptRememberMe());
    rememberMeCheckbox.setHoverWidth(300);
    rememberMeCheckbox.setColSpan(2);
    rememberMeCheckbox.setEndRow(true);

    agentInstallPath = new TextItem("agentInstallPath", MSG.view_remoteAgentInstall_installPath());
    agentInstallPath.setWidth(textFieldWidth);
    agentInstallPath.setPrompt(MSG.view_remoteAgentInstall_promptInstallPath());
    agentInstallPath.setHoverWidth(300);
    agentInstallPath.setStartRow(true);
    agentInstallPath.setEndRow(false);
    agentInstallPath.setValidators(
        absPathValidator); // we will "turn this on" when needed - this is to ensure we create paths
                           // properly and it doesn't go in places user isn't expecting

    findAgentInstallPathButton =
        new ButtonItem("findAgentInstallPathButton", MSG.view_remoteAgentInstall_buttonFindAgent());
    findAgentInstallPathButton.setStartRow(false);
    findAgentInstallPathButton.setEndRow(true);
    if (findAgentInstallPathButton.getTitle().length() < 15) { // i18n may prolong the title
      findAgentInstallPathButton.setWidth(100);
    }
    findAgentInstallPathButton.addClickHandler(
        new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
          public void onClick(
              com.smartgwt.client.widgets.form.fields.events.ClickEvent clickEvent) {
            // we only want to validate host
            if (connectionForm.getValueAsString("host") == null
                || connectionForm.getValueAsString("host").trim().isEmpty()) {
              final HashMap<String, String> errors = new HashMap<String, String>(1);
              errors.put("host", CoreGUI.getSmartGwtMessages().validator_requiredField());
              connectionForm.setErrors(errors, true);
              return;
            }

            new CheckSSHConnectionCallback() {
              @Override
              protected void doActualWork() {
                findAgentInstallPath();
              }
            }.execute();
          }
        });

    createAgentStatusTextItem();

    statusCheckButton = new ButtonItem("updateStatus", MSG.common_title_updateStatus());
    statusCheckButton.setStartRow(false);
    statusCheckButton.setEndRow(true);
    if (findAgentInstallPathButton.getTitle().length() < 15) { // i18n may prolong the title
      statusCheckButton.setWidth(100);
    }
    statusCheckButton.addClickHandler(
        new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
          public void onClick(
              com.smartgwt.client.widgets.form.fields.events.ClickEvent clickEvent) {
            if (connectionForm.validate()) {
              new CheckSSHConnectionCallback() {
                @Override
                protected void doActualWork() {
                  agentStatusCheck();
                }
              }.execute();
            }
          }
        });

    if (initialAgentInstall != null) {
      host.setValue(initialAgentInstall.getSshHost());
      if (initialAgentInstall.getSshPort() != null) {
        port.setValue(String.valueOf(initialAgentInstall.getSshPort()));
      }
      username.setValue(initialAgentInstall.getSshUsername());
      password.setValue(initialAgentInstall.getSshPassword());
      agentInstallPath.setValue(initialAgentInstall.getInstallLocation());
      // if it was already saved, assume they want it to stay remembered
      // however, because the uninstall page is getting rid of the agent, we don't need or want to
      // remember the credentials anymore
      if (!this.showUninstallButton) {
        rememberMeCheckbox.setValue(initialAgentInstall.getSshPassword() != null);
      }
    }

    // disable some form elements if we don't want the user changing them - they should have been
    // filled in by who ever created this view
    if (this.showUninstallButton || this.showStartButton || this.showStopButton) {
      host.setDisabled(true);
      port.setDisabled(true);
      agentInstallPath.setDisabled(true);
      findAgentInstallPathButton.setDisabled(true);
    }

    if (this.showUninstallButton) {
      // don't show rememberMe checkbox - we're getting rid of this agent so there won't be a record
      // to store the creds
      connectionForm.setFields(
          host,
          port,
          username,
          password,
          agentInstallPath,
          findAgentInstallPathButton,
          agentStatusText,
          statusCheckButton);
    } else {
      connectionForm.setFields(
          host,
          port,
          username,
          password,
          rememberMeCheckbox,
          agentInstallPath,
          findAgentInstallPathButton,
          agentStatusText,
          statusCheckButton);
    }

    return connectionForm;
  }
Ejemplo n.º 9
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);
  }
Ejemplo n.º 10
0
  public ProxyPanel(GUIParameter[] parameters) {
    setWidth100();
    setMembersMargin(10);
    setMargin(30);
    setHeight(400);

    TabSet tabs = new TabSet();
    tabs.setWidth(380);
    tabs.setHeight(250);
    Tab tab = new Tab();
    tab.setTitle(I18N.message("proxy"));
    tabs.setTabs(tab);

    DynamicForm proxySettingsForm = new DynamicForm();
    proxySettingsForm.setWidth(300);
    proxySettingsForm.setColWidths(1, "*");
    proxySettingsForm.setValuesManager(vm);
    proxySettingsForm.setTitleOrientation(TitleOrientation.LEFT);

    List<FormItem> items = new ArrayList<FormItem>();

    for (GUIParameter f : parameters) {
      if (f.getName().equals("password")) {
        PasswordItem item = ItemFactory.newPasswordItem(f.getName(), f.getName(), f.getValue());
        item.setRequired(true);
        item.setWidth(250);
        items.add(item);
      } else if (f.getName().equals("port")) {
        IntegerItem item =
            ItemFactory.newValidateIntegerItem(
                f.getName(), f.getName(), Integer.parseInt(f.getValue()), 1, null);
        item.setRequired(true);
        item.setWidth(250);
        items.add(item);
      } else {
        TextItem item = ItemFactory.newTextItem(f.getName(), f.getName(), f.getValue());
        item.setRequired(true);
        item.setWidth(250);
        items.add(item);
      }
    }

    proxySettingsForm.setItems(items.toArray(new FormItem[0]));

    IButton save = new IButton();
    save.setTitle(I18N.message("save"));
    save.addClickHandler(
        new ClickHandler() {
          @SuppressWarnings("unchecked")
          public void onClick(ClickEvent event) {
            Map<String, Object> values = (Map<String, Object>) vm.getValues();

            if (vm.validate()) {
              List<GUIParameter> proxySettings = new ArrayList<GUIParameter>();
              for (String name : values.keySet()) {
                GUIParameter proxyParam = new GUIParameter(name, values.get(name).toString());
                proxySettings.add(proxyParam);
              }

              service.saveProxySettings(
                  Session.get().getSid(),
                  proxySettings.toArray(new GUIParameter[0]),
                  new AsyncCallback<Void>() {
                    @Override
                    public void onFailure(Throwable caught) {
                      Log.serverError(caught);
                    }

                    @Override
                    public void onSuccess(Void result) {
                      Log.info(I18N.message("settingssaved"), null);
                    }
                  });
            }
          }
        });

    tab.setPane(proxySettingsForm);
    setMembers(tabs, save);
  }
Ejemplo n.º 11
0
  private RegistrationWindow() {
    super();

    final DynamicForm form = new DynamicForm();
    form.setWidth("100%");

    uName = new TextItem();
    uName.setName("Username");
    uName.setTitle("Username");
    uName.setWidth("100%");

    password1 = new PasswordItem();
    password1.setName("Password1");
    password1.setTitle("Enter Password");
    password1.setWidth("100%");
    password2 = new PasswordItem();
    password2.setName("Password2");
    password2.setTitle("Confirm Password");
    password2.setWidth("100%");
    name = new TextItem();
    name.setName("Name");
    name.setTitle("Name");
    name.setWidth("100%");

    surName = new TextItem();
    surName.setName("Surname");
    surName.setTitle("Surname");
    surName.setWidth("100%");
    email = new TextItem();
    email.setName("Email");
    email.setTitle("Email");
    email.setWidth("100%");

    final IButton buttonItem = new IButton();
    final IButton cancelItem = new IButton();
    cancelItem.setTitle("Cancel");
    cancelItem.setWidth("100%");
    cancelItem.setAlign(Alignment.CENTER);
    cancelItem.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            RegistrationWindow.getInstance().hide();
          }
        });
    buttonItem.setTitle("Register");
    buttonItem.setWidth("100%");
    buttonItem.setAlign(Alignment.CENTER);
    buttonItem.addClickHandler(new MyHandler());

    form.setFields(uName, password1, password2, name, surName, email);

    HLayout layout = new HLayout();
    layout.addMember(buttonItem);
    layout.addMember(cancelItem);
    layout.setAlign(Alignment.CENTER);
    setWidth(360);
    setHeight(250);
    setTitle("Contact Details");
    setShowMinimizeButton(false);
    setIsModal(true);
    setShowModalMask(true);
    centerInPage();
    addCloseClickHandler(
        new CloseClickHandler() {

          @Override
          public void onCloseClick(CloseClientEvent event) {

            instance.hide();
          }
        });

    addItem(form);
    addItem(layout);
    draw();
  }
Ejemplo n.º 12
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());
    }
  }
Ejemplo n.º 13
0
  /** Instantiates a new home view. */
  @Inject
  public HomeView(LangConstants lang) {
    this.lang = lang;
    layout = new VStack();
    layout.setHeight100();
    layout.setPadding(15);
    HTMLFlow html1 = new HTMLFlow();
    html1.setContents(lang.introduction() + HtmlCode.title(lang.availCoopSys(), 2));
    html1.setExtraSpace(15);

    status = new HTMLFlow(getStatusString());
    status.setExtraSpace(35);

    checkButton = new IButton(lang.checkAvailability());
    checkButton.setAutoFit(true);
    checkButton.setExtraSpace(60);

    HTMLFlow html2 = new HTMLFlow();
    html2.setContents(HtmlCode.title(lang.openDigitalObject(), 2));
    html2.setExtraSpace(30);

    DataSource dataSource = new DataSource();
    dataSource.setID("regularExpression");

    RegExpValidator regExpValidator = new RegExpValidator();
    regExpValidator.setExpression(
        "^.*:([\\da-fA-F]){8}-([\\da-fA-F]){4}-([\\da-fA-F]){4}-([\\da-fA-F]){4}-([\\da-fA-F]){12}$");

    uuidField = new TextItem();
    uuidField.setTitle("PID");
    uuidField.setWidth(255);
    uuidField.setHint(HtmlCode.nobr(lang.withoutPrefix()));
    uuidField.setValidators(regExpValidator);

    form = new DynamicForm();
    form.setWidth(300);
    form.setFields(uuidField);

    open = new IButton();
    open.setTitle(lang.open());
    open.setDisabled(true);
    open.setAutoShowParent(false);

    HLayout hLayout = new HLayout();
    hLayout.setMembersMargin(10);
    hLayout.addMember(form);
    hLayout.addMember(open);

    //        HTMLFlow html3 = new HTMLFlow();
    //        html3.setHeight("*");
    //        html3.setLayoutAlign(VerticalAlignment.BOTTOM);
    //        html3.setContents(lang.credits());
    //        html3.setHeight(20);

    layout.addMember(html1);
    layout.addMember(status);
    layout.addMember(checkButton);
    layout.addMember(html2);
    layout.addMember(hLayout);
    //        layout.addMember(html3);
  }
Ejemplo n.º 14
0
  private void initEditWindow() {

    String strBookName = theBook.getBookName();

    this.setAutoSize(true);
    this.setTitle("《" + strBookName + "》" + "修改信息");
    this.setCanDragReposition(true);
    this.setCanDragResize(false);
    this.setAutoCenter(true);
    this.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);

    VLayout vLayout;
    HLayout hLayout;
    HLayout buttonLayout;

    vLayout = new VLayout();
    vLayout.setWidth(WINDOW_WIDTH);
    vLayout.setHeight(WINDOW_HEIGHT);
    vLayout.setBorder("2px solid #7598C7");
    vLayout.setMargin(12);
    vLayout.setPadding(14);

    hLayout = new HLayout();
    hLayout.setWidth(WINDOW_WIDTH);

    // HLayout
    // ---------------------------------------------------------------------------------------
    strBookPicUrl = theBook.getBookPicUrl();
    imgVLayout = new VLayout();
    imgVLayout.setWidth(IMG_WIDTH);
    bookPicUrlItem = new Img(strBookPicUrl, IMG_WIDTH, IMG_HEIGHT);
    //		bookPicUrlItem = new Img(strBookPicUrl, IMG_WIDTH, IMG_HEIGHT);
    //		bookPicUrlItem.setPrefix("/images/upload/");

    uploadPicButton = new IButton("上传封面");
    uploadPicButton.setIcon("actions/plus.png");
    uploadPicButton.setWidth(IMG_WIDTH);

    imgVLayout.setMembers(bookPicUrlItem, uploadPicButton);
    imgVLayout.setMembersMargin(10);

    // Form
    // 1-----------------------------------------------------------------------------------------
    SLBookDS theDataSource = new SLBookDS();
    Record theRecord = theBook.toRecord();
    theDataSource.addData(theRecord);

    bookForm1 = new DynamicForm();
    bookForm1.setDataSource(theDataSource);
    bookForm1.setNumCols(4);
    bookForm1.setWidth("*");
    bookForm1.setColWidths(100, "*", 100, "*");
    bookForm1.setCellPadding(5);

    TextItem bookNameItem = new TextItem("bookName", "书名");
    bookNameItem.setColSpan(4);
    bookNameItem.setWidth("100%");
    bookNameItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookNameItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    TextItem bookAuthorItem = new TextItem("bookAuthor", "作者");
    bookAuthorItem.setColSpan(4);
    bookAuthorItem.setWidth("100%");
    bookAuthorItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookAuthorItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    TextItem bookISBNItem = new TextItem("bookISBN", "ISBN");
    bookISBNItem.setColSpan(4);
    bookISBNItem.setWidth("100%");
    bookISBNItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookISBNItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookISBNItem.setDisabled(true);

    TextItem bookPublisherItem = new TextItem("bookPublisher", "出版社");
    bookPublisherItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookPublisherItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    DateItem bookPublishDateItem = new DateItem("bookPublishDate", "出版日期");
    bookPublishDateItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookPublishDateItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookPublishDateItem.setUseTextField(true);

    SelectItem bookClassItem = new SelectItem("bookClass", "类别");
    bookClassItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookClassItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookClassItem.setValueMap(
        "计算机/网络", "小说/文学", "哲学/文化", "经济/管理", "政治/军事", "励志/成长", "儿童/育儿", "心理", "法律", "历史", "其他");
    bookClassItem.setDefaultToFirstOption(true);

    SelectItem bookLanguageItem = new SelectItem("bookLanguage", "语言");
    bookLanguageItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookLanguageItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookLanguageItem.setValueMap("中文", "英语", "法语", "德语", "日语", "俄语", "韩语");
    bookLanguageItem.setDefaultToFirstOption(true);

    TextItem bookContributorItem = new TextItem("bookContributor", "贡献者");
    bookContributorItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookContributorItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    TextItem bookPriceItem = new TextItem("bookPrice", "价格");
    bookPriceItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookPriceItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    bookForm1.setFields(
        bookNameItem,
        bookAuthorItem,
        bookISBNItem,
        bookPublisherItem,
        bookPublishDateItem,
        bookClassItem,
        bookLanguageItem,
        bookContributorItem,
        bookPriceItem);

    bookForm1.selectRecord(theRecord);
    bookForm1.fetchData();

    // Form
    // 2-----------------------------------------------------------------------------------------
    bookForm2 = new DynamicForm();
    bookForm2.setDataSource(theDataSource);
    bookForm2.setNumCols(3);
    bookForm2.setWidth(WINDOW_WIDTH);
    bookForm2.setColWidths("*", "*", "*");
    bookForm2.setCellPadding(3);
    bookForm2.setCellBorder(1);
    bookForm2.setTitleOrientation(TitleOrientation.TOP);

    StaticTextItem bookTotalQuantityItemTitle = new StaticTextItem("bookTotalQuantityTitle", "");
    bookTotalQuantityItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header");
    bookTotalQuantityItemTitle.setShowTitle(false);

    StaticTextItem bookInStoreQuantityitemTitle =
        new StaticTextItem("bookInStoreQuantityTitle", "");
    bookInStoreQuantityitemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header");
    bookInStoreQuantityitemTitle.setShowTitle(false);

    StaticTextItem bookAvailableQuantityItemTitle =
        new StaticTextItem("bookAvailableQuantityTitle", "");
    bookAvailableQuantityItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header");
    bookAvailableQuantityItemTitle.setShowTitle(false);

    TextItem bookTotalQuantityItem = new TextItem("bookTotalQuantity", "");
    bookTotalQuantityItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookTotalQuantityItem.setShowTitle(false);

    TextItem bookInStoreQuantityitem = new TextItem("bookInStoreQuantity", "");
    bookInStoreQuantityitem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookInStoreQuantityitem.setShowTitle(false);

    TextItem bookAvailableQuantityItem = new TextItem("bookAvailableQuantity", "");
    bookAvailableQuantityItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookAvailableQuantityItem.setShowTitle(false);

    bookForm2.setFields(
        bookTotalQuantityItemTitle,
        bookInStoreQuantityitemTitle,
        bookAvailableQuantityItemTitle,
        bookTotalQuantityItem,
        bookInStoreQuantityitem,
        bookAvailableQuantityItem);

    bookForm2.selectRecord(theRecord);
    bookForm2.fetchData();

    // Form
    // 3-----------------------------------------------------------------------------------------
    bookForm3 = new DynamicForm();
    bookForm3.setDataSource(theDataSource);
    bookForm3.setWidth(WINDOW_WIDTH);
    bookForm3.setCellPadding(3);
    // bookForm2.setNumCols(2);
    bookForm3.setTitleOrientation(TitleOrientation.TOP);

    StaticTextItem bookIntroItemTitle = new StaticTextItem("bookIntroTitle", "");
    bookIntroItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_text_title");
    bookIntroItemTitle.setShowTitle(false);

    TextAreaItem bookIntroItem = new TextAreaItem("bookIntro", "");
    bookIntroItem.setTextBoxStyle("alex_bookdisplaywindow_form_intro_content");
    bookIntroItem.setShowTitle(false);
    bookIntroItem.setColSpan(2);
    bookIntroItem.setWidth("100%");

    bookForm3.setFields(bookIntroItemTitle, bookIntroItem);

    bookForm3.selectRecord(theRecord);
    bookForm3.fetchData();

    // buttonLayout
    // --------------------------------------------------------------------------------------
    buttonLayout = new HLayout();
    submitButton = new IButton("提交修改");
    submitButton.setIcon("actions/approve.png");
    buttonLayout.setMembers(submitButton);
    buttonLayout.setAlign(Alignment.RIGHT);

    hLayout.setMembers(imgVLayout, bookForm1);
    vLayout.setMembers(hLayout, bookForm2, bookForm3, buttonLayout);
    vLayout.setMembersMargin(20);

    this.addItem(vLayout);

    bind();
  }
Ejemplo n.º 15
0
  private void initNewWindow() {

    this.setAutoSize(true);
    this.setTitle("新书入库");
    this.setCanDragReposition(true);
    this.setCanDragResize(false);
    this.setAutoCenter(true);
    this.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);

    VLayout vLayout;
    HLayout hLayout;
    HLayout buttonLayout;

    vLayout = new VLayout();
    vLayout.setWidth(WINDOW_WIDTH);
    vLayout.setHeight(WINDOW_HEIGHT);
    vLayout.setBorder("2px solid #7598C7");
    vLayout.setMargin(12);
    vLayout.setPadding(14);

    hLayout = new HLayout();
    hLayout.setWidth(WINDOW_WIDTH);

    // HLayout
    // ---------------------------------------------------------------------------------------
    imgVLayout = new VLayout();
    imgVLayout.setWidth(IMG_WIDTH);
    bookPicUrlItem = new Img("/images/upload/" + strBookPicUrl, IMG_WIDTH, IMG_HEIGHT);
    //		bookPicUrlItem = new Img(strBookPicUrl, IMG_WIDTH, IMG_HEIGHT);
    //		bookPicUrlItem.setPrefix("/images/upload/");

    uploadPicButton = new IButton("上传封面");
    uploadPicButton.setIcon("actions/plus.png");
    uploadPicButton.setWidth(IMG_WIDTH);

    imgVLayout.setMembers(bookPicUrlItem, uploadPicButton);
    imgVLayout.setMembersMargin(10);

    // Form
    // 1-----------------------------------------------------------------------------------------

    bookForm1 = new DynamicForm();
    bookForm1.setNumCols(4);
    bookForm1.setWidth("*");
    bookForm1.setColWidths(100, "*", 100, "*");
    bookForm1.setCellPadding(5);

    TextItem bookNameItem = new TextItem("bookName", "书名");
    bookNameItem.setColSpan(4);
    bookNameItem.setWidth("100%");
    bookNameItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookNameItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    TextItem bookAuthorItem = new TextItem("bookAuthor", "作者");
    bookAuthorItem.setColSpan(4);
    bookAuthorItem.setWidth("100%");
    bookAuthorItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookAuthorItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    TextItem bookISBNItem = new TextItem("bookISBN", "ISBN");
    bookISBNItem.setColSpan(4);
    bookISBNItem.setWidth("100%");
    bookISBNItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookISBNItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    bookISBNItem.setShowIcons(true);
    FormItemIcon fetchBookInfoBut = new FormItemIcon();
    fetchBookInfoBut.setSrc("/images/actions/approve.png");
    bookISBNItem.setIcons(fetchBookInfoBut);
    bookISBNItem.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            if (event.getKeyName().equals("Enter")) {
              fetchDataFromDouban();
            }
          }
        });
    fetchBookInfoBut.addFormItemClickHandler(
        new FormItemClickHandler() {

          @Override
          public void onFormItemClick(FormItemIconClickEvent event) {
            fetchDataFromDouban();
          }
        });
    bookISBNItem.setIconPrompt("从豆瓣获取书籍信息");

    TextItem bookPublisherItem = new TextItem("bookPublisher", "出版社");
    bookPublisherItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookPublisherItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    DateItem bookPublishDateItem = new DateItem("bookPublishDate", "出版日期");
    bookPublishDateItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookPublishDateItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookPublishDateItem.setUseTextField(true);
    bookPublishDateItem.setDefaultChooserDate(new Date());

    SelectItem bookClassItem = new SelectItem("bookClass", "类别");
    bookClassItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookClassItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookClassItem.setValueMap(
        "计算机/网络", "小说/文学", "哲学/文化", "经济/管理", "政治/军事", "励志/成长", "儿童/育儿", "心理", "法律", "历史", "其他");
    bookClassItem.setDefaultToFirstOption(true);

    SelectItem bookLanguageItem = new SelectItem("bookLanguage", "语言");
    bookLanguageItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookLanguageItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookLanguageItem.setValueMap("中文", "英语", "法语", "德语", "日语", "俄语", "韩语");
    bookLanguageItem.setDefaultToFirstOption(true);

    TextItem bookContributorItem = new TextItem("bookContributor", "贡献者");
    bookContributorItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookContributorItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    TextItem bookPriceItem = new TextItem("bookPrice", "价格");
    bookPriceItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookPriceItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    bookForm1.setFields(
        bookNameItem,
        bookAuthorItem,
        bookISBNItem,
        bookPublisherItem,
        bookPublishDateItem,
        bookClassItem,
        bookLanguageItem,
        bookContributorItem,
        bookPriceItem);

    // Form
    // 2-----------------------------------------------------------------------------------------
    bookForm2 = new DynamicForm();
    bookForm2.setNumCols(3);
    bookForm2.setWidth(WINDOW_WIDTH);
    bookForm2.setColWidths("*", "*", "*");
    bookForm2.setCellPadding(3);
    bookForm2.setCellBorder(1);
    bookForm2.setTitleOrientation(TitleOrientation.TOP);

    StaticTextItem bookTotalQuantityItemTitle = new StaticTextItem("bookTotalQuantityTitle", "");
    bookTotalQuantityItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header");
    bookTotalQuantityItemTitle.setShowTitle(false);

    StaticTextItem bookInStoreQuantityitemTitle =
        new StaticTextItem("bookInStoreQuantityTitle", "");
    bookInStoreQuantityitemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header");
    bookInStoreQuantityitemTitle.setShowTitle(false);

    StaticTextItem bookAvailableQuantityItemTitle =
        new StaticTextItem("bookAvailableQuantityTitle", "");
    bookAvailableQuantityItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header");
    bookAvailableQuantityItemTitle.setShowTitle(false);

    TextItem bookTotalQuantityItem = new TextItem("bookTotalQuantity", "");
    bookTotalQuantityItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookTotalQuantityItem.setShowTitle(false);

    TextItem bookInStoreQuantityitem = new TextItem("bookInStoreQuantity", "");
    bookInStoreQuantityitem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookInStoreQuantityitem.setShowTitle(false);

    TextItem bookAvailableQuantityItem = new TextItem("bookAvailableQuantity", "");
    bookAvailableQuantityItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookAvailableQuantityItem.setShowTitle(false);

    bookForm2.setFields(
        bookTotalQuantityItemTitle,
        bookInStoreQuantityitemTitle,
        bookAvailableQuantityItemTitle,
        bookTotalQuantityItem,
        bookInStoreQuantityitem,
        bookAvailableQuantityItem);

    // Form
    // 3-----------------------------------------------------------------------------------------
    bookForm3 = new DynamicForm();
    bookForm3.setWidth(WINDOW_WIDTH);
    bookForm3.setCellPadding(3);
    // bookForm2.setNumCols(2);
    bookForm3.setTitleOrientation(TitleOrientation.TOP);

    StaticTextItem bookIntroItemTitle = new StaticTextItem("bookIntroTitle", "");
    bookIntroItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_text_title");
    bookIntroItemTitle.setShowTitle(false);

    TextAreaItem bookIntroItem = new TextAreaItem("bookIntro", "");
    bookIntroItem.setTextBoxStyle("alex_bookdisplaywindow_form_intro_content");
    bookIntroItem.setShowTitle(false);
    bookIntroItem.setColSpan(2);
    bookIntroItem.setWidth("100%");

    bookForm3.setFields(bookIntroItemTitle, bookIntroItem);

    // buttonLayout
    // --------------------------------------------------------------------------------------
    buttonLayout = new HLayout();
    newButton = new IButton("添加图书");
    newButton.setIcon("actions/approve.png");
    buttonLayout.setMembers(newButton);
    buttonLayout.setAlign(Alignment.RIGHT);

    hLayout.setMembers(imgVLayout, bookForm1);
    vLayout.setMembers(hLayout, bookForm2, bookForm3, buttonLayout);
    vLayout.setMembersMargin(20);

    bookForm1.setValue("bookPublishDate", new Date());
    bookForm1.setValue("bookClass", "计算机/网络");
    bookForm1.setValue("bookLanguage", "中文");
    bookForm1.setValue("bookPrice", "0.00");
    bookForm1.setValue("bookContributor", "公司采购");

    bookForm2.setValue("bookTotalQuantity", "1");
    bookForm2.setValue("bookInStoreQuantity", "1");
    bookForm2.setValue("bookAvailableQuantity", "1");

    bookForm2.setValue("bookTotalQuantityTitle", "总数");
    bookForm2.setValue("bookInStoreQuantityTitle", "库中数量");
    bookForm2.setValue("bookAvailableQuantityTitle", "可借数量");
    bookForm3.setValue("bookIntroTitle", "简介:");

    this.addItem(vLayout);

    bind();
  }
Ejemplo n.º 16
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();
  }