Example #1
0
  /** Descripción de Método */
  private void jbInit() {

    CPanel panel = new CPanel(new ALayout());

    panel.add(lCN, new ALayoutConstraint(0, 0));
    panel.add(fCN, null);
    panel.add(lOU, new ALayoutConstraint(1, 0));
    panel.add(fOU, null);
    panel.add(lO, new ALayoutConstraint(2, 0));
    panel.add(fO, null);
    panel.add(lL, new ALayoutConstraint(3, 0));
    panel.add(fL, null);
    panel.add(lS, new ALayoutConstraint(4, 0));
    panel.add(fS, null);
    panel.add(lC, new ALayoutConstraint(5, 0));
    panel.add(fC, null);
    panel.setPreferredSize(new Dimension(400, 150));

    //
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(panel, BorderLayout.CENTER);

    //
    CPanel confirmPanel = new CPanel(new FlowLayout(FlowLayout.RIGHT));

    confirmPanel.add(bCancel);
    confirmPanel.add(bOK);
    getContentPane().add(confirmPanel, BorderLayout.SOUTH);

    //
    bCancel.addActionListener(this);
    bOK.addActionListener(this);
  } // jbInit
 /**
  * This method initializes cCommandPanel
  *
  * @return org.compiere.swing.CPanel
  */
 private CPanel getCCmdPanel() {
   if (cCmdPanel == null) {
     cCmdPanel = new CPanel();
     cCmdPanel.setPreferredSize(new java.awt.Dimension(BUTTON_PANEL_WIDTH, 36));
     cCmdPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 5, 0, 0));
     cCmdPanel.add(getCOkButton(), null);
     cCmdPanel.add(getCClearButton(), null);
     cCmdPanel.add(getCCancelButton(), null);
   }
   return cCmdPanel;
 }
 /**
  * Static Init
  *
  * @throws Exception
  */
 private void jbInit() throws Exception {
   mainPanel.setLayout(mainLayout);
   this.getContentPane().add(mainPanel, BorderLayout.CENTER);
   //	North
   northPanel.setLayout(new ALayout());
   northPanel.add(showAll, new ALayoutConstraint(0, 0));
   showAll.addActionListener(this);
   this.getContentPane().add(northPanel, BorderLayout.NORTH);
   //	Center
   mainPanel.add(centerScrollPane, BorderLayout.CENTER);
   centerScrollPane.getViewport().add(m_table, null);
   //	South
   mainPanel.add(confirmPanel, BorderLayout.SOUTH);
   mainPanel.setPreferredSize(new Dimension(SCREEN_WIDTH, SCREEN_HEIGHT));
   confirmPanel.addActionListener(this);
 }
