@AutoGenerated
  private AbsoluteLayout buildAbsLCaracteristicas1() {
    // common part: create layout
    absLCaracteristicas1 = new AbsoluteLayout();
    absLCaracteristicas1.setImmediate(false);
    absLCaracteristicas1.setWidth("100.0%");
    absLCaracteristicas1.setHeight("55px");

    // txtNoRiego
    txtNoRiego = new TextField();
    txtNoRiego.setCaption("Núm. de Riego");
    txtNoRiego.setImmediate(false);
    txtNoRiego.setWidth("100px");
    txtNoRiego.setHeight("25px");
    absLCaracteristicas1.addComponent(txtNoRiego, "top:28.0px;left:10.0px;");

    // txtTipoPrueba
    txtTipoPrueba = new TextField();
    txtTipoPrueba.setCaption("Tipo de Prueba");
    txtTipoPrueba.setImmediate(false);
    txtTipoPrueba.setWidth("385px");
    txtTipoPrueba.setHeight("25px");
    absLCaracteristicas1.addComponent(txtTipoPrueba, "top:28.0px;left:130.0px;");

    return absLCaracteristicas1;
  }
  @AutoGenerated
  private AbsoluteLayout buildAbsLAvanceRecesion() {
    // common part: create layout
    absLAvanceRecesion = new AbsoluteLayout();
    absLAvanceRecesion.setImmediate(false);
    absLAvanceRecesion.setWidth("100.0%");
    absLAvanceRecesion.setHeight("320px");

    // verLAvanceTabla
    verLAvanceTabla = buildVerLAvanceTabla();
    absLAvanceRecesion.addComponent(verLAvanceTabla);

    // btnAdd
    btnAdd = new Button();
    btnAdd.setCaption("Agregar");
    btnAdd.setImmediate(true);
    btnAdd.setWidth("85px");
    btnAdd.setHeight("-1px");
    absLAvanceRecesion.addComponent(btnAdd, "top:28.0px;right:10.0px;");

    // btnCancel
    btnCancel = new Button();
    btnCancel.setCaption("Cancelar");
    btnCancel.setImmediate(true);
    btnCancel.setWidth("85px");
    btnCancel.setHeight("-1px");
    absLAvanceRecesion.addComponent(btnCancel, "top:60.0px;right:10.0px;");

    return absLAvanceRecesion;
  }
  @AutoGenerated
  private AbsoluteLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new AbsoluteLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth("560px");
    mainLayout.setHeight("100px");
    mainLayout.setMargin(true);

    // top-level component properties
    setWidth("560px");
    setHeight("100px");

    // codeField
    codeField = new TextField();
    codeField.setCaption("Código");
    codeField.setImmediate(false);
    codeField.setWidth("140px");
    codeField.setHeight("-1px");
    codeField.setTabIndex(1);
    codeField.setRequired(true);
    mainLayout.addComponent(codeField, "top:16.0px;left:20.0px;");

    // descriptionField
    descriptionField = new TextField();
    descriptionField.setCaption("Descripción");
    descriptionField.setImmediate(false);
    descriptionField.setWidth("520px");
    descriptionField.setHeight("-1px");
    mainLayout.addComponent(descriptionField, "top:56.0px;left:20.0px;");

    return mainLayout;
  }
  @AutoGenerated
  private AbsoluteLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new AbsoluteLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth("400px");
    mainLayout.setHeight("300px");

    // top-level component properties
    setWidth("400px");
    setHeight("300px");

    // btn_editar
    btn_editar = new Button();
    btn_editar.setCaption("Editar");
    btn_editar.setImmediate(true);
    btn_editar.setWidth("280px");
    btn_editar.setHeight("-1px");
    mainLayout.addComponent(btn_editar, "top:234.0px;left:60.0px;");

    // tableMaterias
    tableMaterias = new Table();
    tableMaterias.setImmediate(false);
    tableMaterias.setWidth("100.0%");
    tableMaterias.setHeight("200px");
    mainLayout.addComponent(tableMaterias, "top:20.0px;right:60.0px;left:60.0px;");

    return mainLayout;
  }
  @AutoGenerated
  private AbsoluteLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new AbsoluteLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth("100%");
    mainLayout.setHeight("100%");
    mainLayout.setMargin(false);

    // top-level component properties
    setWidth("100.0%");
    setHeight("100.0%");

    // mainMenu
    mainMenu = buildMenuBar();
    mainLayout.addComponent(mainMenu, "top:0.0px;left:0.0px;");

    // titleLabel
    titleLabel = new Label();
    titleLabel.setStyleName("titleLabel");
    titleLabel.setImmediate(false);
    titleLabel.setWidth("540px");
    titleLabel.setHeight("40px");
    titleLabel.setValue("Naslov");
    mainLayout.addComponent(titleLabel, "top:40.0px;left:20.0px;");

    loginComponent = new LoginComponent(this);
    mainLayout.addComponent(loginComponent, "top:30.0px;left:700.0px;");

    // productSearchSplit
    productSearchSplit = buildProductSearchSplit();
    mainLayout.addComponent(productSearchSplit, "top:100.0px;left:10.0px;");

    return mainLayout;
  }
  private void limpiarAvance() {
    txtNoAvance.setValue(listaAvance.size() + 1 + "");
    txtDistancia.setValue("");
    tmfAvance.setValue(null);
    tmfRecesion.setValue(null);

    btnAdd.setCaption("Agregar");
    btnCancel.setVisible(false);
    absLAvance.setVisible(false);
    absLAvanceRecesion.setHeight("265px");
  }
  @AutoGenerated
  private AbsoluteLayout buildAbsLCaracteristicas2() {
    // common part: create layout
    absLCaracteristicas2 = new AbsoluteLayout();
    absLCaracteristicas2.setImmediate(false);
    absLCaracteristicas2.setWidth("100.0%");
    absLCaracteristicas2.setHeight("45px");

    // cmbEtapa
    cmbEtapa = new ComboBox();
    cmbEtapa.setCaption("Etapa Fenológica");
    cmbEtapa.setImmediate(false);
    cmbEtapa.setWidth("250px");
    cmbEtapa.setHeight("25px");
    absLCaracteristicas2.addComponent(cmbEtapa, "top:18.0px;left:10.0px;");

    // txtSupRegada
    txtSupRegada = new TextField();
    txtSupRegada.setCaption("Superficie Regada");
    txtSupRegada.setImmediate(false);
    txtSupRegada.setWidth("100px");
    txtSupRegada.setHeight("25px");
    absLCaracteristicas2.addComponent(txtSupRegada, "top:18.0px;left:280.0px;");

    // lblSupRegada
    lblSupRegada = new Label();
    lblSupRegada.setImmediate(false);
    lblSupRegada.setWidth("-1px");
    lblSupRegada.setHeight("-1px");
    lblSupRegada.setValue("ha");
    absLCaracteristicas2.addComponent(lblSupRegada, "top:22.0px;left:385.0px;");

    // txtProfRaices
    txtProfRaices = new TextField();
    txtProfRaices.setCaption("Prof. de Raíces");
    txtProfRaices.setImmediate(false);
    txtProfRaices.setWidth("100px");
    txtProfRaices.setHeight("25px");
    absLCaracteristicas2.addComponent(txtProfRaices, "top:18.0px;left:415.0px;");

    // lblProfRaices
    lblProfRaices = new Label();
    lblProfRaices.setImmediate(false);
    lblProfRaices.setWidth("-1px");
    lblProfRaices.setHeight("-1px");
    lblProfRaices.setValue("cm");
    absLCaracteristicas2.addComponent(lblProfRaices, "top:22.0px;left:520.0px;");

    return absLCaracteristicas2;
  }
  @AutoGenerated
  private AbsoluteLayout buildAbsLAvance() {
    // common part: create layout
    absLAvance = new AbsoluteLayout();
    absLAvance.setImmediate(false);
    absLAvance.setWidth("100.0%");
    absLAvance.setHeight("55px");

    // txtNoAvance
    txtNoAvance = new TextField();
    txtNoAvance.setCaption("Núm.");
    txtNoAvance.setImmediate(false);
    txtNoAvance.setWidth("60px");
    txtNoAvance.setHeight("25px");
    absLAvance.addComponent(txtNoAvance, "top:28.0px;left:10.0px;");

    // txtDistancia
    txtDistancia = new TextField();
    txtDistancia.setCaption("Distancia");
    txtDistancia.setImmediate(false);
    txtDistancia.setWidth("100px");
    txtDistancia.setHeight("25px");
    absLAvance.addComponent(txtDistancia, "top:28.0px;left:85.0px;");

    // lblDistancia
    lblDistancia = new Label();
    lblDistancia.setImmediate(false);
    lblDistancia.setWidth("-1px");
    lblDistancia.setHeight("-1px");
    lblDistancia.setValue("m");
    absLAvance.addComponent(lblDistancia, "top:32.0px;left:190.0px;");

    // tmfAvance
    tmfAvance = new TimeField();
    tmfAvance.setCaption("Avance");
    tmfAvance.setImmediate(false);
    tmfAvance.setWidth("-1px");
    tmfAvance.setHeight("25px");
    absLAvance.addComponent(tmfAvance, "top:28.0px;left:215.0px;");

    // tmfRecesion
    tmfRecesion = new TimeField();
    tmfRecesion.setCaption("Recesión");
    tmfRecesion.setImmediate(false);
    tmfRecesion.setWidth("-1px");
    tmfRecesion.setHeight("25px");
    absLAvance.addComponent(tmfRecesion, "top:28.0px;left:330.0px;");

    return absLAvance;
  }
  public SubsEditViewImpl() {
    ButtonRenderer deleteButton = createDeleteButton();
    Slider percentSlider = createPercentSlider();
    MultiFileUpload uploader = createUploader();

    // need to update the grid a first time for initialization.
    updateGrid(null);
    grid.getColumn("delete").setRenderer(deleteButton);
    fileDownloader = new FileDownloader(generateResource());
    fileDownloader.extend(downloadButton);

    // create the main layout
    VerticalLayout content = new VerticalLayout();

    // layout which contains the uploader and the percentage - in other words : all the
    // configuration information
    HorizontalLayout configHorizontalLayout = new HorizontalLayout();
    configHorizontalLayout.addComponent(uploader);

    // Configure the layout which contains the percentage slider
    AbsoluteLayout sliderLayout = new AbsoluteLayout();
    sliderLayout.setWidth("100px");
    sliderLayout.setHeight("35px");
    sliderLayout.addComponent(percentSlider);

    // Configure the layout which contains the percentage slider layout and the labels linked to the
    // percentage
    HorizontalLayout percentageLayout = new HorizontalLayout();
    percentageLayout.addComponent(percentSliderTitle);
    percentageLayout.addComponent(sliderLayout);
    percentageLayout.addComponent(percentLabel);
    percentageLayout.setComponentAlignment(percentSliderTitle, Alignment.MIDDLE_LEFT);
    percentageLayout.setComponentAlignment(percentLabel, Alignment.MIDDLE_LEFT);

    // add the percentage Layout to the layout which contains the uploader
    configHorizontalLayout.addComponent(percentageLayout);
    configHorizontalLayout.setComponentAlignment(percentageLayout, Alignment.BOTTOM_LEFT);

    // add every layouts to the principal one
    content.addComponent(configHorizontalLayout);
    content.addComponent(new Label(" ", Label.CONTENT_XHTML));
    content.addComponents(grid);
    content.addComponent(downloadButton);
    setCompositionRoot(content);
  }
  @AutoGenerated
  private AbsoluteLayout buildAbsLTabla() {
    // common part: create layout
    absLTabla = new AbsoluteLayout();
    absLTabla.setImmediate(false);
    absLTabla.setWidth("100.0%");
    absLTabla.setHeight("265px");

    // tblAvance
    tblAvance = new Table();
    tblAvance.setCaption("* Dar doble click sobre un elemento para modificarlo");
    tblAvance.setImmediate(false);
    tblAvance.setWidth("425px");
    tblAvance.setHeight("225px");
    absLTabla.addComponent(tblAvance, "top:28.0px;left:10.0px;");

    return absLTabla;
  }
  @AutoGenerated
  private AbsoluteLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new AbsoluteLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth("100%");
    mainLayout.setHeight("100%");

    // top-level component properties
    setWidth("100.0%");
    setHeight("100.0%");

    // panel_1
    panel_1 = buildPanel_1();
    mainLayout.addComponent(panel_1, "top:0.0px;left:0.0px;");

    return mainLayout;
  }
  @AutoGenerated
  private AbsoluteLayout buildRegisterTab() {
    // common part: create layout
    registerTab = new AbsoluteLayout();
    registerTab.setImmediate(false);
    registerTab.setWidth("100.0%");
    registerTab.setHeight("248px");
    registerTab.setMargin(false);

    // emailDiv
    emailDiv = buildEmailDiv();
    registerTab.addComponent(emailDiv, "top:0.0px;bottom:215.0px;left:0.0px;");

    // passwordDiv
    passwordDiv = buildPasswordDiv();
    registerTab.addComponent(passwordDiv, "top:34.0px;left:0.0px;");

    // firstNameDiv
    firstNameDiv = buildFirstNameDiv();
    registerTab.addComponent(firstNameDiv, "top:108.0px;bottom:107.0px;left:0.0px;");

    // lastNameDiv
    lastNameDiv = buildLastNameDiv();
    registerTab.addComponent(lastNameDiv, "top:147.0px;left:0.0px;");

    // confirmDiv
    confirmDiv = buildConfirmDiv();
    registerTab.addComponent(confirmDiv, "top:72.0px;right:186.0px;bottom:145.0px;left:0.0px;");

    // companyDiv
    companyDiv = buildCompanyDiv();
    registerTab.addComponent(companyDiv, "top:200.0px;left:0.0px;");

    // register
    register = new Button();
    register.setStyleName("decorated");
    register.setCaption("Register");
    register.setImmediate(true);
    register.setWidth("-1px");
    register.setHeight("-1px");
    registerTab.addComponent(register, "top:228.0px;left:220.0px;");

    return registerTab;
  }
  @AutoGenerated
  private AbsoluteLayout buildAbsLCaracteristicas4() {
    // common part: create layout
    absLCaracteristicas4 = new AbsoluteLayout();
    absLCaracteristicas4.setImmediate(false);
    absLCaracteristicas4.setWidth("100.0%");
    absLCaracteristicas4.setHeight("45px");

    // txtTirante
    txtTirante = new TextField();
    txtTirante.setCaption("Tirante del Surco o Melga");
    txtTirante.setImmediate(false);
    txtTirante.setWidth("150px");
    txtTirante.setHeight("25px");
    absLCaracteristicas4.addComponent(txtTirante, "top:18.0px;left:10.0px;");

    // lblTirante
    lblTirante = new Label();
    lblTirante.setImmediate(false);
    lblTirante.setWidth("-1px");
    lblTirante.setHeight("-1px");
    lblTirante.setValue("cm");
    absLCaracteristicas4.addComponent(lblTirante, "top:22.0px;left:165.0px;");

    // txtGasto
    txtGasto = new TextField();
    txtGasto.setCaption("Gasto  en Surco o Melga");
    txtGasto.setImmediate(false);
    txtGasto.setWidth("150px");
    txtGasto.setHeight("25px");
    absLCaracteristicas4.addComponent(txtGasto, "top:18.0px;left:230.0px;");

    // lblGasto
    lblGasto = new Label();
    lblGasto.setImmediate(false);
    lblGasto.setWidth("-1px");
    lblGasto.setHeight("-1px");
    lblGasto.setValue("L/s");
    absLCaracteristicas4.addComponent(lblGasto, "top:22.0px;left:385.0px;");

    return absLCaracteristicas4;
  }
  @AutoGenerated
  private AbsoluteLayout buildAbsLCaracteristicas5() {
    // common part: create layout
    absLCaracteristicas5 = new AbsoluteLayout();
    absLCaracteristicas5.setImmediate(false);
    absLCaracteristicas5.setWidth("100.0%");
    absLCaracteristicas5.setHeight("55px");

    // txtLamApl
    txtLamApl = new TextField();
    txtLamApl.setCaption("Lámina Aplicada");
    txtLamApl.setImmediate(false);
    txtLamApl.setWidth("150px");
    txtLamApl.setHeight("25px");
    absLCaracteristicas5.addComponent(txtLamApl, "top:18.0px;left:10.0px;");

    // lblLamApl
    lblLamApl = new Label();
    lblLamApl.setImmediate(false);
    lblLamApl.setWidth("-1px");
    lblLamApl.setHeight("-1px");
    lblLamApl.setValue("cm");
    absLCaracteristicas5.addComponent(lblLamApl, "top:22.0px;left:165.0px;");

    // txtLamCalc
    txtLamCalc = new TextField();
    txtLamCalc.setCaption("Lámina Calculada");
    txtLamCalc.setImmediate(false);
    txtLamCalc.setWidth("150px");
    txtLamCalc.setHeight("25px");
    absLCaracteristicas5.addComponent(txtLamCalc, "top:18.0px;left:230.0px;");

    // lblLamCalc
    lblLamCalc = new Label();
    lblLamCalc.setImmediate(false);
    lblLamCalc.setWidth("-1px");
    lblLamCalc.setHeight("-1px");
    lblLamCalc.setValue("cm");
    absLCaracteristicas5.addComponent(lblLamCalc, "top:22.0px;left:385.0px;");

    return absLCaracteristicas5;
  }
  @AutoGenerated
  private AbsoluteLayout buildAbsLCaracteristicas3() {
    // common part: create layout
    absLCaracteristicas3 = new AbsoluteLayout();
    absLCaracteristicas3.setImmediate(false);
    absLCaracteristicas3.setWidth("100.0%");
    absLCaracteristicas3.setHeight("45px");

    // txtHumIni
    txtHumIni = new TextField();
    txtHumIni.setCaption("Cont. de Hum. Inicial");
    txtHumIni.setImmediate(false);
    txtHumIni.setWidth("150px");
    txtHumIni.setHeight("25px");
    absLCaracteristicas3.addComponent(txtHumIni, "top:18.0px;left:10.0px;");

    // lblHumIni
    lblHumIni = new Label();
    lblHumIni.setImmediate(false);
    lblHumIni.setWidth("-1px");
    lblHumIni.setHeight("-1px");
    lblHumIni.setValue("cm³/cm³");
    absLCaracteristicas3.addComponent(lblHumIni, "top:22.0px;left:165.0px;");

    // txtHumSat
    txtHumSat = new TextField();
    txtHumSat.setCaption("Cont. de Hum. Saturación");
    txtHumSat.setImmediate(false);
    txtHumSat.setWidth("150px");
    txtHumSat.setHeight("25px");
    absLCaracteristicas3.addComponent(txtHumSat, "top:18.0px;left:230.0px;");

    // lblHumSat
    lblHumSat = new Label();
    lblHumSat.setImmediate(false);
    lblHumSat.setWidth("-1px");
    lblHumSat.setHeight("-1px");
    lblHumSat.setValue("cm³/cm³");
    absLCaracteristicas3.addComponent(lblHumSat, "top:22.0px;left:385.0px;");

    return absLCaracteristicas3;
  }
Beispiel #16
0
  private Panel designMainPanel() {
    // positioning indices
    final int leftStart = 450, topStart = 10, space = 100;
    // create the panel that will hold all components

    Panel pnlURIsProperties = new Panel("URI Display");

    pnlURIsProperties.setWidth("100%");
    pnlURIsProperties.setHeight("100%");

    // Create absolute layout specifying its properties
    final AbsoluteLayout layout = new AbsoluteLayout();
    layout.setWidth("100%");
    layout.setHeight("100%");
    layout.setSizeFull();

    // Create components Objects and specify their properties

    Button btnCorrect = new Button("Correct");
    Button btnIncorrect = new Button("Incorrect");
    Button btnUnsure = new Button("Unsure");
    Button btnGetProperties = new Button("Get properties");

    final NativeSelect cmbSourceEndpoint = new NativeSelect("Source Endpoint");
    final NativeSelect cmbDestinationEndpoint = new NativeSelect("Destination Endpoint");
    final ListSelect lstSuggestedProperties = new ListSelect("Lookup Properties");
    // to load properties of loaded resources automatically
    final CheckBox chkAutomaticPropertiesLoad =
        new CheckBox("Automatic Properties loading (next time)");
    chkAutomaticPropertiesLoad.setValue(false);

    cmbSourceEndpoint.setNullSelectionAllowed(false);
    cmbDestinationEndpoint.setNullSelectionAllowed(false);

    lstSuggestedProperties.setRows(4);
    lstSuggestedProperties.setNullSelectionAllowed(false);

    source = new Label("Source URI");
    destination = new Label("Destination URI");

    final Table tblSourcePropertiesMapping = new Table("Source Properties");
    final Table tblDestinationPropertiesMapping = new Table("Destination Properties");
    tblSourcePropertiesParam = tblSourcePropertiesMapping;
    tblDestinationPropertiesParam = tblDestinationPropertiesMapping;

    tblSourcePropertiesMapping.setWidth("50%");
    tblDestinationPropertiesMapping.setWidth("100%");
    tblSourcePropertiesMapping.setSelectable(true);
    tblDestinationPropertiesMapping.setSelectable(true);
    /* Define the names and data types of columns.
     * The "default value" parameter is meaningless here. */
    tblSourcePropertiesMapping.addContainerProperty("Property", String.class, null);
    tblSourcePropertiesMapping.addContainerProperty("Value", String.class, null);

    tblDestinationPropertiesMapping.addContainerProperty("Property", String.class, null);
    tblDestinationPropertiesMapping.addContainerProperty("Value", String.class, null);
    tblDestinationPropertiesMapping.setMultiSelect(true);
    /// get data for comboboxes
    SQLContainer cmbContainer = connectToDB("root", "mofo", "Endpoints");
    // fill endpoints
    cmbSourceEndpoint.setContainerDataSource(cmbContainer);
    cmbDestinationEndpoint.setContainerDataSource(cmbContainer);

    cmbSourceEndpoint.setValue(cmbSourceEndpoint.getItemIds().iterator().next());
    cmbDestinationEndpoint.setValue(cmbDestinationEndpoint.getItemIds().iterator().next());

    SQLContainer lstContainer = getSuggestedProperties("root", "mofo");
    int lstSize = lstContainer.size();
    int i = 0;
    for (Object cityItemId : lstContainer.getItemIds()) {
      lstSuggestedProperties.addItem(i);
      String g = lstContainer.getItem(cityItemId).getItemProperty("property").getValue().toString();
      lstSuggestedProperties.setItemCaption(i, g);
      i++;
    }
    lstSuggestedProperties.setValue(lstSuggestedProperties.getItemIds().iterator().next());

    btnCorrect.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            try {
              Object rowId = tblSourceDestinationparam.getValue();
              Item myitem = tblSourceDestinationparam.getItem(tblSourceDestinationparam.getValue());
              lEndTime = System.currentTimeMillis();
              long lEllapsedTime = lEndTime - lStartTime;
              tblSourceDestinationparam.setEditable(true);
              tblSourceDestinationparam.getContainerProperty(rowId, "decision").setValue("Correct");
              tblSourceDestinationparam
                  .getContainerProperty(rowId, "time")
                  .setValue(String.valueOf(lEllapsedTime));

              tblSourceDestinationparam.setEditable(false);
              SQLContainer c = (SQLContainer) tblSourceDestinationparam.getContainerDataSource();
              try {
                c.commit();
              } catch (UnsupportedOperationException | SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }
              int maxindex = tblSourceDestination.size();
              SQLContainer s = (SQLContainer) tblSourceDestination.getContainerDataSource();
              // Item x=s.getItem(tblSourceDestination.getValue());
              if (!(tblSourceDestination.getValue().equals(tblSourceDestination.lastItemId()))) {
                int index = s.indexOfId(tblSourceDestination.getValue());
                index++;
                tblSourceDestination.setValue(s.getIdByIndex(index));
                try {
                  Object rowId2 = tblSourceDestination.getValue();
                  Property sourceProperty =
                      tblSourceDestination.getContainerProperty(rowId2, "sourceURI");
                  Property destinationProperty =
                      tblSourceDestination.getContainerProperty(rowId2, "destinationURI");

                  source.setValue(sourceProperty.toString());
                  destination.setValue(destinationProperty.toString());
                  tblSourcePropertiesParam.removeAllItems();
                  tblDestinationPropertiesParam.removeAllItems();

                  Notification loadURI = new Notification("");
                  loadURI.show("Links' URIs are successfully loaded ");
                  if (chkAutomaticPropertiesLoad.getValue()) // the automatic buton i schecked
                  {
                    // load the properties automatically
                    String sourceEndpoint = "", destinationEndpoint = "";
                    sourceEndpoint = cmbSourceEndpoint.getItemCaption(cmbSourceEndpoint.getValue());
                    destinationEndpoint =
                        cmbDestinationEndpoint.getItemCaption(cmbDestinationEndpoint.getValue());
                    try {
                      String sparqlQuery = source.getValue();
                      getURIProperties(sparqlQuery, sourceEndpoint, tblSourcePropertiesMapping);
                      sparqlQuery = destination.getValue();
                      getURIProperties(
                          sparqlQuery, destinationEndpoint, tblDestinationPropertiesMapping);
                    } catch (Exception e) {
                      Notification.show("ERROR");
                    }
                    lStartTime = System.currentTimeMillis();
                    // start time for next one
                  }
                } catch (Exception e) {
                  Notification error = new Notification("Error");
                  error.show("You did not select an item in the links table");
                }
              }
            } catch (Exception e) {
              Notification.show(e.getMessage());
            }

            ///////////////////////////////////

          }
        });
    btnIncorrect.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            try {
              Object rowId = tblSourceDestinationparam.getValue();
              Item myitem = tblSourceDestinationparam.getItem(tblSourceDestinationparam.getValue());
              lEndTime = System.currentTimeMillis();
              long lEllapsedTime = lEndTime - lStartTime;
              tblSourceDestinationparam.setEditable(true);
              tblSourceDestinationparam
                  .getContainerProperty(rowId, "decision")
                  .setValue("Incorrect");
              tblSourceDestinationparam
                  .getContainerProperty(rowId, "time")
                  .setValue(String.valueOf(lEllapsedTime));
              tblSourceDestinationparam.setEditable(false);
              SQLContainer c = (SQLContainer) tblSourceDestinationparam.getContainerDataSource();
              try {
                c.commit();
              } catch (UnsupportedOperationException | SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }
              int maxindex = tblSourceDestination.size();
              SQLContainer s = (SQLContainer) tblSourceDestination.getContainerDataSource();
              // Item x=s.getItem(tblSourceDestination.getValue());
              if (!(tblSourceDestination.getValue().equals(tblSourceDestination.lastItemId()))) {
                int index = s.indexOfId(tblSourceDestination.getValue());
                index++;
                tblSourceDestination.setValue(s.getIdByIndex(index));
                try {
                  Object rowId2 = tblSourceDestination.getValue();
                  Property sourceProperty =
                      tblSourceDestination.getContainerProperty(rowId2, "sourceURI");
                  Property destinationProperty =
                      tblSourceDestination.getContainerProperty(rowId2, "destinationURI");

                  source.setValue(sourceProperty.toString());
                  destination.setValue(destinationProperty.toString());
                  tblSourcePropertiesParam.removeAllItems();
                  tblDestinationPropertiesParam.removeAllItems();

                  Notification loadURI = new Notification("");
                  loadURI.show("Links' URIs are successfully loaded ");

                  if (chkAutomaticPropertiesLoad.getValue()) // the automatic buton i schecked
                  {
                    // load the properties automatically
                    String sourceEndpoint = "", destinationEndpoint = "";
                    sourceEndpoint = cmbSourceEndpoint.getItemCaption(cmbSourceEndpoint.getValue());
                    destinationEndpoint =
                        cmbDestinationEndpoint.getItemCaption(cmbDestinationEndpoint.getValue());
                    try {
                      String sparqlQuery = source.getValue();
                      getURIProperties(sparqlQuery, sourceEndpoint, tblSourcePropertiesMapping);
                      sparqlQuery = destination.getValue();
                      getURIProperties(
                          sparqlQuery, destinationEndpoint, tblDestinationPropertiesMapping);
                    } catch (Exception e) {
                      Notification.show("ERROR Not Properties queried");
                    }
                    lStartTime = System.currentTimeMillis();
                    // start time for next one
                  }
                } catch (Exception e) {
                  Notification error = new Notification("Error");
                  error.show("You did not select an item in the links table");
                }
              }
            } catch (Exception e) {
              Notification.show(e.getMessage());
            }
            ///////////////////////////////////

          }
        });
    btnUnsure.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            try {
              Object rowId = tblSourceDestinationparam.getValue();
              Item myitem = tblSourceDestinationparam.getItem(tblSourceDestinationparam.getValue());
              lEndTime = System.currentTimeMillis();
              float lEllapsedTime = lEndTime - lStartTime;
              String elapsedTime = String.valueOf(lEllapsedTime);
              tblSourceDestinationparam.setEditable(true);
              tblSourceDestinationparam.getContainerProperty(rowId, "decision").setValue("Unsure");
              tblSourceDestinationparam.getContainerProperty(rowId, "time").setValue(elapsedTime);
              tblSourceDestinationparam.setEditable(false);
              SQLContainer c = (SQLContainer) tblSourceDestinationparam.getContainerDataSource();
              try {
                c.commit();
              } catch (UnsupportedOperationException | SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }

              // int selectedId=Integer.parseInt(tblSourceDestination.getValue().toString());
              int maxindex = tblSourceDestination.size();
              SQLContainer s = (SQLContainer) tblSourceDestination.getContainerDataSource();
              // Item x=s.getItem(tblSourceDestination.getValue());
              if (!(tblSourceDestination.getValue().equals(tblSourceDestination.lastItemId()))) {
                int index = s.indexOfId(tblSourceDestination.getValue());
                index++;
                tblSourceDestination.setValue(s.getIdByIndex(index));
                try {
                  Object rowId2 = tblSourceDestination.getValue();
                  Property sourceProperty =
                      tblSourceDestination.getContainerProperty(rowId2, "sourceURI");
                  Property destinationProperty =
                      tblSourceDestination.getContainerProperty(rowId2, "destinationURI");

                  source.setValue(sourceProperty.toString());
                  destination.setValue(destinationProperty.toString());
                  tblSourcePropertiesParam.removeAllItems();
                  tblDestinationPropertiesParam.removeAllItems();

                  Notification loadURI = new Notification("");
                  loadURI.show("Links' URIs are successfully loaded ");
                  if (chkAutomaticPropertiesLoad.getValue()) // the automatic buton i schecked
                  {
                    // load the properties automatically
                    String sourceEndpoint = "", destinationEndpoint = "";
                    sourceEndpoint = cmbSourceEndpoint.getItemCaption(cmbSourceEndpoint.getValue());
                    destinationEndpoint =
                        cmbDestinationEndpoint.getItemCaption(cmbDestinationEndpoint.getValue());
                    try {
                      String sparqlQuery = source.getValue();
                      getURIProperties(sparqlQuery, sourceEndpoint, tblSourcePropertiesMapping);
                      sparqlQuery = destination.getValue();
                      getURIProperties(
                          sparqlQuery, destinationEndpoint, tblDestinationPropertiesMapping);
                    } catch (Exception e) {
                      Notification.show("ERROR Not Properties queried");
                    }
                    lStartTime = System.currentTimeMillis();
                    // start time for next one
                  }
                } catch (Exception e) {
                  Notification error = new Notification("Error");
                  error.show("You did not select an item in the links table");
                }
              }
            } catch (Exception e) {
              Notification.show(e.getMessage());
            }
          }
        });
    btnGetProperties.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            String sourceEndpoint = "", destinationEndpoint = "";
            sourceEndpoint = cmbSourceEndpoint.getItemCaption(cmbSourceEndpoint.getValue());
            destinationEndpoint =
                cmbDestinationEndpoint.getItemCaption(cmbDestinationEndpoint.getValue());
            lStartTime = System.currentTimeMillis();

            try {
              String sparqlQuery = source.getValue();
              getURIProperties(sparqlQuery, sourceEndpoint, tblSourcePropertiesMapping);
              sparqlQuery = destination.getValue();
              getURIProperties(sparqlQuery, destinationEndpoint, tblDestinationPropertiesMapping);
            } catch (Exception e) {
              Notification.show(
                  "ERROR while sparqling the endpoint for resources' properties (Are they selected/loaded ?)");
            }
            // cachingForTriples(tblSourceDestination, sourceEndpoint);
          }
        });

    lstSuggestedProperties.addValueChangeListener(
        new ValueChangeListener() {
          @Override
          public void valueChange(final ValueChangeEvent event) {
            final String valueString = String.valueOf(event.getProperty().getValue());
            // Notification.show(valueString);
            List<Object> Ids = new ArrayList<Object>();
            Object first = null;
            for (Iterator i = tblSourcePropertiesMapping.getItemIds().iterator(); i.hasNext(); ) {
              // Get the current item identifier, which is an integer.
              first = i.next();
              int iid = (Integer) first;
              String other =
                  tblSourcePropertiesMapping.getItem(iid).getItemProperty("Property").toString();
              // Notification.show(other);
              if (other.equals(valueString)) // if(other.equals(property))
              {
                Ids.add(iid);
                break;
              }
            }
            tblSourcePropertiesMapping.setImmediate(true);
            tblSourcePropertiesMapping.setValue(Ids);
            tblDestinationPropertiesMapping.setCurrentPageFirstItemId(first);
          }
        });

    tblSourcePropertiesMapping.addItemClickListener(
        new ItemClickEvent.ItemClickListener() {

          @Override
          public void itemClick(ItemClickEvent event) {
            String property =
                tblSourcePropertiesMapping
                    .getContainerProperty(event.getItemId(), event.getPropertyId())
                    .toString();
            List<String> res = getRelatedProperties(property);

            if (res == null) {
              Notification.show("No related Properties");
              return;
            }
            boolean Found = false;
            List<Object> Ids = new ArrayList<Object>();
            Object first = null;
            int x = 0;
            for (String relatedProperty : res) {
              for (Iterator i = tblDestinationPropertiesMapping.getItemIds().iterator();
                  i.hasNext(); ) {
                // Get the current item identifier, which is an integer.
                Object theId = i.next();
                int iid = (Integer) theId;
                String other =
                    tblDestinationPropertiesMapping
                        .getItem(iid)
                        .getItemProperty(event.getPropertyId())
                        .toString();

                if (other.equals(relatedProperty)) // if(other.equals(property))
                {
                  Ids.add(iid);
                  if (x == 0) {
                    first = theId;
                    x = 1;
                  }
                  Found = true;
                }
              }
            }
            if (!Found)
              Notification.show(
                  "Related property is not Found in destination table try manual search");
            else {
              Notification.show("Found in destination table");
              tblDestinationPropertiesMapping.setValue(Ids);
              tblDestinationPropertiesMapping.setCurrentPageFirstItemId(first);
            }
          }
        });
    // add component to the layout specifying its position on the layout

    layout.addComponent(btnCorrect, "left: " + leftStart + "px; top: " + (topStart + 450) + "px;");
    layout.addComponent(
        btnIncorrect, "left: " + (leftStart + space) + "px; top: " + (topStart + 450) + "px;");
    layout.addComponent(
        btnUnsure, "left: " + (leftStart + 2 * space) + "px; top: " + (topStart + 450) + "px;");
    layout.addComponent(
        btnGetProperties,
        "left: " + (leftStart + 3 * space + 50) + "px; top: " + (topStart + 450) + "px;");
    layout.addComponent(
        chkAutomaticPropertiesLoad,
        "left: " + (leftStart + 3 * space + 250) + "px; top: " + (topStart + 450) + "px;");

    /*layout.addComponent(sourceURI,"left: "+(leftStart-space/2)+"px; top: "+(topStart+space/2)+"px;");
    layout.addComponent(destinationURI,"left: "+(leftStart+2*space)+"px; top: "+(topStart+space/2)+"px;");*/

    layout.addComponent(source, "left: 30px; top: " + (topStart + space / 2) + "px;");
    layout.addComponent(
        destination,
        "left: " + (leftStart + 3 * space + 200) + "px; top: " + (topStart + space / 2) + "px;");

    layout.addComponent(cmbSourceEndpoint, "left: 50px; top: " + (topStart + 20) + "px;");
    layout.addComponent(
        cmbDestinationEndpoint,
        "left: " + (leftStart + 3 * space + 200) + "px; top: " + (topStart + 20) + "px;");
    layout.addComponent(
        lstSuggestedProperties,
        "left: " + (leftStart + 100) + "px; top: " + (topStart + 20) + "px;");

    layout.addComponent(
        tblSourcePropertiesMapping, "left: 10px; top: " + (topStart + space) + "px;");
    layout.addComponent(
        tblDestinationPropertiesMapping,
        "left: " + (leftStart + 3 * space + 200) + "px; top: " + (topStart + space) + "px;");

    pnlURIsProperties.setContent(layout);

    return pnlURIsProperties;
  }
