Ejemplo n.º 1
0
  @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 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;
  }
Ejemplo n.º 3
0
  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");
  }
Ejemplo n.º 4
0
  @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;
  }
Ejemplo n.º 5
0
  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);
  }
Ejemplo n.º 6
0
    private FolderView(Folder f) {
      super(new AbsoluteLayout());
      l = (AbsoluteLayout) getCompositionRoot();
      setSizeFull();
      l.setSizeFull();
      folder = f;

      setDropHandler(this);
    }
  @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;
  }
Ejemplo n.º 8
0
  @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;
  }
Ejemplo n.º 9
0
 @Override
 public void buttonClick(ClickEvent event) {
   if (absLAvance.isVisible()) {
     if (validarAvance()) {
       if (btnAdd.getCaption().equals("Agregar")) listaAvance.add(getRow());
       else listaAvance.set(Integer.parseInt(txtNoAvance.getValue()) - 1, getRow());
       recargarListaAvance();
       limpiarAvance();
     }
   } else mostrarFormAvances();
 }
Ejemplo n.º 10
0
  @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;
  }
  @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;
  }
Ejemplo n.º 12
0
  @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;
  }
Ejemplo n.º 13
0
  @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;
  }
Ejemplo n.º 14
0
    @SuppressWarnings("static-access")
    void reload() {
      Collection<?> children =
          folder == null
              ? DDTest6.get().tree1.rootItemIds()
              : DDTest6.get().tree1.getChildren(folder);
      if (children == null) {
        l.removeAllComponents();
        return;
      } else {
        // make modifiable
        children = new HashSet<Object>(children);
      }
      Set<Component> removed = new HashSet<Component>();
      for (Iterator<Component> componentIterator = l.getComponentIterator();
          componentIterator.hasNext(); ) {
        FileIcon next = (FileIcon) componentIterator.next();
        if (!children.contains(next.file)) {
          removed.add(next);
        } else {
          children.remove(next.file);
        }
      }

      for (Component component : removed) {
        l.removeComponent(component);
      }

      for (Object object : children) {
        FileIcon fileIcon = new FileIcon((File) object);
        l.addComponent(fileIcon);
        ComponentPosition position = l.getPosition(fileIcon);
        position.setTop(Float.valueOf((y++ / 5) % 5 * 100), UNITS_PIXELS);
        position.setLeft(Float.valueOf(x++ % 5 * 100), UNITS_PIXELS);
      }
    }
Ejemplo n.º 15
0
  @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;
  }
Ejemplo n.º 16
0
  @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;
  }
Ejemplo n.º 17
0
  @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;
  }
Ejemplo n.º 18
0
  @Override
  public void drop(DragAndDropEvent event) {

    WrapperTargetDetails ed = (WrapperTargetDetails) event.getTargetDetails();
    Transferable ctr = event.getTransferable();
    // use "component" (from DragDropPane) if available, else take
    // the source component
    Component component = null;
    if (ctr instanceof WrapperTransferable) {
      component = ((WrapperTransferable) ctr).getDraggedComponent();
    } else if (ctr instanceof DataBoundTransferable) {
      // Item has been dragged, construct a Label from
      // Item id
      Label l = new Label();
      l.setSizeUndefined();
      l.setValue("ItemId : " + ((DataBoundTransferable) ctr).getItemId());
      component = l;
    }

    if (component != null) {

      if (component.getParent() != root) {

        root.addComponent(component);

        Integer left = ed.getAbsoluteLeft();
        Integer top = ed.getAbsoluteTop();

        MouseEventDetails eventDetails = ed.getMouseEvent();

        int clientX = eventDetails.getClientX();
        int clientY = eventDetails.getClientY();

        try {
          root.getPosition(component).setTopValue(Float.valueOf(clientY - top));
          root.getPosition(component).setLeftValue(Float.valueOf(clientX - left));
        } catch (Exception e) {
        }
      } else {
        // drag started and ended inside the this Pane

        MouseEventDetails start =
            ((WrapperTransferable) event.getTransferable()).getMouseDownEvent();
        MouseEventDetails eventDetails = ed.getMouseEvent();

        int deltaX = eventDetails.getClientX() - start.getClientX();
        int deltaY = eventDetails.getClientY() - start.getClientY();

        ComponentPosition p = root.getPosition(component);
        p.setTopValue(p.getTopValue() + deltaY);
        p.setLeftValue(p.getLeftValue() + deltaX);
      }
    } else {
      // drag coming outside of Vaadin

      WrapperTransferable wtr = (WrapperTransferable) ctr;

      String object = wtr.getText();
      // String html = wtr.getHtml();
      // String url = (String) ctr.getData("Url");

      final Label l = new Label();
      l.setCaption("Generated from HTML5 drag:");
      if (object != null) {
        if (object.length() > 80) {
          object = object.substring(0, 79);
        }
        l.setValue(object);
      } else {
        l.setValue("HTML5 dd");
      }

      Html5File[] files = wtr.getFiles();
      if (files != null) {
        for (Html5File html5File : files) {
          l.setCaption(html5File.getFileName());
          html5File.setStreamVariable(
              new StreamVariable() {
                ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();

                @Override
                public OutputStream getOutputStream() {
                  return byteArrayOutputStream;
                }

                @Override
                public boolean listenProgress() {
                  return false;
                }

                @Override
                public void onProgress(StreamingProgressEvent event) {}

                @Override
                public void streamingStarted(StreamingStartEvent event) {}

                @Override
                public void streamingFinished(StreamingEndEvent event) {
                  l.setValue(
                      (new String(byteArrayOutputStream.toByteArray()).substring(0, 80) + "..."));
                }

                @Override
                public void streamingFailed(StreamingErrorEvent event) {}

                @Override
                public boolean isInterrupted() {
                  return false;
                }
              });
        }
      }

      l.setSizeUndefined();

      root.addComponent(l);
    }
    return;
  }
Ejemplo n.º 19
0
 public void addComponent(Component l, String string) {
   root.addComponent(l, string);
 }
Ejemplo n.º 20
0
 public void addComponent(Component c) {
   root.addComponent(c);
 }
Ejemplo n.º 21
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;
  }
Ejemplo n.º 22
0
  @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;
  }
Ejemplo n.º 23
0
  private Panel allLinksDetails() {
    // positioning indices
    // final int leftStart=10,topStart=10, space=100;
    // create the panel that will hold all components
    Panel linksDetails = new Panel("Links Details");
    // set panel's properties
    linksDetails.setWidth("100%");
    linksDetails.setHeight("100%");

    // Create absolute layout specifying its properties
    final AbsoluteLayout layout = new AbsoluteLayout();
    // set layout's properties
    layout.setSizeFull();

    // Create components Objects and specify their properties
    Button btnLoad = new Button("Load task");
    // final Table tblSourceDestination = new Table("Source and Destination URIs");
    tblSourceDestination.setSelectable(true);
    tblSourceDestination.setWidth("90%");
    // fill the Source and Destination URIs table
    SQLContainer container = connectToDB("root", "mofo", userName);
    Notification.show("Welcome " + userName + " you loaded task Nr.: " + task);
    Compare.Equal suburbFilter = new Compare.Equal("taskId", Integer.valueOf(task));
    container.addContainerFilter(suburbFilter);
    // Fill the main (tblSourceDestination) table with resources
    tblSourceDestination.setContainerDataSource(container);
    tblSourceDestinationparam = tblSourceDestination;

    // add component to the layout specifying its position on the layout
    int tableWidth = (int) tblSourceDestination.getWidth();
    layout.addComponent(btnLoad, "left:1500px; top: 10px;");
    layout.addComponent(tblSourceDestination, "left: 10px; top: 20px;");

    linksDetails.setContent(layout);
    // Add EventHandlers for some of the components

    btnLoad.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            // lStartTime= System.currentTimeMillis();

            try {
              Object rowId = tblSourceDestination.getValue();
              Property sourceProperty =
                  tblSourceDestination.getContainerProperty(rowId, "sourceURI");
              Property destinationProperty =
                  tblSourceDestination.getContainerProperty(rowId, "destinationURI");

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

              Notification loadURI = new Notification("");
              loadURI.show("Links' URIs are successfully loaded ");
            } catch (Exception e) {
              Notification error = new Notification("Error");
              error.show("You did not select an item in the links table");
            }
          }
        });

    tblSourceDestination.addItemClickListener(
        new ItemClickEvent.ItemClickListener() {

          @Override
          public void itemClick(ItemClickEvent event) {
            /*lStartTime= System.currentTimeMillis();

            try
            {
            	Object rowId =tblSourceDestination.getValue();
                Property sourceProperty=tblSourceDestination.getContainerProperty(rowId,"sourceURI");
                Property destinationProperty=tblSourceDestination.getContainerProperty(rowId,"destinationURI");

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


                Notification loadURI= new Notification("");
                loadURI.show("Links' URIs are successfully loaded ");
            }
            catch(Exception e)
            {
            	Notification error= new Notification("Error");
            	error.show("You did not select an item in the links table");
            }*/
          }
        });

    return linksDetails;
  }
