All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pekinsoft.desktop.notifications.support.DetailsPanel Maven / Gradle / Ivy

/*
 * Copyright (C) 2024 PekinSOFT Systems
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see .
 *
 * *****************************************************************************
 *  Project    :   application-framework-api
 *  Class      :   DetailsPanel.java
 *  Author     :   Sean Carrick
 *  Created    :   Oct 28, 2024
 *  Modified   :   Oct 28, 2024
 *
 *  Purpose: See class JavaDoc for explanation
 *
 *  Revision History:
 *
 *  WHEN          BY                   REASON
 *  ------------  -------------------  -----------------------------------------
 *  Oct 28, 2024  Sean Carrick         Initial creation.
 * *****************************************************************************
 */
package com.pekinsoft.desktop.notifications.support;

import com.pekinsoft.desktop.error.*;
import com.pekinsoft.framework.*;
import com.pekinsoft.lookup.Lookup;
import java.awt.event.ActionEvent;

/**
 *
 * @author Sean Carrick
 */
public class DetailsPanel extends javax.swing.JPanel {

    /**
     * Creates new form DetailsPanel
     */
    public DetailsPanel(ErrorInfo info) {
        resourceMap = Application.getInstance().getContext()
                .getResourceMap(getClass());
        this.info = info;
        initComponents();
    }

    @AppAction
    public void showMessage(ActionEvent evt) {
        if (info.getErrorLevel() == ErrorLevel.CRITICAL
                || info.getErrorLevel() == ErrorLevel.FATAL) {
            ErrorPane.showErrorDialog(info,
                    Lookup.getDefault().lookup(ErrorReporter.class));
        } else {
            ErrorPane.showErrorDialog(info);
        }
    }

    /**
     * This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // //GEN-BEGIN:initComponents
    private void initComponents() {

        categoryLabel = new javax.swing.JLabel();
        categoryField = new javax.swing.JLabel();
        levelLabel = new javax.swing.JLabel();
        levelField = new javax.swing.JLabel();
        basicMessageLabel = new javax.swing.JLabel();
        basicMessageField = new javax.swing.JTextField();
        showMessageButton = new javax.swing.JButton();

        categoryLabel.setText("category");
        categoryLabel.setName("categoryLabel"); // NOI18N

        categoryField.setText("jLabel1");
        categoryField.setName("categoryField"); // NOI18N

        levelLabel.setText("level");
        levelLabel.setName("levelLabel"); // NOI18N

        levelField.setText("jLabel1");
        levelField.setName("levelField"); // NOI18N

        basicMessageLabel.setText("basic message");
        basicMessageLabel.setName("basicMessageLabel"); // NOI18N

        basicMessageField.setEditable(false);
        basicMessageField.setText("jTextField1");
        basicMessageField.setName("basicMessageField"); // NOI18N

        showMessageButton.setText("jButton1");
        showMessageButton.setName("showMessageButton"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(basicMessageLabel)
                    .addComponent(levelLabel)
                    .addComponent(categoryLabel))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(basicMessageField)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(showMessageButton)
                            .addComponent(categoryField)
                            .addComponent(levelField))
                        .addGap(0, 305, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(categoryLabel)
                    .addComponent(categoryField))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(levelLabel)
                    .addComponent(levelField))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(basicMessageLabel)
                    .addComponent(basicMessageField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(showMessageButton)
                .addContainerGap(391, Short.MAX_VALUE))
        );

        resourceMap.injectComponents(this);
    }// //GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField basicMessageField;
    private javax.swing.JLabel basicMessageLabel;
    private javax.swing.JLabel categoryField;
    private javax.swing.JLabel categoryLabel;
    private javax.swing.JLabel levelField;
    private javax.swing.JLabel levelLabel;
    private javax.swing.JButton showMessageButton;
    // End of variables declaration//GEN-END:variables

    private final ResourceMap resourceMap;
    private final ErrorInfo info;

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy