Search in sources :

Example 11 with CScrollPane

use of org.compiere.swing.CScrollPane in project adempiere by adempiere.

the class AMenu method jbInit.

/**
	 *	Static Init.
	 *  <pre>
	 *  - mainPanel
	 * 		- centerPane
	 *      	- treePanel
	 * 			- wfActivity
	 * 			- wfPanel
	 *      - southPanel
	 *          - infoPanel
	 *              - bNotes
	 *              - bTask
	 *              - memoryBar
	 *          - wfPanel
	 *          - progressBar
	 *  </pre>
	 *  @throws Exception
	 */
void jbInit() throws Exception {
    this.setName("Menu");
    this.setLocale(Language.getLoginLanguage().getLocale());
    this.setJMenuBar(menuBar);
    //
    mainPanel.setLayout(mainLayout);
    mainLayout.setHgap(0);
    mainLayout.setVgap(2);
    //
    treePanel.addPropertyChangeListener(VTreePanel.NODE_SELECTION, this);
    //
    infoPanel.setLayout(infoLayout);
    infoLayout.setColumns(2);
    infoLayout.setHgap(4);
    infoLayout.setVgap(0);
    //	bNotes.setRequestFocusEnabled(false);
    bNotes.setToolTipText("");
    bNotes.setActionCommand("Notes");
    bNotes.addActionListener(this);
    bNotes.setIcon(Env.getImageIcon("GetMail24.gif"));
    bNotes.setMargin(new Insets(0, 0, 0, 0));
    //	bRequests.setRequestFocusEnabled(false);
    bRequests.setActionCommand("Requests");
    bRequests.addActionListener(this);
    bRequests.setIcon(Env.getImageIcon("Request24.gif"));
    bRequests.setMargin(new Insets(0, 0, 0, 0));
    //
    southLayout.setHgap(0);
    southLayout.setVgap(1);
    //
    memoryBar.setStringPainted(true);
    memoryBar.setOpaque(false);
    memoryBar.setBorderPainted(false);
    memoryBar.addMouseListener(new AMenu_MouseAdapter());
    //
    progressBar.setStringPainted(true);
    progressBar.setOpaque(false);
    //
    getContentPane().add(mainPanel);
    mainPanel.add(centerPane, BorderLayout.CENTER);
    mainPanel.add(southPanel, BorderLayout.SOUTH);
    mainPanel.add(Box.createHorizontalStrut(3), BorderLayout.EAST);
    mainPanel.add(Box.createHorizontalStrut(3), BorderLayout.WEST);
    //	Tabs
    centerPane.setFont(centerPane.getFont().deriveFont(centerPane.getFont().getSize2D() + 1));
    paPanel = PAPanel.get();
    if (paPanel != null) {
        //centerPane.add(paPanel, Msg.getMsg(m_ctx, "PAPanel"));
        centerPane.addTab(Msg.getMsg(m_ctx, "PAPanel"), Env.getImageIcon2("InfoAccount16"), paPanel);
        m_tabMenu++;
        m_tabActivities++;
        m_tabWorkflow++;
    }
    treePanel.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 3));
    //centerPane.add(treePanel, Msg.getMsg(m_ctx, "Menu"));
    centerPane.addTab(Msg.getMsg(m_ctx, "Menu"), Env.getImageIcon2("Home16"), treePanel);
    //centerPane.add(new CScrollPane(wfActivity), Msg.getMsg (m_ctx, "WorkflowActivities") + ": 0");
    centerPane.addTab(Msg.getMsg(m_ctx, "WorkflowActivities") + ": 0", Env.getImageIcon2("Assignment16"), new CScrollPane(wfActivity));
    //centerPane.add(new CScrollPane(wfPanel), Msg.getMsg (m_ctx, "WorkflowPanel"));
    centerPane.addTab(Msg.getMsg(m_ctx, "WorkflowPanel"), Env.getImageIcon2("WorkFlow16"), new CScrollPane(wfPanel));
    centerPane.addChangeListener(this);
    //
    southPanel.setLayout(southLayout);
    southPanel.add(infoPanel, BorderLayout.NORTH);
    southPanel.add(progressBar, BorderLayout.SOUTH);
    //
    infoPanel.add(bNotes, null);
    infoPanel.add(bRequests, null);
    infoPanel.add(memoryBar, null);
    //
    int loc = Ini.getDividerLocation();
    if (loc > 0)
        treePanel.setDividerLocation(loc);
}
Also used : Insets(java.awt.Insets) CScrollPane(org.compiere.swing.CScrollPane) Point(java.awt.Point)