Beispiel #17
0
  @AutoGenerated
  private AbsoluteLayout buildGeneralLayout() {
    // common part: create layout
    generalLayout = new AbsoluteLayout();
    generalLayout.setImmediate(false);
    generalLayout.setWidth("100.0%");
    generalLayout.setHeight("100.0%");
    generalLayout.setMargin(false);

    // photoField
    photoField = new ImageField();
    photoField.setImmediate(false);
    photoField.setWidth("420px");
    photoField.setHeight("140px");
    generalLayout.addComponent(photoField, "top:20.0px;left:10.0px;");

    // vatField
    vatField = new TextField();
    vatField.setCaption("CIF/NIF");
    vatField.setImmediate(false);
    vatField.setWidth("120px");
    vatField.setHeight("-1px");
    generalLayout.addComponent(vatField, "top:16.0px;left:435.0px;");

    // clientTypeField
    clientTypeField = new ComboBox();
    clientTypeField.setCaption("Tipo");
    clientTypeField.setImmediate(false);
    clientTypeField.setDescription("Tipo Cliente");
    clientTypeField.setWidth("-1px");
    clientTypeField.setHeight("-1px");
    clientTypeField.setRequired(true);
    generalLayout.addComponent(clientTypeField, "top:54.0px;left:435.0px;");

    // clientGroupField
    clientGroupField = new ComboBox();
    clientGroupField.setCaption("Grupo");
    clientGroupField.setImmediate(false);
    clientGroupField.setWidth("-1px");
    clientGroupField.setHeight("-1px");
    clientGroupField.setRequired(true);
    generalLayout.addComponent(clientGroupField, "top:92.0px;left:435.0px;");

    // phoneField
    phoneField = new TextField();
    phoneField.setCaption("Teléfono 01");
    phoneField.setImmediate(false);
    phoneField.setWidth("115px");
    phoneField.setHeight("-1px");
    generalLayout.addComponent(phoneField, "top:16.0px;left:653.0px;");

    // faxField
    faxField = new TextField();
    faxField.setCaption("Fax");
    faxField.setImmediate(false);
    faxField.setWidth("115px");
    faxField.setHeight("-1px");
    generalLayout.addComponent(faxField, "top:54.0px;left:779.0px;");

    // facebookIdField
    facebookIdField = new TextField();
    facebookIdField.setCaption("Facebook Id");
    facebookIdField.setImmediate(false);
    facebookIdField.setWidth("242px");
    facebookIdField.setHeight("24px");
    generalLayout.addComponent(facebookIdField, "top:90.0px;left:653.0px;");

    // mobileField
    mobileField = new TextField();
    mobileField.setCaption("Teléfono 02");
    mobileField.setImmediate(false);
    mobileField.setWidth("115px");
    mobileField.setHeight("-1px");
    generalLayout.addComponent(mobileField, "top:16.0px;left:780.0px;");

    // descriptionField
    descriptionField = new TextField();
    descriptionField.setCaption("Descripción");
    descriptionField.setImmediate(false);
    descriptionField.setWidth("460px");
    descriptionField.setHeight("-1px");
    generalLayout.addComponent(descriptionField, "top:132.0px;left:435.0px;");

    // commentField
    commentField = new TextArea();
    commentField.setCaption("Comentarios");
    commentField.setImmediate(false);
    commentField.setWidth("885px");
    commentField.setHeight("70px");
    generalLayout.addComponent(commentField, "top:206.0px;left:11.0px;");

    // emailField
    emailField = new TextField();
    emailField.setCaption("Email");
    emailField.setImmediate(false);
    emailField.setWidth("460px");
    emailField.setHeight("-1px");
    generalLayout.addComponent(emailField, "top:172.0px;left:435.0px;");

    return generalLayout;
  }
