/** * Fill Background with Color. (Ususlly called from update methods) * * @param g2D Graphics * @param c Component * @param round paint round corners */ public static void fillRectange(Graphics2D g2D, JComponent c, boolean round) { // Paint in AdempiereColor? CompiereColor cc = null; boolean stdCC = c.getClientProperty(CompiereLookAndFeel.BACKGROUND_FILL) != null; try { cc = (CompiereColor) c.getClientProperty(CompiereLookAndFeel.BACKGROUND); } catch (Exception e) { stdCC = true; } if (stdCC) cc = CompiereColor.getDefaultBackground(); // Paint AdempiereColor if (cc != null) { // bounds is often not within Panel bouunds cc.paint(g2D, c); } // Paint Flat Color else { Paint paint = c.getBackground(); g2D.setPaint(paint); // RectangularShape rec = null; if (round) rec = new RoundRectangle2D.Float(0, 0, c.getWidth(), c.getHeight(), 15, 15); else rec = new Rectangle(0, 0, c.getWidth(), c.getHeight()); g2D.fill(rec); } } // fill Rectangle
/** Dynamic Init. Table Layout, Visual, Listener */ private void dynInit() { ColumnInfo[] layout = new ColumnInfo[] { new ColumnInfo(Msg.translate(Env.getCtx(), "M_Product_ID"), ".", KeyNamePair.class), // 1 new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), ".", String.class) // 2 }; xProductTable.prepareTable(layout, "", "", false, ""); xAssociateTable.prepareTable(layout, "", "", true, ""); xAssociateTable.setAutoResizeMode(3); xProductTable.setAutoResizeMode(3); // Visual CompiereColor.setBackground(this); // Listener xProductTable.getSelectionModel().addListSelectionListener(this); xAssociateTable.getModel().addTableModelListener(this); bDisassociate.addActionListener(this); bNewProduct.addActionListener(this); // pregunto si hay productos asociados para ver si cargo las tablas boolean ready = verify(); if (ready == false) { tableInit_option = 0; tableInit(); tableLoad(xProductTable); } else { tableInit_option = 1; tableInit(); tableLoad(xAssociateTable); bNewProduct.setEnabled(false); bDisassociate.setEnabled(true); } xProductTable.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { int rowP = xProductTable.getSelectedRow(); if (!(rowP == -1)) { cmd_associate(); } } } }); // Init statusBar.setStatusLine(""); statusBar.setStatusDB(0); MOrder order = new MOrder(Env.getCtx(), LineRefProv.getC_Order_ID(), null); boolean block = false; String oS = order.getXX_OrderStatus(); String compS = order.getDocStatus(); if (oS.equals("AN") || compS.equals("CO")) { block = true; } if (order.isXX_OrderReadyStatus() && order.getXX_OrderType().equalsIgnoreCase("Nacional")) block = true; if (order.getXX_OrderType().equalsIgnoreCase("Importada") && order.get_ValueAsInt("XX_ImportingCompany_ID") != 0) { if (order.get_ValueAsInt("XX_ImportingCompany_ID") != Env.getCtx().getContextAsInt("#XX_L_VSI_CLIENTCENTROBECO_ID")) { block = true; } } if (order.getXX_StoreDistribution().equals("Y") || block) { xProductTable.setEnabled(false); xAssociateTable.setEnabled(false); bNewProduct.setEnabled(false); bDisassociate.setEnabled(false); } } // dynInit