Example 12 with CScrollPane

use of org.compiere.swing.CScrollPane in project lar_361 by comitsrl.

the class PosKeyPanel method createCard.

/**
 * @return
 */
private CPanel createCard(int C_POSKeyLayout_ID) {
    // already added
    if (keymap.containsKey(C_POSKeyLayout_ID)) {
        return null;
    }
    CPanel card = new CPanel();
    card.setLayout(new MigLayout("fill, ins 0"));
    MPOSKeyLayout keyLayout = MPOSKeyLayout.get(Env.getCtx(), C_POSKeyLayout_ID);
    Color stdColor = Color.lightGray;
    if (keyLayout.getAD_PrintColor_ID() != 0) {
        MPrintColor color = MPrintColor.get(Env.getCtx(), keyLayout.getAD_PrintColor_ID());
        stdColor = color.getColor();
    }
    Font stdFont = AdempierePLAF.getFont_Field();
    if (keyLayout.getAD_PrintFont_ID() != 0) {
        MPrintFont font = MPrintFont.get(keyLayout.getAD_PrintFont_ID());
        stdFont = font.getFont();
    }
    if (keyLayout.get_ID() == 0)
        return null;
    MPOSKey[] keys = keyLayout.getKeys(false);
    HashMap<Integer, MPOSKey> map = new HashMap<Integer, MPOSKey>(keys.length);
    keymap.put(C_POSKeyLayout_ID, map);
    // Min Columns
    int COLUMNS = 3;
    // Min Rows
    int ROWS = 3;
    int noKeys = keys.length;
    int cols = keyLayout.getColumns();
    if (cols == 0)
        cols = COLUMNS;
    int buttons = 0;
    log.fine("PosSubFunctionKeys.init - NoKeys=" + noKeys + ", Cols=" + cols);
    // Content
    CPanel content = new CPanel(new MigLayout("fill, wrap " + Math.max(cols, 3)));
    String buttonSize = "h 50, w 50, growx, growy, sg button,";
    for (MPOSKey key : keys) {
        if (key.getSubKeyLayout_ID() > 0) {
            CPanel subCard = createCard(key.getSubKeyLayout_ID());
            if (subCard != null)
                add(subCard, Integer.toString(key.getSubKeyLayout_ID()));
        }
        map.put(key.getC_POSKey_ID(), key);
        Color keyColor = stdColor;
        Font keyFont = stdFont;
        StringBuffer buttonHTML = new StringBuffer("<html><p>");
        if (key.getAD_PrintColor_ID() != 0) {
            MPrintColor color = MPrintColor.get(Env.getCtx(), key.getAD_PrintColor_ID());
            keyColor = color.getColor();
        }
        if (key.getAD_PrintFont_ID() != 0) {
            MPrintFont font = MPrintFont.get(key.getAD_PrintFont_ID());
            keyFont = font.getFont();
        }
        buttonHTML.append(key.getName());
        buttonHTML.append("</p></html>");
        log.fine("#" + map.size() + " - " + keyColor);
        CButton button = new CButton(buttonHTML.toString());
        button.setBackground(keyColor);
        button.setFont(keyFont);
        if (key.getAD_Image_ID() != 0) {
            MImage image = MImage.get(Env.getCtx(), key.getAD_Image_ID());
            Icon icon = image.getIcon();
            button.setIcon(icon);
            button.setVerticalTextPosition(SwingConstants.BOTTOM);
            button.setHorizontalTextPosition(SwingConstants.CENTER);
        }
        button.setFocusable(false);
        if (!key.isActive())
            button.setEnabled(false);
        button.setActionCommand(String.valueOf(key.getC_POSKey_ID()));
        button.addActionListener(this);
        String constraints = buttonSize;
        int size = 1;
        if (key.getSpanX() > 1) {
            constraints += "spanx " + key.getSpanX() + ",";
            size = key.getSpanX();
        }
        if (key.getSpanY() > 1) {
            constraints += "spany " + key.getSpanY() + ",";
            size = size * key.getSpanY();
        }
        buttons = buttons + size;
        content.add(button, constraints);
    }
    int rows = Math.max((buttons / cols), ROWS);
    if (buttons % cols > 0)
        rows = rows + 1;
    for (int i = buttons; i < rows * cols; i++) {
        CButton button = new CButton("");
        button.setFocusable(false);
        button.setReadWrite(false);
        content.add(button, buttonSize);
    }
    CScrollPane scroll = new CScrollPane(content);
    // scroll.setPreferredSize(new Dimension( 600 - 20, 400-20));
    card.add(scroll, "growx, growy");
    // increase scrollbar width for touchscreen
    scroll.getVerticalScrollBar().setPreferredSize(new Dimension(30, 0));
    scroll.getHorizontalScrollBar().setPreferredSize(new Dimension(0, 30));
    return card;
}
Also used : HashMap(java.util.HashMap) MPOSKeyLayout(org.compiere.model.MPOSKeyLayout) CScrollPane(org.compiere.swing.CScrollPane) MigLayout(net.miginfocom.swing.MigLayout) Color(java.awt.Color) MPrintColor(org.compiere.print.MPrintColor) CPanel(org.compiere.swing.CPanel) MPrintFont(org.compiere.print.MPrintFont) Dimension(java.awt.Dimension) Font(java.awt.Font) MPrintFont(org.compiere.print.MPrintFont) MImage(org.compiere.model.MImage) MPrintColor(org.compiere.print.MPrintColor) MPOSKey(org.compiere.model.MPOSKey) Icon(javax.swing.Icon) CButton(org.compiere.swing.CButton)