Example #4
0
  /** Static Setup - add fields to parameterPanel */
  private void statInit() {
    labelValue.setText(Msg.getMsg(Env.getCtx(), "Value"));
    fieldValue.setBackground(AdempierePLAF.getInfoBackground());
    fieldValue.addActionListener(this);

    labelName.setText(Msg.getMsg(Env.getCtx(), "Name"));
    fieldName.setBackground(AdempierePLAF.getInfoBackground());
    fieldName.addActionListener(this);

    labelUPC.setText(Msg.translate(Env.getCtx(), "UPC"));
    fieldUPC.setBackground(AdempierePLAF.getInfoBackground());
    fieldUPC.addActionListener(this);

    labelSKU.setText(Msg.translate(Env.getCtx(), "SKU"));
    fieldSKU.setBackground(AdempierePLAF.getInfoBackground());
    fieldSKU.addActionListener(this);

    labelWarehouse.setText(Msg.getMsg(Env.getCtx(), "Warehouse"));
    pickWarehouse.setBackground(AdempierePLAF.getInfoBackground());

    labelPriceList.setText(Msg.getMsg(Env.getCtx(), "PriceListVersion"));
    pickPriceList.setBackground(AdempierePLAF.getInfoBackground());

    labelProductCategory.setText(Msg.translate(Env.getCtx(), "M_Product_Category_ID"));
    pickProductCategory.setBackground(AdempierePLAF.getInfoBackground());

    // @Trifon
    labelAS.setText(Msg.translate(Env.getCtx(), "M_AttributeSet_ID"));
    pickAS.setBackground(AdempierePLAF.getInfoBackground());

    m_InfoPAttributeButton.setMargin(new Insets(2, 2, 2, 2));
    m_InfoPAttributeButton.setToolTipText(Msg.getMsg(Env.getCtx(), "InfoPAttribute"));
    m_InfoPAttributeButton.addActionListener(this);

    labelVendor.setText(Msg.translate(Env.getCtx(), "Vendor"));
    fieldVendor.setBackground(AdempierePLAF.getInfoBackground());
    fieldVendor.addActionListener(this);

    //	Line 1
    parameterPanel.setLayout(new ALayout());
    parameterPanel.add(labelValue, new ALayoutConstraint(0, 0));
    parameterPanel.add(fieldValue, null);
    parameterPanel.add(labelUPC, null);
    parameterPanel.add(fieldUPC, null);
    parameterPanel.add(labelWarehouse, null);
    parameterPanel.add(pickWarehouse, null);
    parameterPanel.add(m_InfoPAttributeButton);
    //	Line 2
    parameterPanel.add(labelName, new ALayoutConstraint(1, 0));
    parameterPanel.add(fieldName, null);
    parameterPanel.add(labelSKU, null);
    parameterPanel.add(fieldSKU, null);
    parameterPanel.add(labelVendor, null);
    parameterPanel.add(fieldVendor, null);

    // Line 3
    parameterPanel.add(labelPriceList, new ALayoutConstraint(2, 0));
    parameterPanel.add(pickPriceList, null);
    parameterPanel.add(labelProductCategory, null);
    parameterPanel.add(pickProductCategory, null);
    parameterPanel.add(labelAS, null); // @Trifon
    parameterPanel.add(pickAS, null); // @Trifon

    //	Product Attribute Instance
    m_PAttributeButton = ConfirmPanel.createPAttributeButton(true);
    confirmPanel.addButton(m_PAttributeButton);
    m_PAttributeButton.addActionListener(this);
    m_PAttributeButton.setEnabled(false);

    // Begin - fer_luck @ centuryon
    // add taskpane
    fieldDescription.setBackground(AdempierePLAF.getInfoBackground());
    fieldDescription.setEditable(false);
    fieldDescription.setPreferredSize(new Dimension(INFO_WIDTH - 100, 100));

    warehouseStockPanel.setTitle(Msg.translate(Env.getCtx(), "WarehouseStock"));
    warehouseStockPanel.setUI(new AdempiereTaskPaneUI());
    warehouseStockPanel.getContentPane().setBackground(new ColorUIResource(251, 248, 241));
    warehouseStockPanel.getContentPane().setForeground(new ColorUIResource(251, 0, 0));

    ColumnInfo[] s_layoutWarehouse =
        new ColumnInfo[] {
          new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "Warehouse", String.class),
          new ColumnInfo(
              Msg.translate(Env.getCtx(), "QtyAvailable"), "sum(QtyAvailable)", Double.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "sum(QtyOnHand)", Double.class),
          new ColumnInfo(
              Msg.translate(Env.getCtx(), "QtyReserved"), "sum(QtyReserved)", Double.class),
          new ColumnInfo(
              Msg.translate(Env.getCtx(), "QtyAllocated"), "sum(QtyAllocated)", Double.class)
        };
    /** From Clause */
    String s_sqlFrom = " M_PRODUCT_STOCK_V ";
    /** Where Clause */
    String s_sqlWhere = "Value = ?";
    m_sqlWarehouse =
        warehouseTbl.prepareTable(
            s_layoutWarehouse, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_STOCK_V");
    m_sqlWarehouse += " Group By Warehouse, documentnote ";
    warehouseTbl.setRowSelectionAllowed(true);
    warehouseTbl.setMultiSelection(false);
    warehouseTbl.addMouseListener(this);
    warehouseTbl.getSelectionModel().addListSelectionListener(this);
    warehouseTbl.setShowTotals(true);
    warehouseTbl.autoSize();

    ColumnInfo[] s_layoutSubstitute =
        new ColumnInfo[] {
          new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class),
          new ColumnInfo(
              Msg.translate(Env.getCtx(), "Value"),
              "(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.Substitute_ID)",
              String.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class)
        };
    s_sqlFrom = "M_PRODUCT_SUBSTITUTERELATED_V";
    s_sqlWhere = "M_Product_ID = ? AND M_PriceList_Version_ID = ? and RowType = 'S'";
    m_sqlSubstitute =
        substituteTbl.prepareTable(
            s_layoutSubstitute, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V");
    substituteTbl.setRowSelectionAllowed(false);
    substituteTbl.setMultiSelection(false);
    substituteTbl.addMouseListener(this);
    substituteTbl.getSelectionModel().addListSelectionListener(this);
    substituteTbl.autoSize();

    ColumnInfo[] s_layoutRelated =
        new ColumnInfo[] {
          new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class),
          new ColumnInfo(
              Msg.translate(Env.getCtx(), "Value"),
              "(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.Substitute_ID)",
              String.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class)
        };
    s_sqlFrom = "M_PRODUCT_SUBSTITUTERELATED_V";
    s_sqlWhere = "M_Product_ID = ? AND M_PriceList_Version_ID = ? and RowType = 'R'";
    m_sqlRelated =
        relatedTbl.prepareTable(
            s_layoutRelated, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V");
    relatedTbl.setRowSelectionAllowed(false);
    relatedTbl.setMultiSelection(false);
    relatedTbl.addMouseListener(this);
    relatedTbl.getSelectionModel().addListSelectionListener(this);
    relatedTbl.autoSize();

    // Available to Promise Tab
    m_tableAtp.setRowSelectionAllowed(false);
    m_tableAtp.setMultiSelection(false);

    CTabbedPane jTab = new CTabbedPane();
    jTab.addTab(Msg.translate(Env.getCtx(), "Warehouse"), new JScrollPane(warehouseTbl));
    jTab.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 250 : 105));
    jTab.addTab(Msg.translate(Env.getCtx(), "Description"), new JScrollPane(fieldDescription));
    jTab.addTab(Msg.translate(Env.getCtx(), "Substitute_ID"), new JScrollPane(substituteTbl));
    jTab.addTab(Msg.translate(Env.getCtx(), "RelatedProduct_ID"), new JScrollPane(relatedTbl));
    jTab.addTab(Msg.getMsg(Env.getCtx(), "ATP"), new JScrollPane(m_tableAtp));
    jTab.addChangeListener(this);
    tablePanel.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 255 : 110));
    tablePanel.add(jTab);

    warehouseStockPanel.setCollapsed(true);
    warehouseStockPanel.add(tablePanel);
    this.addonPanel.add(warehouseStockPanel);

    this.p_table.addKeyListener(
        new KeyAdapter() {
          public void keyReleased(KeyEvent ke) {
            int row = ((MiniTable) ke.getSource()).getSelectedRow();
            refresh(
                ((MiniTable) ke.getSource()).getValueAt(row, 2),
                new BigDecimal(pickWarehouse.getValue().toString()).intValue(),
                new BigDecimal(pickPriceList.getValue().toString()).intValue());
            warehouseStockPanel.setCollapsed(false);
          }
        });

    this.p_table.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent me) {
            int row = ((MiniTable) me.getSource()).getSelectedRow();
            refresh(
                ((MiniTable) me.getSource()).getValueAt(row, 2),
                new BigDecimal(pickWarehouse.getValue().toString()).intValue(),
                new BigDecimal(pickPriceList.getValue().toString()).intValue());
            warehouseStockPanel.setCollapsed(false);
          }
        });
    // End - fer_luck @ centuryon
  } //	statInit
  /** Initialize all panel fields and editors based on {@link #asiTemplate}. */
  private final void initAttributes() {
    final Properties ctx = getCtx();
    final boolean isProductWindow = isProductWindow();
    final boolean isProcessParameter = isProcessParameter();
    final boolean isPureProductASI = isPureProductASI();
    final boolean allowSelectExistingASI = isAllowSelectExistingASI();
    final MAttributeSet as = asiTemplate.getMAttributeSet();
    Check.assumeNotNull(as, "attribute set not null");
    final boolean isASITemplateNew = asiTemplate.getM_AttributeSetInstance_ID() <= 0;

    //
    // Show Select existing ASI (if allowed)
    if (allowSelectExistingASI) {
      // New/Edit - Selection
      if (isASITemplateNew) // new ASI
      cbNewEdit.setText(msgBL.getMsg(ctx, "NewRecord"));
      else cbNewEdit.setText(msgBL.getMsg(ctx, "EditRecord"));
      cbNewEdit.addActionListener(this);
      centerPanel.add(cbNewEdit, new ALayoutConstraint(m_row++, 0));
      bSelectExistingASI.setText(msgBL.getMsg(ctx, "SelectExisting"));
      bSelectExistingASI.addActionListener(this);
      centerPanel.add(bSelectExistingASI, null);
    }

    //
    // Fetch M_Attributes
    final List<MAttribute> attributes;
    if (isProductWindow) {
      attributes = Arrays.asList(as.getMAttributes(false)); // non-instance attributes
    } else if (isPureProductASI) {
      // Regular product's attribute set instance attributes
      attributes = Arrays.asList(as.getMAttributes(true)); // all instance attributes
    } else if (isProcessParameter) {
      final IQueryBuilder<MAttribute> attributesQueryBuilder =
          queryBL
              .createQueryBuilder(MAttribute.class)
              .setContext(ctx, ITrx.TRXNAME_None)
              .addOnlyActiveRecordsFilter()
              .addOnlyContextClient();
      attributesQueryBuilder
          .orderBy()
          .addColumn(I_M_Attribute.COLUMNNAME_Name)
          .addColumn(I_M_Attribute.COLUMNNAME_M_Attribute_ID);
      attributes = attributesQueryBuilder.create().list(MAttribute.class);
    } else {
      attributes = Collections.emptyList();
    }

    //
    // Create attributes UI editors
    for (final MAttribute attribute : attributes) {
      if (!attributeExcludeBL.isExcludedAttribute(
          attribute, as, m_AD_Column_ID, attributeContext.isSOTrx())) {
        addAttributeLine(attribute);
      }
    }

    //
    // Lot
    if (isPureProductASI && as.isLot()) {
      CLabel label = new CLabel(msgBL.translate(ctx, "Lot"));
      label.setLabelFor(fieldLotString);
      centerPanel.add(label, new ALayoutConstraint(m_row++, 0));
      centerPanel.add(fieldLotString, null);
      fieldLotString.setText(asiTemplate.getLot());
      // M_Lot_ID
      // int AD_Column_ID = 9771; // M_AttributeSetInstance.M_Lot_ID
      // fieldLot = new VLookup ("M_Lot_ID", false,false, true,
      // MLookupFactory.get(getCtx(), m_WindowNo, 0, AD_Column_ID, DisplayType.TableDir));
      final String sql =
          "SELECT M_Lot_ID, Name "
              + "FROM M_Lot l "
              + "WHERE EXISTS (SELECT M_Product_ID FROM M_Product p "
              + "WHERE p.M_AttributeSet_ID="
              + asiTemplate.getM_AttributeSet_ID()
              + " AND p.M_Product_ID=l.M_Product_ID)";
      fieldLot = new CComboBox<>(DB.getKeyNamePairs(sql, true));
      label = new CLabel(msgBL.translate(ctx, "M_Lot_ID"));
      label.setLabelFor(fieldLot);
      centerPanel.add(label, new ALayoutConstraint(m_row++, 0));
      centerPanel.add(fieldLot, null);
      if (asiTemplate.getM_Lot_ID() > 0) {
        for (int i = 1; i < fieldLot.getItemCount(); i++) {
          KeyNamePair pp = fieldLot.getItemAt(i);
          if (pp.getKey() == asiTemplate.getM_Lot_ID()) {
            fieldLot.setSelectedIndex(i);
            fieldLotString.setEditable(false);
            break;
          }
        }
      }
      fieldLot.addActionListener(this);
      // New Lot Button
      if (asiTemplate.getMAttributeSet().getM_LotCtl_ID() > 0) {
        if (Env.getUserRolePermissions().isTableAccess(MLot.Table_ID, false)
            && Env.getUserRolePermissions().isTableAccess(MLotCtl.Table_ID, false)
            && !asiTemplate.isExcludeLot(m_AD_Column_ID, attributeContext.isSOTrx())) {
          centerPanel.add(bLot, null);
          bLot.addActionListener(this);
        }
      }
      // Popup
      fieldLot.addMouseListener(new VPAttributeDialog_mouseAdapter(this)); // popup
      mZoom = new CMenuItem(msgBL.getMsg(ctx, "Zoom"), Images.getImageIcon2("Zoom16"));
      mZoom.addActionListener(this);
      popupMenu.add(mZoom);
    } // Lot

    //
    // SerNo
    if (isPureProductASI && as.isSerNo()) {
      CLabel label = new CLabel(msgBL.translate(ctx, "SerNo"));
      label.setLabelFor(fieldSerNo);
      fieldSerNo.setText(asiTemplate.getSerNo());
      centerPanel.add(label, new ALayoutConstraint(m_row++, 0));
      centerPanel.add(fieldSerNo, null);
      // New SerNo Button
      if (asiTemplate.getMAttributeSet().getM_SerNoCtl_ID() != 0) {
        if (Env.getUserRolePermissions().isTableAccess(MSerNoCtl.Table_ID, false)
            && !asiTemplate.isExcludeSerNo(m_AD_Column_ID, attributeContext.isSOTrx())) {
          centerPanel.add(bSerNo, null);
          bSerNo.addActionListener(this);
        }
      }
    } // SerNo

    //
    // GuaranteeDate.
    // We are displaying it if we deal with a pure product ASI (i.e. user is not editing the ASI
    // from product window),
    // and if:
    // * the attribute set requires a GuaranteeDate
    // * or if the ASI has a GuaranteeDate already set
    if (isPureProductASI && (as.isGuaranteeDate() || asiTemplate.getGuaranteeDate() != null)) {
      CLabel label = new CLabel(msgBL.translate(ctx, "GuaranteeDate"));
      label.setLabelFor(fieldGuaranteeDate);
      if (isASITemplateNew) {
        Date guaranteeDate = asiTemplate.getGuaranteeDate();
        if (guaranteeDate == null) {
          guaranteeDate =
              attributesBL.calculateBestBeforeDate(
                  ctx,
                  m_M_Product_ID, // product
                  attributeContext.getC_BPartner_ID(), // vendor bpartner
                  Env.getDate(ctx) // dateReceipt
                  );
        }
        fieldGuaranteeDate.setValue(guaranteeDate);
      } else {
        fieldGuaranteeDate.setValue(asiTemplate.getGuaranteeDate());
      }
      centerPanel.add(label, new ALayoutConstraint(m_row++, 0));
      centerPanel.add(fieldGuaranteeDate, null);
      fieldGuaranteeDateDisplayed = true;
    } // GuaranteeDate

    // Make sure we have at least something to edit or something to select,
    // else there is no point in showing empty this window.
    if (m_row == 0) {
      throw new AdempiereException("@PAttributeNoInfo@");
    }

    //
    // New/Edit Window
    if (allowSelectExistingASI) {
      cbNewEdit.setSelected(isASITemplateNew);
      cmd_newEdit();
    }

    //
    // Attrribute Set Instance Description
    {
      final CLabel labelDescription = new CLabel(msgBL.translate(ctx, "Description"));
      labelDescription.setLabelFor(fieldDescription);
      fieldDescription.setText(asiTemplate.getDescription());
      fieldDescription.setEditable(false);
      centerPanel.add(labelDescription, new ALayoutConstraint(m_row++, 0));
      centerPanel.add(fieldDescription, null);
    }

    // Window usually to wide (??)
    {
      final Dimension dd = centerPanel.getPreferredSize();
      dd.width = Math.min(500, dd.width);
      centerPanel.setPreferredSize(dd);
    }
  } // initAttribute
