testresultsectionform.java

来自「cqME :java framework for TCK test.」· Java 代码 · 共 413 行 · 第 1/2 页

JAVA
413
字号
            styleSheet.addRule("h3    { margin-top:15 }");
            styleSheet.addRule("table { margin-left:30; margin-top:0 }");
        }
        return styleSheet;
    }

    
    private class SectionListener implements HyperlinkListener {
	public void hyperlinkUpdate(HyperlinkEvent e) {
	    if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
		String desc = e.getDescription();
		if (desc.startsWith("#")) {
		    String outputName = desc.substring(1);
                    
                    TestResult.Section section = getCurrentSection();
                    String [] names = section.getOutputNames();
                    for (int i = 0; i < names.length; i++ ) {
                        if (names[i].equals(outputName)) {
                            outputCombo.setSelectedIndex(i);
                            return;
                        }
                    }
		}
		else {
                    int sectIndex = Integer.parseInt(desc);
                    sectionCombo.setSelectedIndex(sectIndex);
		}
	    }
	}
    }
    
    
    /**
     * Creates new form TestResultSectionForm
     */
    public TestResultSectionForm() {
        initComponents();
    }
    
    /** 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.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        sectionCombo = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        outputCombo = new javax.swing.JComboBox();
        jScrollPane3 = new javax.swing.JScrollPane();
        statusPane = new javax.swing.JEditorPane();
        jSplitPane1 = new javax.swing.JSplitPane();
        jScrollPane1 = new javax.swing.JScrollPane();
        htmlPane = new javax.swing.JEditorPane();
        jScrollPane2 = new javax.swing.JScrollPane();
        textPane = new javax.swing.JTextArea();

        sectionCombo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                sectionComboActionPerformed(evt);
            }
        });

        jLabel2.setText("Sections");

        jLabel3.setText("Output");

        outputCombo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                outputComboActionPerformed(evt);
            }
        });

        statusPane.setDocument(new HTMLDocument());
        statusPane.setEditable(false);
        statusPane.setEditorKit(new HTMLEditorKit());
        jScrollPane3.setViewportView(statusPane);

        jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
        jSplitPane1.setResizeWeight(0.8);
        htmlPane.setDocument(new HTMLDocument());
        htmlPane.setEditable(false);
        htmlPane.setEditorKit(new HTMLEditorKit());
        htmlPane.setPreferredSize(new java.awt.Dimension(106, 60));
        jScrollPane1.setViewportView(htmlPane);

        jSplitPane1.setTopComponent(jScrollPane1);

        textPane.setColumns(20);
        textPane.setEditable(false);
        textPane.setLineWrap(true);
        textPane.setRows(5);
        jScrollPane2.setViewportView(textPane);

        jSplitPane1.setRightComponent(jScrollPane2);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(44, 44, 44)
                        .add(sectionCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 127, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jLabel3)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(outputCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 132, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(jLabel2))
                .addContainerGap(128, Short.MAX_VALUE))
            .add(jScrollPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 483, Short.MAX_VALUE)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(jSplitPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 473, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel2)
                    .add(sectionCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel3)
                    .add(outputCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jSplitPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 557, Short.MAX_VALUE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jScrollPane3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 55, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void outputComboActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_outputComboActionPerformed
        if (updateCombo) {
            SwingUtilities.invokeLater(
                new Runnable() {
                    public void run() {
                        updateOutputView();
                    }
                });
        }
    }//GEN-LAST:event_outputComboActionPerformed

    private void sectionComboActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sectionComboActionPerformed
        if (updateCombo) {
            SwingUtilities.invokeLater(
                new Runnable() {
                    public void run() {
                        updateOutputCombo();
                        updateOutputView();
                    }
                });
        }
    }//GEN-LAST:event_sectionComboActionPerformed

    private void closeEditor() {
        SwingUtilities.invokeLater(
            new Runnable() {
                public void run() {
                    editor.close();
                }
            });
    }
    
    public void fileFolderCreated(FileEvent fe) {
    }

    public void fileDataCreated(FileEvent fe) {
    }

    public void fileChanged(FileEvent fe) {
        updateSectionCombo();
        updateOutputCombo();
        updateOutputView();
    }

    public void fileDeleted(FileEvent fe) {
        closeEditor();
    }

    public void fileRenamed(FileRenameEvent fe) {
    }

    public void fileAttributeChanged(FileAttributeEvent fe) {
    }
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JEditorPane htmlPane;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JSplitPane jSplitPane1;
    private javax.swing.JComboBox outputCombo;
    private javax.swing.JComboBox sectionCombo;
    private javax.swing.JEditorPane statusPane;
    private javax.swing.JTextArea textPane;
    // End of variables declaration//GEN-END:variables
    
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?