Example 13 with CScrollPane

use of org.compiere.swing.CScrollPane in project lar_361 by comitsrl.

the class QueryBPartner method init.

/**
 * 	Set up Panel
 */
protected void init() {
    CPanel panel = new CPanel();
    panel.setLayout(new MigLayout("fill"));
    getContentPane().add(panel);
    // North
    northPanel = new CPanel(new MigLayout("fill", "", "[50][50][]"));
    panel.add(northPanel, "north");
    northPanel.setBorder(new TitledBorder(Msg.getMsg(p_ctx, "Query")));
    CLabel lvalue = new CLabel(Msg.translate(p_ctx, "Value"));
    northPanel.add(lvalue, " growy");
    f_value = new PosTextField("", p_posPanel, p_pos.getOSK_KeyLayout_ID());
    lvalue.setLabelFor(f_value);
    northPanel.add(f_value, "h 30, w 200");
    f_value.addActionListener(this);
    // 
    CLabel lcontact = new CLabel(Msg.translate(p_ctx, "Contact"));
    northPanel.add(lcontact, " growy");
    f_contact = new PosTextField("", p_posPanel, p_pos.getOSK_KeyLayout_ID());
    lcontact.setLabelFor(f_contact);
    northPanel.add(f_contact, "h 30, w 200");
    f_contact.addActionListener(this);
    // 
    CLabel lphone = new CLabel(Msg.translate(p_ctx, "Phone"));
    northPanel.add(lphone, " growy");
    f_phone = new PosTextField("", p_posPanel, p_pos.getOSK_KeyLayout_ID());
    lphone.setLabelFor(f_phone);
    northPanel.add(f_phone, "h 30, w 200, wrap");
    f_phone.addActionListener(this);
    // 
    CLabel lname = new CLabel(Msg.translate(p_ctx, "Name"));
    northPanel.add(lname, " growy");
    f_name = new PosTextField("", p_posPanel, p_pos.getOSK_KeyLayout_ID());
    lname.setLabelFor(f_name);
    northPanel.add(f_name, "h 30, w 200");
    f_name.addActionListener(this);
    // 
    CLabel lemail = new CLabel(Msg.translate(p_ctx, "Email"));
    northPanel.add(lemail, " growy");
    f_email = new PosTextField("", p_posPanel, p_pos.getOSK_KeyLayout_ID());
    lemail.setLabelFor(f_email);
    northPanel.add(f_email, "h 30, w 200");
    f_email.addActionListener(this);
    // 
    CLabel lcity = new CLabel(Msg.translate(p_ctx, "City"));
    northPanel.add(lcity, " growy");
    f_city = new CTextField(10);
    lcity.setLabelFor(f_city);
    northPanel.add(f_city, "h 30, w 200");
    f_city.addActionListener(this);
    // 
    f_refresh = createButtonAction("Refresh", KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0));
    northPanel.add(f_refresh, "w 50!, h 50!, wrap, alignx trailing");
    f_up = createButtonAction("Previous", KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0));
    northPanel.add(f_up, "w 50!, h 50!, span, split 4");
    f_down = createButtonAction("Next", KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0));
    northPanel.add(f_down, "w 50!, h 50!");
    f_ok = createButtonAction("Ok", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));
    northPanel.add(f_ok, "w 50!, h 50!");
    f_cancel = createButtonAction("Cancel", KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));
    northPanel.add(f_cancel, "w 50!, h 50!");
    // Center
    m_table = new PosTable();
    m_table.prepareTable(s_layout, s_sqlFrom, s_sqlWhere, false, "RV_BPartner");
    m_table.addMouseListener(this);
    m_table.getSelectionModel().addListSelectionListener(this);
    enableButtons();
    centerScroll = new CScrollPane(m_table);
    panel.add(centerScroll, "growx, growy");
    m_table.growScrollbars();
    panel.setPreferredSize(new Dimension(800, 600));
    // @emmie
    f_name.requestFocusInWindow();
    // @emmie
    addWindowListener(new WindowsCloseAdapter());
}
Also used : CLabel(org.compiere.swing.CLabel) CScrollPane(org.compiere.swing.CScrollPane) MigLayout(net.miginfocom.swing.MigLayout) CTextField(org.compiere.swing.CTextField) CPanel(org.compiere.swing.CPanel) Dimension(java.awt.Dimension) TitledBorder(javax.swing.border.TitledBorder)

