Search in sources :

Example 1 with CheckLayout

use of jgnash.engine.checks.CheckLayout in project jgnash by ccavanaugh.

the class CheckDesignDialog method initComponents.

private void initComponents() {
    toolBar = new JToolBar();
    toolBar.setRollover(true);
    openButton = new RollOverButton(rb.getString("Menu.Open.Name").replace("_", ""), IconUtils.getIcon("/jgnash/resource/document-open.png"));
    saveButton = new RollOverButton(rb.getString("Menu.Save.Name").replace("_", ""), IconUtils.getIcon("/jgnash/resource/document-save.png"));
    toolBar.add(openButton);
    toolBar.add(saveButton);
    checkLayout = new CheckLayout();
    layout = new PrintableCheckLayout(checkLayout);
    countField = getIntegerField();
    xPosField = getFloatField();
    yPosField = getFloatField();
    heightField = getFloatField();
    previewPanel = new PrintPreviewPanel(layout, layout.getPageFormat());
    objectList = new JList<>();
    //objectList.setPrototypeCellValue("Some dummy text");
    setupButton = new JButton(rb.getString("Button.PageSetup"));
    addButton = new JButton(rb.getString("Button.Add"));
    removeButton = new JButton(rb.getString("Button.Remove"));
    clearButton = new JButton(rb.getString("Button.Clear"));
    applyButton = new JButton(rb.getString("Button.Apply"));
    printButton = new JButton(rb.getString("Button.PrintSample"));
    closeButton = new JButton(rb.getString("Button.Close"));
    nameField = new JTextFieldEx();
    typeCombo = new JComboBox<>();
    DefaultComboBoxModel<CheckObjectType> comboModel = new DefaultComboBoxModel<>(CheckObjectType.values());
    typeCombo.setModel(comboModel);
    model = new DefaultListModel<>();
    objectList.setModel(model);
    objectList.addListSelectionListener(this);
    addButton.addActionListener(this);
    applyButton.addActionListener(this);
    closeButton.addActionListener(this);
    clearButton.addActionListener(this);
    countField.addActionListener(this);
    removeButton.addActionListener(this);
    setupButton.addActionListener(this);
    heightField.addActionListener(this);
    saveButton.addActionListener(this);
    openButton.addActionListener(this);
    printButton.addActionListener(this);
    heightField.addFocusListener(this);
    countField.addFocusListener(this);
}
Also used : RollOverButton(jgnash.ui.components.RollOverButton) JButton(javax.swing.JButton) JToolBar(javax.swing.JToolBar) JTextFieldEx(jgnash.ui.components.JTextFieldEx) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) CheckObjectType(jgnash.engine.checks.CheckObject.CheckObjectType) CheckLayout(jgnash.engine.checks.CheckLayout)

Example 2 with CheckLayout

use of jgnash.engine.checks.CheckLayout in project jgnash by ccavanaugh.

the class PrintCheckFactory method showDialog.

/**
     * Print checks
     */
public static void showDialog() {
    EventQueue.invokeLater(() -> {
        // Automatically increment the check number
        boolean checkNum;
        TransactionListDialog tld = new TransactionListDialog();
        tld.setVisible(true);
        if (!tld.getReturnStatus() || tld.getPrintableTransactions().isEmpty()) {
            return;
        }
        PrintCheckDialog pcd = new PrintCheckDialog();
        pcd.setVisible(true);
        if (!pcd.getReturnStatus()) {
            return;
        }
        CheckLayout checkLayout = pcd.getCheckLayout();
        int numChecks = checkLayout.getNumberOfChecks();
        int startPosition = pcd.getStartPosition();
        List<Transaction> trans = tld.getPrintableTransactions();
        checkNum = pcd.incrementCheckNumbers();
        int i = 0;
        while (i < trans.size()) {
            Transaction[] pTrans = new Transaction[numChecks];
            for (int j = startPosition; j < numChecks && i < trans.size(); j++) {
                if (checkNum) {
                    trans.set(i, changeTransNum(trans.get(i)));
                }
                pTrans[j] = trans.get(i);
                i++;
            }
            // first iteration is a special case
            startPosition = 0;
            PrintableCheckLayout layout = new PrintableCheckLayout(checkLayout);
            // print the first sheet
            layout.print(pTrans);
        }
    });
}
Also used : Transaction(jgnash.engine.Transaction) CheckLayout(jgnash.engine.checks.CheckLayout)

Aggregations

CheckLayout (jgnash.engine.checks.CheckLayout)2 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)1 JButton (javax.swing.JButton)1 JToolBar (javax.swing.JToolBar)1 Transaction (jgnash.engine.Transaction)1 CheckObjectType (jgnash.engine.checks.CheckObject.CheckObjectType)1 JTextFieldEx (jgnash.ui.components.JTextFieldEx)1 RollOverButton (jgnash.ui.components.RollOverButton)1