Ejemplo n.º 24
0
  private Panel designLoginPanel() {

    final Panel loginPanel = new Panel("Login");
    HashMap<String, String> users = null;

    loginPanel.setWidth("100%");
    loginPanel.setHeight("100%");
    // Create absolute layout specifying its properties
    final AbsoluteLayout loginLayout = new AbsoluteLayout();
    loginLayout.setSizeFull();
    // Create components Objects and specify their properties
    int startLeft = 200, startTop = 300;
    try {
      users = getLoginInfo("jdbc:mysql://localhost:3306/", "linkeval", "root", "mofo");
    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    Button btnLogin = new Button("Login");
    final ComboBox cmbUser = new ComboBox("Select your USER ID");
    final ComboBox cmbTask = new ComboBox("Select your TASK");
    cmbUser.setNullSelectionAllowed(false);
    cmbTask.setNullSelectionAllowed(false);
    // Add data
    Iterator it = users.entrySet().iterator();
    while (it.hasNext()) {
      Map.Entry pairs = (Map.Entry) it.next();
      cmbUser.addItem(pairs.getKey());
      cmbUser.setItemCaption(pairs.getKey(), pairs.getValue().toString());
      it.remove(); // avoids a ConcurrentModificationException
    }

    cmbUser.setValue(cmbUser.getItemIds().iterator().next());

    // Listeners

    btnLogin.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            userId =
                String.valueOf(
                    cmbUser
                        .getValue()); // which is his Id in tabel as this combo box shows names as
            // captions and Ids as values
            userName = cmbUser.getItemCaption(userId);
            task = String.valueOf(cmbTask.getValue());
            if (task != "" && userId != "") {
              VerticalSplitPanel vsplit = new VerticalSplitPanel();
              displayedPanel = designMainPanel();
              vsplit.setSecondComponent(displayedPanel);
              vsplit.setFirstComponent(allLinksDetails());
              UI.getCurrent().setContent(vsplit);
            }
          }
        });
    cmbUser.addFocusListener(
        new FocusListener() {

          @Override
          public void focus(FocusEvent event) {
            // TODO Auto-generated method stub
            cmbUser.setValue(cmbUser.getItemIds().iterator().next());
          }
        });
    cmbUser.addValueChangeListener(
        new ValueChangeListener() {
          @Override
          public void valueChange(final ValueChangeEvent event) {
            final String valueString = String.valueOf(event.getProperty().getValue());

            try {
              List<String> tasks =
                  getTasksInfo(
                      "jdbc:mysql://localhost:3306/", "linkeval", "root", "mofo", valueString);

              cmbTask.removeAllItems();
              if (tasks != null) {
                for (String task : tasks) {
                  cmbTask.addItem(task);
                }
                cmbTask.setValue(cmbTask.getItemIds().iterator().next());
              }
            } catch (SQLException e) {
              // TODO Auto-generated catch block
              Notification.show(e.getMessage());
            }
          }
        });

    loginLayout.addComponent(cmbUser, "left: 800px; top: 200px;");
    loginLayout.addComponent(cmbTask, "left: 800px; top: 300px;");
    loginLayout.addComponent(btnLogin, "left: 900px; top: 400px;");

    loginPanel.setContent(loginLayout);

    return loginPanel;
  }
Ejemplo n.º 25
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;
  }
Ejemplo n.º 26
0
 private void mostrarFormAvances() {
   btnCancel.setVisible(true);
   absLAvance.setVisible(true);
   absLAvanceRecesion.setHeight("320px");
 }
Ejemplo n.º 27
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;
  }
Ejemplo n.º 28
0
 @Override
 public void setVisible(boolean visible) {
   super.setVisible(visible);
   if (visible && content.getValue().toString().length() > 0) content.selectAll();
 }
Ejemplo n.º 29
0
  @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");
  }
Ejemplo n.º 30
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;
  }