Example 14 with CScrollPane

use of org.compiere.swing.CScrollPane in project lar_361 by comitsrl.

the class QueryProduct method init.

/**
 * 	Set up Panel
 */
protected void init() {
    CPanel panel = new CPanel();
    panel.setLayout(new MigLayout("fill"));
    getContentPane().add(panel);
    // North
    northPanel = new CPanel(new MigLayout("fill", "", "[50][50][]"));
    panel.add(northPanel, "north");
    northPanel.setBorder(new TitledBorder(Msg.getMsg(p_ctx, "Query")));
    // 
    CLabel lvalue = new CLabel(Msg.translate(p_ctx, "Value"));
    northPanel.add(lvalue, "growy");
    f_value = new PosTextField("", p_posPanel, p_pos.getOSK_KeyLayout_ID());
    // red1 for UISpec4J testing call
    f_value.setName("ProductKey");
    lvalue.setLabelFor(f_value);
    northPanel.add(f_value, "h 30, w 200");
    f_value.addActionListener(this);
    // 
    CLabel lupc = new CLabel(Msg.translate(p_ctx, "UPC"));
    northPanel.add(lupc, "growy");
    f_upc = new PosTextField("", p_posPanel, p_pos.getOSK_KeyLayout_ID());
    lupc.setLabelFor(f_upc);
    northPanel.add(f_upc, "h 30, w 200, wrap");
    f_upc.addActionListener(this);
    // 
    CLabel lname = new CLabel(Msg.translate(p_ctx, "Name"));
    northPanel.add(lname, "growy");
    f_name = new PosTextField("", p_posPanel, p_pos.getOSK_KeyLayout_ID());
    // red1 for UISpec4J testing call
    f_name.setName("ProductName");
    lname.setLabelFor(f_name);
    northPanel.add(f_name, "h 30, w 200");
    f_name.addActionListener(this);
    // 
    CLabel lsku = new CLabel(Msg.translate(p_ctx, "SKU"));
    northPanel.add(lsku, "growy");
    f_sku = new PosTextField("", p_posPanel, p_pos.getOSK_KeyLayout_ID());
    lsku.setLabelFor(f_sku);
    northPanel.add(f_sku, "h 30, w 200");
    f_sku.addActionListener(this);
    // 
    f_refresh = createButtonAction("Refresh", KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0));
    northPanel.add(f_refresh, "w 50!, h 50!, wrap, alignx trailing");
    f_up = createButtonAction("Previous", KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0));
    northPanel.add(f_up, "w 50!, h 50!, span, split 4");
    f_down = createButtonAction("Next", KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0));
    northPanel.add(f_down, "w 50!, h 50!");
    f_ok = createButtonAction("Ok", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));
    northPanel.add(f_ok, "w 50!, h 50!");
    f_cancel = createButtonAction("Cancel", KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));
    northPanel.add(f_cancel, "w 50!, h 50!");
    // Center
    m_table = new PosTable();
    // @emmie
    m_table.prepareTable(s_layout, s_sqlFrom, s_sqlWhere, false, "RV_WarehousePrice");
    m_table.addMouseListener(this);
    m_table.getSelectionModel().addListSelectionListener(this);
    m_table.setColumnVisibility(m_table.getColumn(0), false);
    m_table.getColumn(1).setPreferredWidth(175);
    m_table.getColumn(2).setPreferredWidth(175);
    m_table.getColumn(3).setPreferredWidth(100);
    m_table.getColumn(4).setPreferredWidth(75);
    m_table.getColumn(5).setPreferredWidth(75);
    m_table.getColumn(6).setPreferredWidth(75);
    m_table.getColumn(7).setPreferredWidth(75);
    enableButtons();
    // @Trifon
    m_table.setFillsViewportHeight(true);
    m_table.growScrollbars();
    centerScroll = new CScrollPane(m_table);
    panel.add(centerScroll, "growx, growy,south");
    panel.setPreferredSize(new Dimension(800, 600));
    // @emmie
    f_name.requestFocusInWindow();
    // @emmie
    addWindowListener(new WindowsCloseAdapter());
}
Also used : CLabel(org.compiere.swing.CLabel) CScrollPane(org.compiere.swing.CScrollPane) MigLayout(net.miginfocom.swing.MigLayout) CPanel(org.compiere.swing.CPanel) Dimension(java.awt.Dimension) TitledBorder(javax.swing.border.TitledBorder)

