Exemplo n.º 1
0
 private Component createTextareaPane(CfgValue cfgValue) {
   CfgValueInputCompHolder inputCompHollder = new CfgValueInputCompHolder(cfgValue);
   valueHolders.add(inputCompHollder);
   Vlayout pane = new Vlayout();
   Hlayout hlayout = new Hlayout();
   Button delBtn = createDeleteBtn(cfgValue, pane);
   hlayout.appendChild(createLabel(cfgValue));
   hlayout.appendChild(delBtn);
   if (cfgValue.isElement()) {
     hlayout.appendChild(createCopyElementBtn(cfgValue));
   }
   pane.appendChild(hlayout);
   pane.appendChild(inputCompHollder.getInputComponent());
   return pane;
 }
Exemplo n.º 2
0
  /** Show list tab can export for user selection */
  protected void displayExportTabSelection() {
    initTabInfo();

    exporter = getExporter();
    if (exporter == null) {
      Events.echoEvent("onExporterException", winExportFile, null);
    }

    // clear list checkbox selection to recreate with new reporter
    selectionTabRow.getChildren().clear();
    Vlayout vlayout = new Vlayout();
    selectionTabRow.appendChild(new Space());
    selectionTabRow.appendChild(vlayout);
    vlayout.appendChild(new Label(Msg.getMsg(Env.getCtx(), "SelectTabToExport")));

    chkSelectionTabForExport = new ArrayList<Checkbox>();
    boolean isHasSelectionTab = false;
    boolean isSelectTabDefault = false;
    // with 2Pack, default is export all child tab
    if (exporter.getClass().getName().equals("org.adempiere.pipo2.GridTab2PackExporter")) {
      isSelectTabDefault = true;
    }
    // for to make each export tab with one checkbox
    for (GridTab child : childs) {
      Checkbox chkSelectionTab = new Checkbox();
      chkSelectionTab.setLabel(child.getName());
      // just allow selection tab can export
      if (!exporter.isExportableTab(child)) {
        continue;
      }
      if (child.getTabNo() == indxDetailSelected || isSelectTabDefault) {
        chkSelectionTab.setSelected(true);
      }
      chkSelectionTab.setAttribute("tabBinding", child);
      vlayout.appendChild(chkSelectionTab);
      chkSelectionTabForExport.add(chkSelectionTab);
      isHasSelectionTab = true;
    }

    // in case no child tab can export. clear selection area
    if (isHasSelectionTab == false) {
      selectionTabRow.getChildren().clear();
    }
  }
Exemplo n.º 3
0
  private Component createComboPane(CfgType type) {
    valueHolders = new ArrayList<CfgValueHolder>();
    //
    Vlayout pane = new Vlayout(); // for dialog's parent,can't use Panel
    Hlayout titleLayout = new Hlayout();

    titleLayout.appendChild(embed ? createLabel(cfgValue) : createTitle(cfgValue));
    if (cfgValue.getParent() != null) {
      Button delBtn = createDeleteBtn(cfgValue, pane);
      titleLayout.appendChild(delBtn);
    }
    addBtn = createAddBtn();
    titleLayout.appendChild(addBtn);
    if (cfgValue.isElement()) {
      titleLayout.appendChild(createCopyElementBtn(cfgValue));
    }
    pane.appendChild(titleLayout);
    pane.appendChild(new Space());
    Component body = createBody(type);
    pane.appendChild(body);
    //
    return pane;
  }
Exemplo n.º 4
0
 private Component createBody_struct() {
   buttonPanel = new Vlayout();
   //
   mainPanel = new Vlayout();
   ((Vlayout) mainPanel).setSpacing("0.5em");
   //
   CfgInfo cfgInfo = cfgValue.getCfgInfo();
   for (CfgInfo cCfgInfo : cfgInfo.getPartsInfo()) {
     CfgValue cCfgValue = cfgValue.getValue(cCfgInfo.getId());
     if (cCfgValue == null) {
       Button btn = createAddPartBtn(cCfgInfo);
       buttonPanel.appendChild(btn);
     } else {
       Component partPane = createPane(cCfgValue);
       mainPanel.appendChild(partPane);
     }
   }
   createSaveBtn();
   addBtn.setVisible(!buttonPanel.getChildren().isEmpty());
   return mainPanel;
 }
Exemplo n.º 5
0
  /** execute export action */
  public void export() {
    exporterMap = new HashMap<String, IGridTabExporter>();
    extensionMap = new HashMap<String, String>();
    List<IGridTabExporter> exporterList =
        EquinoxExtensionLocator.instance().list(IGridTabExporter.class).getExtensions();
    for (IGridTabExporter exporter : exporterList) {
      String extension = exporter.getFileExtension();
      if (!extensionMap.containsKey(extension)) {
        extensionMap.put(extension, exporter.getFileExtensionLabel());
        exporterMap.put(extension, exporter);
      }
    }

    if (winExportFile == null) {
      winExportFile = new Window();
      winExportFile.setTitle(
          Msg.getMsg(Env.getCtx(), "Export") + ": " + panel.getActiveGridTab().getName());
      winExportFile.setWidth("450px");
      winExportFile.setClosable(true);
      winExportFile.setBorder("normal");
      winExportFile.setStyle("position:absolute");
      winExportFile.setSclass("popup-dialog");
      winExportFile.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "exportAction");

      cboType.setMold("select");

      cboType.getItems().clear();
      for (Map.Entry<String, String> entry : extensionMap.entrySet()) {
        cboType.appendItem(entry.getKey() + " - " + entry.getValue(), entry.getKey());
      }

      cboType.setSelectedIndex(0);
      cboType.addActionListener(this);

      Vbox vb = new Vbox();
      vb.setWidth("100%");
      winExportFile.appendChild(vb);

      Vlayout vlayout = new Vlayout();
      vlayout.setSclass("dialog-content");
      vb.appendChild(vlayout);

      Grid grid = GridFactory.newGridLayout();
      vlayout.appendChild(grid);

      Columns columns = new Columns();
      Column column = new Column();
      column.setHflex("min");
      columns.appendChild(column);
      column = new Column();
      column.setHflex("1");
      columns.appendChild(column);
      grid.appendChild(columns);

      Rows rows = new Rows();
      grid.appendChild(rows);

      Row row = new Row();
      rows.appendChild(row);
      row.appendChild(new Label(Msg.getMsg(Env.getCtx(), "FilesOfType")));
      row.appendChild(cboType);
      cboType.setHflex("1");

      row = new Row();
      rows.appendChild(row);
      row.appendChild(new Space());
      chkCurrentRow.setLabel(Msg.getMsg(Env.getCtx(), "ExportCurrentRowOnly"));
      chkCurrentRow.setSelected(true);
      row.appendChild(chkCurrentRow);

      selectionTabRow = new Row();
      rows.appendChild(selectionTabRow);

      LayoutUtils.addSclass("dialog-footer", confirmPanel);
      vb.appendChild(confirmPanel);
      confirmPanel.addActionListener(this);
    }
    displayExportTabSelection();
    panel.getComponent().getParent().appendChild(winExportFile);
    panel.showBusyMask(winExportFile);
    LayoutUtils.openOverlappedWindow(panel.getComponent(), winExportFile, "middle_center");
    winExportFile.addEventListener(DialogEvents.ON_WINDOW_CLOSE, this);
    winExportFile.addEventListener("onExporterException", this);
  }
  public Popup generarPopupResultados(
      Textbox textboxResultado, boolean readonly, Pexamenes_paraclinicos pexamenes_paraclinicos) {
    // final Image image = (Image)form.getFellow("img_"+id_alumno);
    final Textbox tbxRes = textboxResultado;
    // popup.setId("popupResultados_" + key);
    Vlayout vlayout = new Vlayout();

    if (pexamenes_paraclinicos.getNormal_anormal().equals("S")) {
      String valor_na = (String) tbxRes.getAttribute("VALOR_NORMAL_ANORMAL");
      String valor_descripcion_na = (String) tbxRes.getAttribute("VALOR_DESCRIPCION_NA");
      final Radiogroup radiogroup_anormal = new Radiogroup();
      Radio radio_normal = new Radio("Normal");
      radio_normal.setValue("N");
      radiogroup_anormal.appendChild(radio_normal);
      radiogroup_anormal.appendChild(new Space());
      Radio radio_anormal = new Radio("Anormal");
      radio_anormal.setValue("A");
      radiogroup_anormal.appendChild(radio_anormal);

      vlayout.appendChild(radiogroup_anormal);

      final Textbox textbox_anormal = new Textbox();
      textbox_anormal.setWidth("400px");
      textbox_anormal.setRows(4);
      textbox_anormal.setVisible(false);

      if (valor_na != null) {
        if (valor_na.equals("S")) {
          radio_normal.setChecked(true);
          radio_anormal.setChecked(false);
          textbox_anormal.setVisible(true);
        } else {
          radio_anormal.setChecked(true);
          radio_normal.setChecked(false);
          textbox_anormal.setVisible(false);
        }
      } else {
        radio_normal.setChecked(true);
        radio_anormal.setChecked(false);
        textbox_anormal.setVisible(false);
      }

      if (valor_descripcion_na != null) {
        textbox_anormal.setValue(valor_descripcion_na);
      }

      radiogroup_anormal.addEventListener(
          Events.ON_CHECK,
          new EventListener<Event>() {

            @Override
            public void onEvent(Event arg0) throws Exception {
              Radio radio_seleccionado = radiogroup_anormal.getSelectedItem();
              if (radio_seleccionado != null) {
                if (radio_seleccionado.getValue().toString().equals("A")) {
                  textbox_anormal.setVisible(true);
                } else {
                  textbox_anormal.setVisible(false);
                }
                tbxRes.setAttribute(
                    "VALOR_NORMAL_ANORMAL", radio_seleccionado.getValue().toString());
              }
            }
          });

      textbox_anormal.addEventListener(
          Events.ON_CHANGING,
          new EventListener<Event>() {

            @Override
            public void onEvent(Event arg0) throws Exception {
              InputEvent inputEvent = (InputEvent) arg0;
              tbxRes.setAttribute("VALOR_DESCRIPCION_NA", inputEvent.getValue());
            }
          });

      vlayout.appendChild(textbox_anormal);
    }

    final Textbox textbox = new Textbox();
    textbox.setWidth("400px");
    textbox.setRows(8);

    vlayout.appendChild(new Label("Resultado paraclinico"));
    vlayout.appendChild(textbox);
    textbox.setValue(tbxRes.getValue());
    textbox.addEventListener(
        "onChanging",
        new EventListener() {

          @Override
          public void onEvent(Event event) throws Exception {
            InputEvent inputevent = (InputEvent) event;
            tbxRes.setValue(inputevent.getValue());
          }
        });
    final Popup popup = new Popup();
    popup.addEventListener(
        Events.ON_OPEN,
        new EventListener<Event>() {

          @Override
          public void onEvent(Event event) throws Exception {
            textbox.setValue(tbxRes.getValue());
            textbox.setFocus(true);
          }
        });
    popup.appendChild(vlayout);
    contenedor.appendChild(popup);
    return popup;
  }