|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2002 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.tasklist.compiler; import java.awt.BorderLayout; import java.awt.Component; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.JComponent; import javax.swing.UIManager; import org.netbeans.modules.tasklist.core.checklist.CheckList; import org.netbeans.modules.tasklist.core.checklist.CheckListModel; import org.netbeans.modules.tasklist.core.checklist.DefaultCheckListModel; import org.netbeans.modules.tasklist.core.filter.FilterCondition; import org.openide.util.NbBundle; /** * "Severity is" - condition * * @author Tim Lebedkov */ public class SeverityFilterCondition extends FilterCondition { /** * Creates an array of filter conditions for the specified property * * @param index index of the property */ public static SeverityFilterCondition[] createConditions(int index) { return new SeverityFilterCondition[] { new SeverityFilterCondition(index), }; }; private boolean err = true, warn = true, info = true; /** * Creates a new instance * * @param prop index of the property */ public SeverityFilterCondition(int prop) { super(prop, NbBundle.getMessage( SeverityFilterCondition.class, "IsOneOf")); // NOI18N } public boolean isTrue(Object o1) { int k = ((Integer) o1).intValue(); return k == CompileError.SEVERITY_ERROR && err || k == CompileError.SEVERITY_WARNING && warn || k == CompileError.SEVERITY_INFO && info; } public JComponent createConstantComponent() { CheckList list = new CheckList( new DefaultCheckListModel( new boolean[] { err, warn, info}, CompileError.getSeverityNames() ) ); JPanel panel = new JPanel(new BorderLayout()); panel.setOpaque(false); panel.setBorder(BorderFactory.createCompoundBorder( UIManager.getBorder("TextField.border"), // NOI18N BorderFactory.createEmptyBorder(2, 2, 2, 2) )); panel.setToolTipText(Util.getString("sever_desc")); panel.add(list, BorderLayout.CENTER); return panel; } public void getConstantFrom(JComponent cmp) { CheckList l = (CheckList) ((JPanel) cmp).getComponent(0); CheckListModel m = (CheckListModel) l.getModel(); err = m.isChecked(0); warn = m.isChecked(1); info = m.isChecked(2); } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.