Beispiel #18
0
  @AutoGenerated
  private AbsoluteLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new AbsoluteLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth("560px");
    mainLayout.setHeight("280px");
    mainLayout.setMargin(true);

    // top-level component properties
    setWidth("560px");
    setHeight("280px");

    // commentField
    commentField = new TextField();
    commentField.setCaption("Comentario");
    commentField.setImmediate(false);
    commentField.setWidth("520px");
    commentField.setHeight("120px");
    commentField.setTabIndex(9);
    mainLayout.addComponent(commentField, "top:140.0px;left:20.0px;");

    // kmField
    kmField = new TextField();
    kmField.setCaption("Km");
    kmField.setImmediate(false);
    kmField.setWidth("80px");
    kmField.setHeight("-1px");
    kmField.setTabIndex(7);
    mainLayout.addComponent(kmField, "top:98.0px;left:260.0px;");

    // punctureField
    punctureField = new TextField();
    punctureField.setCaption("Pinchazos");
    punctureField.setImmediate(false);
    punctureField.setWidth("140px");
    punctureField.setHeight("-1px");
    punctureField.setTabIndex(5);
    mainLayout.addComponent(punctureField, "top:56.0px;left:400.0px;");

    // serialNumberField
    serialNumberField = new TextField();
    serialNumberField.setCaption("Número  de serie");
    serialNumberField.setImmediate(false);
    serialNumberField.setWidth("160px");
    serialNumberField.setHeight("-1px");
    serialNumberField.setTabIndex(1);
    serialNumberField.setRequired(true);
    mainLayout.addComponent(serialNumberField, "top:17.0px;left:20.0px;");

    // vehicleLocationField
    vehicleLocationField = new TextField();
    vehicleLocationField.setCaption("Ubicación vehículo");
    vehicleLocationField.setImmediate(false);
    vehicleLocationField.setWidth("120px");
    vehicleLocationField.setHeight("-1px");
    vehicleLocationField.setTabIndex(4);
    mainLayout.addComponent(vehicleLocationField, "top:56.0px;left:260.0px;");

    // supplierField
    supplierField = new ComboBox();
    supplierField.setCaption("Proveedor");
    supplierField.setImmediate(false);
    supplierField.setWidth("220px");
    supplierField.setHeight("-1px");
    supplierField.setTabIndex(6);
    mainLayout.addComponent(supplierField, "top:100.0px;left:20.0px;");

    // tireTypeField
    tireTypeField = new ComboBox();
    tireTypeField.setCaption("Tipo neumático");
    tireTypeField.setImmediate(false);
    tireTypeField.setWidth("168px");
    tireTypeField.setHeight("-1px");
    tireTypeField.setTabIndex(8);
    tireTypeField.setRequired(true);
    mainLayout.addComponent(tireTypeField, "top:97.0px;left:372.0px;");

    // vehicleField
    vehicleField = new ComboBox();
    vehicleField.setCaption("Vehículo");
    vehicleField.setImmediate(false);
    vehicleField.setWidth("220px");
    vehicleField.setHeight("-1px");
    vehicleField.setTabIndex(3);
    vehicleField.setRequired(true);
    mainLayout.addComponent(vehicleField, "top:56.0px;left:20.0px;");

    // tireStatusField
    tireStatusField = new ComboBox();
    tireStatusField.setCaption("Estado neumático");
    tireStatusField.setImmediate(false);
    tireStatusField.setWidth("168px");
    tireStatusField.setHeight("-1px");
    tireStatusField.setTabIndex(2);
    tireStatusField.setRequired(true);
    mainLayout.addComponent(tireStatusField, "top:17.0px;left:372.0px;");

    return mainLayout;
  }
  @SuppressWarnings("serial")
  @Override
  public void initGui() {
    addStyleName("m-cursor-pointer");
    if (bckgrndResource != null) {
      Embedded bkgnd = new Embedded(null, bckgrndResource);
      addComponent(bkgnd, "top:0px;left:0px");
    }
    final MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals();
    ct = CardType.getTL(ctId);
    String textColorStyle = CardStyler.getCardTextColorOverBaseStyle(ct);

    // nested abslay for the click handler
    AbsoluteLayout topHalfLay = new AbsoluteLayout();
    topHalfLay.setWidth(CARDLISTHEADER_W);
    topHalfLay.setHeight(HEIGHT_NODRAWER);
    addComponent(topHalfLay, "top:0px;left:0px");

    title.setValue(ct.getTitle()); // .toUpperCase());
    title.setHeight(CARDLISTHEADER_TITLE_H);
    title.setWidth(CARDLISTHEADER_TITLE_W);
    title.addStyleName("m-cardsummarylist-header-title");
    title.addStyleName("m-cursor-pointer");
    title.addStyleName("m-vagabond-font");
    if (textColorStyle != null) title.addStyleName(textColorStyle);

    topHalfLay.addComponent(title, CARDLISTHEADER_TITLE_POS);

    content.setValue(ct.getPrompt());
    content.setHeight(CARDLISTHEADER_CONTENT_H);
    content.setWidth(CARDLISTHEADER_CONTENT_W);
    content.addStyleName("m-cardsummarylist-header-content");
    content.addStyleName("m-cursor-pointer");
    if (textColorStyle != null) content.addStyleName(textColorStyle);
    // cause exception w/ 2 windows?

    content.setId(CardDebug.getCardCreateClickDebugId(ct));
    topHalfLay.addComponent(content, CARDLISTHEADER_CONTENT_POS);

    boolean cantCreateBecauseHiddenParent = checkNoCreateBecauseHiddenTL(parent);
    boolean cantCreateBecauseParentMarkedNoChild =
        false; // todo enable with gameswitch checkNoCreateBecauseParentMarkedNoChild(parent);

    if (globs.canCreateCard(ct.isIdeaCard())) {
      markedAsNoCreate = false;
      if (!cantCreateBecauseHiddenParent && !cantCreateBecauseParentMarkedNoChild) {
        // Add the text at the bottom
        Label lab;
        topHalfLay.addComponent(lab = new Label("click to add new"), "top:130px;left:75px");
        lab.addStyleName("m-click-to-add-new");
        if (textColorStyle != null) lab.addStyleName(textColorStyle);
      }
    } else markedAsNoCreate = true;

    drawerComponent = new BuilderDrawer();
    addComponent(drawerComponent, CARDLISTHEADER_DRAWER_POS);
    drawerComponent.setVisible(false);

    setWidth(CARDLISTHEADER_W);
    setHeight(HEIGHT_NODRAWER);

    if (!mockupOnly)
      topHalfLay.addLayoutClickListener(
          new LayoutClickListener() {
            @Override
            @MmowgliCodeEntry
            @HibernateOpened
            @HibernateClosed
            public void layoutClick(LayoutClickEvent event) {
              HSess.init();
              if (checkNoCreateBecauseHiddenTL(
                  parent)) { // todo enable with game switch ||
                             // checkNoCreateBecauseParentMarkedNoChild(parent)) {
                if (drawerComponent.isVisible()) closeDrawer();
                HSess.close();
                return;
              }

              if (drawerComponent.isVisible()) closeDrawer();
              else {
                CardPermission cp = globs.cardPermissionsCommon(ct.isIdeaCard());
                if (!cp.canCreate) {
                  if (!markedAsNoCreate) handleNoCreate();
                  Notification.show(cp.whyNot);
                } else {
                  showDrawer();
                  handleCanCreate(); // reset tt, etc.
                  if (newCardListener != null) newCardListener.drawerOpenedTL(ctId);
                }
              }
              HSess.close();
            }
          });
    if (cantCreateBecauseHiddenParent) handleNoCreate("Can't add card to hidden parent");
    else if (cantCreateBecauseParentMarkedNoChild)
      handleNoCreate("New child cards cannot be added to this card");
    else if (!globs.canCreateCard(ct.isIdeaCard())) handleNoCreate();
    else setTooltip("Click to add card");
  }
  @AutoGenerated
  private AbsoluteLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new AbsoluteLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth("580px");
    mainLayout.setHeight("360px");
    mainLayout.setMargin(true);

    // top-level component properties
    setWidth("580px");
    setHeight("360px");

    // descriptionField
    descriptionField = new TextField();
    descriptionField.setCaption("Descripción");
    descriptionField.setImmediate(false);
    descriptionField.setWidth("380px");
    descriptionField.setHeight("-1px");
    mainLayout.addComponent(descriptionField, "top:112.0px;left:180.0px;");

    // idField
    idField = new TextField();
    idField.setCaption("Id");
    idField.setImmediate(false);
    idField.setWidth("400px");
    idField.setHeight("-1px");
    idField.setRequired(true);
    mainLayout.addComponent(idField, "top:20.0px;left:20.0px;");

    // nameField
    nameField = new TextField();
    nameField.setCaption("Nombre");
    nameField.setImmediate(false);
    nameField.setWidth("140px");
    nameField.setHeight("-1px");
    nameField.setRequired(true);
    mainLayout.addComponent(nameField, "top:112.0px;left:20.0px;");

    // packageNameField
    packageNameField = new TextField();
    packageNameField.setCaption("Paquete");
    packageNameField.setImmediate(false);
    packageNameField.setWidth("400px");
    packageNameField.setHeight("-1px");
    packageNameField.setRequired(true);
    mainLayout.addComponent(packageNameField, "top:64.0px;left:20.0px;");

    // versionField
    versionField = new TextField();
    versionField.setCaption("Versión");
    versionField.setImmediate(false);
    versionField.setWidth("120px");
    versionField.setHeight("-1px");
    versionField.setRequired(true);
    mainLayout.addComponent(versionField, "top:64.0px;left:440.0px;");

    // activeField
    activeField = new CheckBox();
    activeField.setCaption("Activo");
    activeField.setImmediate(false);
    activeField.setWidth("-1px");
    activeField.setHeight("-1px");
    activeField.setRequired(true);
    mainLayout.addComponent(activeField, "top:20.0px;left:507.0px;");

    // fileField
    fileField = new FileField();
    fileField.setImmediate(false);
    fileField.setWidth("540px");
    fileField.setHeight("-1px");
    mainLayout.addComponent(fileField, "top:160.0px;left:20.0px;");

    // errorMessageField
    errorMessageField = new TextArea();
    errorMessageField.setCaption("Mensaje Error");
    errorMessageField.setImmediate(false);
    errorMessageField.setWidth("540px");
    errorMessageField.setHeight("120px");
    mainLayout.addComponent(errorMessageField, "top:220.0px;left:20.0px;");

    return mainLayout;
  }