Example #6
0
  /**
   * Descripción de Método
   *
   * @param mTab
   * @param onlyMultiRow
   * @param WindowNo
   * @param aPanel
   * @param mWindow
   * @return
   */
  public boolean initGrid(
      MTab mTab, boolean onlyMultiRow, int WindowNo, APanel aPanel, MWindow mWindow) {
    log.config("(" + mTab.toString() + ")");
    m_mTab = mTab;
    m_WindowNo = WindowNo;
    m_onlyMultiRow = onlyMultiRow;
    fieldEditors = new HashMap<MField, VEditor>();

    // Set up Multi Row Table

    vTable.setModel(m_mTab.getTableModel());

    // Update Table Info -------------------------------------------------

    int size = setupVTable(aPanel, m_mTab, vTable);

    // Set Color on Tab Level
    // this.setBackgroundColor (mTab.getColor());

    // Single Row  -------------------------------------------------------

    if (!m_onlyMultiRow) {
      for (int i = 0; i < size; i++) {
        MField mField = m_mTab.getField(i);

        if (mField.isDisplayed()) {
          VEditor vEditor = VEditorFactory.getEditor(m_mTab, mField, false);

          if (vEditor == null) {
            log.severe("Editor not created for " + mField.getColumnName());

            continue;
          }

          // MField => VEditor - New Field value to be updated to editor

          mField.addPropertyChangeListener(vEditor);

          // VEditor => this - New Editor value to be updated here (MTable)

          vEditor.addVetoableChangeListener(this);

          // Add to VPanel

          vPanel.addField(VEditorFactory.getLabel(mField), vEditor, mField);

          // APanel Listen to buttons

          if ((mField.getDisplayType() == DisplayType.Button) && (aPanel != null)) {
            ((JButton) vEditor).addActionListener(aPanel);
          }

          fieldEditors.put(mField, vEditor);
        }
      } // for all fields

      // No Included Grid Controller

      srPane.setResizeWeight(1); // top part gets all
      srPane.setDividerSize(0);
      srPane.setDividerLocation(9999);

      // Use SR to size MR

      mrPane.setPreferredSize(vPanel.getPreferredSize());
    } // Single-Row

    // Tree Graphics Layout

    int AD_Tree_ID = 0;

    if (m_mTab.isTreeTab()) {
      AD_Tree_ID =
          MTree.getAD_Tree_ID(Env.getAD_Client_ID(Env.getCtx()), m_mTab.getKeyColumnName());
    }

    if (m_mTab.isTreeTab() && (AD_Tree_ID != 0)) {
      m_tree = new VTreePanel(m_WindowNo, false, true);

      if (m_mTab.getTabNo() == 0) { // initialize other tabs later
        m_tree.initTree(AD_Tree_ID);
      }

      m_tree.addPropertyChangeListener(VTreePanel.NODE_SELECTION, this);
      graphPanel.add(m_tree, BorderLayout.CENTER);
      splitPane.setDividerLocation(250);

      // splitPane.resetToPreferredSizes();

    } else // No Graphics - hide
    {
      graphPanel.setPreferredSize(new Dimension(0, 0));
      splitPane.setDividerSize(0);
      splitPane.setDividerLocation(0);
    }

    // Receive DataStatusChanged info from MTab

    m_mTab.addDataStatusListener(this);

    // Receive vetoableChange info from MTable when saving

    m_mTab.getTableModel().addVetoableChangeListener(this);

    // Selection Listener -> valueChanged

    vTable.getSelectionModel().addListSelectionListener(this);

    // Navigation (RowChanged)

    m_mTab.addPropertyChangeListener(vTable);

    // Update UI
    vTable.autoSize(true); // Original
    // Modificado por ConSerTi.
    // vTable.autoSize( false );//Modificada
    setTabLevel(m_mTab.getTabLevel());

    // Set initial presentation

    if (onlyMultiRow || !m_mTab.isSingleRow()) {
      switchMultiRow();
    } else {
      switchSingleRow();
    }

    // log.config( "GridController.dynInit (" + mTab.toString() + ") - fini");

    return true;
  } // initGrid