Example 15 with CScrollPane

use of org.compiere.swing.CScrollPane in project lar_361 by comitsrl.

the class QueryTicket method init.

/**
 * 	Set up Panel
 */
@Override
protected void init() {
    CPanel panel = new CPanel();
    panel.setLayout(new MigLayout("fill"));
    getContentPane().add(panel);
    // North
    northPanel = new CPanel(new MigLayout("fill", "", "[50][50][]"));
    panel.add(northPanel, "north");
    northPanel.setBorder(new TitledBorder(Msg.getMsg(p_ctx, "Query")));
    CLabel ldoc = new CLabel(Msg.translate(p_ctx, "DocumentNo"));
    northPanel.add(ldoc, " growy");
    f_documentno = new PosTextField("", p_posPanel, p_pos.getOSK_KeyLayout_ID());
    ldoc.setLabelFor(f_documentno);
    northPanel.add(f_documentno, "h 30, w 200");
    f_documentno.addActionListener(this);
    // 
    CLabel ldate = new CLabel(Msg.translate(p_ctx, "DateOrdered"));
    northPanel.add(ldate, "growy");
    f_date = new VDate();
    f_date.setValue(Env.getContextAsDate(Env.getCtx(), "#Date"));
    ldate.setLabelFor(f_date);
    northPanel.add(f_date, "h 30, w 200");
    f_date.addActionListener(this);
    f_processed = new CCheckBox(Msg.translate(p_ctx, "Processed"));
    f_processed.setSelected(false);
    northPanel.add(f_processed, "");
    f_refresh = createButtonAction("Refresh", KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0));
    northPanel.add(f_refresh, "w 50!, h 50!, wrap, alignx trailing");
    f_up = createButtonAction("Previous", KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0));
    northPanel.add(f_up, "w 50!, h 50!, span, split 4");
    f_down = createButtonAction("Next", KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0));
    northPanel.add(f_down, "w 50!, h 50!");
    f_ok = createButtonAction("Ok", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));
    northPanel.add(f_ok, "w 50!, h 50!");
    f_cancel = createButtonAction("Cancel", KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));
    northPanel.add(f_cancel, "w 50!, h 50!");
    // Center
    m_table = new PosTable();
    String sql = m_table.prepareTable(s_layout, "C_Order", "C_POS_ID = " + p_pos.getC_POS_ID(), false, "C_Order") + " ORDER BY Margin, QtyAvailable";
    m_table.addMouseListener(this);
    m_table.getSelectionModel().addListSelectionListener(this);
    enableButtons();
    centerScroll = new CScrollPane(m_table);
    panel.add(centerScroll, "growx, growy");
    m_table.growScrollbars();
    panel.setPreferredSize(new Dimension(800, 600));
    f_documentno.requestFocus();
    pack();
    setResults(p_ctx, f_processed.isSelected(), f_documentno.getText(), f_date.getTimestamp());
}
Also used : CLabel(org.compiere.swing.CLabel) CScrollPane(org.compiere.swing.CScrollPane) MigLayout(net.miginfocom.swing.MigLayout) CPanel(org.compiere.swing.CPanel) VDate(org.compiere.grid.ed.VDate) CCheckBox(org.compiere.swing.CCheckBox) Dimension(java.awt.Dimension) TitledBorder(javax.swing.border.TitledBorder)

Aggregations

CScrollPane (org.compiere.swing.CScrollPane)15 CPanel (org.compiere.swing.CPanel)9 Dimension (java.awt.Dimension)8 MigLayout (net.miginfocom.swing.MigLayout)6 CLabel (org.compiere.swing.CLabel)5 BorderLayout (java.awt.BorderLayout)3 TitledBorder (javax.swing.border.TitledBorder)3 Color (java.awt.Color)2 Font (java.awt.Font)2 Insets (java.awt.Insets)2 HashMap (java.util.HashMap)2 MImage (org.compiere.model.MImage)2 MPOSKey (org.compiere.model.MPOSKey)2 MPOSKeyLayout (org.compiere.model.MPOSKeyLayout)2 MPrintColor (org.compiere.print.MPrintColor)2 MPrintFont (org.compiere.print.MPrintFont)2 CButton (org.compiere.swing.CButton)2 FlowLayout (java.awt.FlowLayout)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1