Beispiel #21
0
  @AutoGenerated
  private AbsoluteLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new AbsoluteLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth("650px");
    mainLayout.setHeight("220px");
    mainLayout.setMargin(true);

    // top-level component properties
    setWidth("650px");
    setHeight("220px");

    // jobGroupField
    jobGroupField = new TextField();
    jobGroupField.setCaption("Grupo");
    jobGroupField.setImmediate(false);
    jobGroupField.setWidth("140px");
    jobGroupField.setHeight("-1px");
    jobGroupField.setRequired(true);
    mainLayout.addComponent(jobGroupField, "top:20.0px;left:180.0px;");

    // jobIntervalField
    jobIntervalField = new TextField();
    jobIntervalField.setCaption("Intervalo");
    jobIntervalField.setImmediate(false);
    jobIntervalField.setWidth("60px");
    jobIntervalField.setHeight("-1px");
    mainLayout.addComponent(jobIntervalField, "top:180.0px;left:20.0px;");

    // jobNameField
    jobNameField = new TextField();
    jobNameField.setCaption("Nombre");
    jobNameField.setImmediate(false);
    jobNameField.setWidth("140px");
    jobNameField.setHeight("-1px");
    jobNameField.setRequired(true);
    mainLayout.addComponent(jobNameField, "top:20.0px;left:20.0px;");

    // jobTriggerPriorityField
    jobTriggerPriorityField = new TextField();
    jobTriggerPriorityField.setCaption("Job Trigger Priority");
    jobTriggerPriorityField.setImmediate(false);
    jobTriggerPriorityField.setWidth("160px");
    jobTriggerPriorityField.setHeight("-1px");
    mainLayout.addComponent(jobTriggerPriorityField, "top:140.0px;left:200.0px;");

    // jobTriggerTypeField
    jobTriggerTypeField = new ComboBox();
    jobTriggerTypeField.setCaption("Tipo Disparador");
    jobTriggerTypeField.setImmediate(true);
    jobTriggerTypeField.setWidth("160px");
    jobTriggerTypeField.setHeight("-1px");
    jobTriggerTypeField.setRequired(true);
    mainLayout.addComponent(jobTriggerTypeField, "top:140.0px;left:20.0px;");

    // cronExpressionField
    cronExpressionField = new TextField();
    cronExpressionField.setCaption("Expresión Cron ");
    cronExpressionField.setImmediate(false);
    cronExpressionField.setWidth("340px");
    cronExpressionField.setHeight("-1px");
    mainLayout.addComponent(cronExpressionField, "top:180.0px;left:20.0px;");

    // descriptionField
    descriptionField = new TextField();
    descriptionField.setCaption("Descripción");
    descriptionField.setImmediate(false);
    descriptionField.setWidth("620px");
    descriptionField.setHeight("-1px");
    mainLayout.addComponent(descriptionField, "top:100.0px;left:20.0px;");

    // endTimeField
    endTimeField = new DateField();
    endTimeField.setCaption("Fecha Finalización");
    endTimeField.setImmediate(false);
    endTimeField.setWidth("-1px");
    endTimeField.setHeight("-1px");
    endTimeField.setInvalidAllowed(false);
    mainLayout.addComponent(endTimeField, "top:60.0px;left:225.0px;");

    // futureField
    futureField = new CheckBox();
    futureField.setCaption("Futuro");
    futureField.setImmediate(false);
    futureField.setWidth("-1px");
    futureField.setHeight("-1px");
    mainLayout.addComponent(futureField, "top:140.0px;left:585.0px;");

    // future_timeField
    future_timeField = new TextField();
    future_timeField.setCaption("Future_time");
    future_timeField.setImmediate(false);
    future_timeField.setWidth("160px");
    future_timeField.setHeight("-1px");
    mainLayout.addComponent(future_timeField, "top:140.0px;left:400.0px;");

    // repeatCountField
    repeatCountField = new TextField();
    repeatCountField.setCaption("Repeticiones");
    repeatCountField.setImmediate(false);
    repeatCountField.setWidth("60px");
    repeatCountField.setHeight("24px");
    mainLayout.addComponent(repeatCountField, "top:180.0px;right:290.0px;");

    // startTimeField
    startTimeField = new DateField();
    startTimeField.setCaption("Fecha Comienzo");
    startTimeField.setImmediate(false);
    startTimeField.setWidth("-1px");
    startTimeField.setHeight("-1px");
    startTimeField.setInvalidAllowed(false);
    mainLayout.addComponent(startTimeField, "top:60.0px;left:20.0px;");

    // areaField
    areaField = new ComboBox();
    areaField.setCaption("Area Trabajo");
    areaField.setImmediate(false);
    areaField.setWidth("-1px");
    areaField.setHeight("-1px");
    areaField.setRequired(true);
    mainLayout.addComponent(areaField, "top:60.0px;left:420.0px;");

    // jobCalendarField
    jobCalendarField = new JobTriggerCalendarField();
    jobCalendarField.setImmediate(false);
    jobCalendarField.setWidth("-1px");
    jobCalendarField.setHeight("-1px");
    mainLayout.addComponent(jobCalendarField, "top:167.0px;left:397.0px;");

    // jobIntervalTypeField
    jobIntervalTypeField = new ComboBox();
    jobIntervalTypeField.setCaption("Tipo Intervalo");
    jobIntervalTypeField.setImmediate(false);
    jobIntervalTypeField.setWidth("175px");
    jobIntervalTypeField.setHeight("-1px");
    mainLayout.addComponent(jobIntervalTypeField, "top:180.0px;left:100.0px;");

    return mainLayout;
  }
  public HorizontalLayout getComponent() {
    uploadA = null;
    uploadB = null;

    setSpacing(true);

    AbsoluteLayout innerUploadSection = new AbsoluteLayout();
    innerUploadSection.setWidth("450px");
    innerUploadSection.setHeight("615px");

    VerticalLayout innerCompareSection = new VerticalLayout();
    innerCompareSection.setHeight("100%");
    innerCompareSection.setWidth("45%");

    compareButton = new Button(BTN_TXT_COMPARE);
    compareButton.setHtmlContentAllowed(true);
    compareButton.addStyleName("v-bigbutton");
    compareButton.setEnabled(false);
    compareButton.setDebugId(BTN_COMPARE_ID);

    compareButton.addListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(Button.ClickEvent event) {
            if (DifferApplication.getGATracker() != null) {
              DifferApplication.getGATracker().trackPageview("/compare");
            }
            try {
              cz.nkp.differ.model.Image[] selectedImages = null;
              if (uploadA == null || uploadB == null) {
                selectedImages = new cz.nkp.differ.model.Image[1];
              } else {
                selectedImages = new cz.nkp.differ.model.Image[2];
              }
              int indx = 0;

              // uploadA
              if (uploadA != null) {
                selectedImages[indx] = new cz.nkp.differ.model.Image();
                selectedImages[indx].setFile(uploadA);
                selectedImages[indx].setFileName(uploadA.getName());
                selectedImages[indx].setUniqueName(uploadA.getName());
                selectedImages[indx].setId((long) indx);
                selectedImages[indx].setShared(false);
                selectedImages[indx].setOwnerId(-1L);
                selectedImages[indx].setSize((int) uploadA.length());
                indx++;
              }

              // uploadB
              if (uploadB != null) {
                selectedImages[indx] = new cz.nkp.differ.model.Image();
                selectedImages[indx].setFile(uploadB);
                selectedImages[indx].setFileName(uploadB.getName());
                selectedImages[indx].setUniqueName(uploadB.getName());
                selectedImages[indx].setId((long) indx);
                selectedImages[indx].setShared(false);
                selectedImages[indx].setOwnerId(-1L);
                selectedImages[indx].setSize((int) uploadB.length());
              }

              HorizontalLayout layout = new HorizontalLayout();
              CompareComponent cp = new CompareComponent(parent.getWindow());
              parent.setCustomView(layout);
              layout.addComponent(
                  new ProgressBarComponent(
                      parent, DifferApplication.getCurrentApplication(), cp, selectedImages));
            } catch (Exception ex) {
              ex.printStackTrace();
            }
          }
        });

    Button resetButton = new Button("Reset");
    resetButton.addStyleName("v-longbutton");
    resetButton.addListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(Button.ClickEvent event) {
            internal_this.removeAllComponents();
            internal_this.getComponent();
          }
        });
    resetButton.setDebugId(BTN_RESET_ID);

    Button jp2ProfileButton = new Button("profile");
    jp2ProfileButton.addStyleName("v-longbutton");
    jp2ProfileButton.addListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(Button.ClickEvent event) {
            JP2ProfileWindow window = new JP2ProfileWindow();
            DifferApplication.getMainApplicationWindow().addWindow(window);
          }
        });

    innerUploadSection.addComponent(addFileUploadComponent(0), "left: 10px; top: 10px;");
    innerUploadSection.addComponent(addFileUploadComponent(1), "left: 10px; top: 250px;");

    Label lbl =
        new Label(
            "<b>Supported file types:</b> JPEG/JFIF (jpe, jpg, jpeg), JPEG2000 (jp2, jpf, jpx),"
                + "TIFF (tif, tiff), DjVu, sDjVu (djv, djvu), PNG, (png), PDF (pdf), FITS (fits, fit, fts)<br><br>"
                + "<b>File size limits:</b> Anonymous users - 5MB, Registered users - 15MB.<br>"
                + "Registered users may store up to 100MB of images.<br><br>"
                + "<i>You are currently using DIFFER anonymously.</i>",
            Label.CONTENT_XHTML);

    innerUploadSection.addComponent(lbl, "left: 10px; top: 470px;");
    innerCompareSection.addComponent(compareButton);
    innerCompareSection.addComponent(resetButton);
    innerCompareSection.addComponent(jp2ProfileButton);
    innerCompareSection.setComponentAlignment(compareButton, Alignment.BOTTOM_CENTER);
    innerCompareSection.setComponentAlignment(resetButton, Alignment.TOP_CENTER);
    innerCompareSection.setComponentAlignment(jp2ProfileButton, Alignment.TOP_CENTER);

    addComponent(innerUploadSection);
    addComponent(innerCompareSection);

    return this;
  }