Example #7
0
  void jbInit() throws Exception {

    // criando os labels
    executar.setText("Executar(F5)");
    executar.setToolTipText("Executa Comando SQL");
    exportar.setText("Exportar");
    exportar.setToolTipText("Exporta Consulta para arquivo CSV");

    // /adicionando as bordas
    painelSuperior.setBorder(BorderFactory.createTitledBorder("COMANDO SQL"));
    painelInferior.setBorder(BorderFactory.createTitledBorder("ERROS"));
    scrollPane.setBorder(BorderFactory.createTitledBorder("RESULTADO"));
    painelPrincipal.setPreferredSize(Toolkit.getDefaultToolkit().getScreenSize());
    caixaLista.setPreferredSize(new Dimension(100, 20));

    // layout do painel

    painelPrincipal.setLayout(borderLayout);
    painelSuperior.setLayout(gridBaglayout);
    painelInferior.setLayout(gridBaglayout);
    painelSuperiorDireito.setLayout(gridBaglayout);
    painelSuperiorEsquerdo.setLayout(gridBaglayout);
    painelPrincipal.add(scrollPane, BorderLayout.CENTER);
    painelPrincipal.add(painelSuperior, BorderLayout.NORTH);
    painelPrincipal.add(painelInferior, BorderLayout.SOUTH);

    painelSuperior.add(
        painelSuperiorEsquerdo,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    painelSuperior.add(
        painelSuperiorDireito,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    painelSuperior.add(
        caixaLista,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));

    // adicionando paineis no painel principal

    painelSuperiorEsquerdo.add(
        barraRolagem,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    painelSuperiorDireito.add(
        executar,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));

    painelSuperiorDireito.add(
        exportar,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));

    // ////////////////////Panel inferio
    painelInferior.add(
        erroSQL,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));

    // adicionando componentes no painel

    barraRolagem.getViewport().add(comandoSQL, null);
    // comandoSQL.setEditable(false);

    erroSQL.setEnabled(false);
    // adicionando componentes eventos variados

    painelPrincipal.addKeyListener(this);
    executar.addActionListener(this);
    exportar.addActionListener(this);
    comandoSQL.addKeyListener(this);
    caixaLista.addItemListener(this);

    painelPrincipal.repaint();
  }