Beispiel #23
0
  private AbsoluteLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new AbsoluteLayout();
    mainLayout.setImmediate(true);
    mainLayout.setWidth("160px");
    mainLayout.setHeight("69px");
    mainLayout.setMargin(false);

    // top-level component properties
    setWidth("160px");
    setHeight("69px");

    // currSelection
    currSelection = new Label();
    currSelection.setImmediate(true);
    currSelection.setWidth("2px");
    currSelection.setHeight("2px");
    currSelection.setValue("");
    currSelection.setContentMode(3);
    mainLayout.addComponent(currSelection, "top:40.0px;left:6.0px;");

    // nextOptionAbove
    nextOptionAbove = new TextField();
    nextOptionAbove.addStyleName("borderless");
    nextOptionAbove.setEnabled(false);
    nextOptionAbove.setImmediate(true);
    nextOptionAbove.setWidth("-1px");
    nextOptionAbove.setHeight("-1px");
    mainLayout.addComponent(nextOptionAbove, "top:0.0px;left:3.0px;");

    // nextOptionBelow
    nextOptionBelow = new TextField();
    nextOptionBelow.addStyleName("borderless");
    nextOptionBelow.setEnabled(false);
    nextOptionBelow.setImmediate(true);
    nextOptionBelow.setWidth("-1px");
    nextOptionBelow.setHeight("-1px");
    mainLayout.addComponent(nextOptionBelow, "top:40.0px;left:3.0px;");

    // upButton
    upButton = new Button();
    upButton.setCaption("");
    upButton.setStyleName(BaseTheme.BUTTON_LINK);
    upButton.setImmediate(true);
    upButton.setWidth("16px");
    upButton.setHeight("16px");
    upButton.setIcon(ARROW_UP);
    upButton.addListener(this);
    upButton.setData(BUTTON_UP);
    mainLayout.addComponent(upButton, "top:11.0px;left:139.0px;");

    // downButton
    downButton = new Button();
    downButton.setCaption("");
    downButton.setStyleName(BaseTheme.BUTTON_LINK);
    downButton.setImmediate(true);
    downButton.setWidth("16px");
    downButton.setHeight("16px");
    downButton.setIcon(ARROW_DOWN);
    downButton.addListener(this);
    downButton.setData(BUTTON_DOWN);
    mainLayout.addComponent(downButton, "top:39.0px;left:139.0px;");

    return mainLayout;
  }
 private void mostrarFormAvances() {
   btnCancel.setVisible(true);
   absLAvance.setVisible(true);
   absLAvanceRecesion.setHeight("320px");
 }