/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 2014 Oracle and/or its affiliates. All rights reserved. * * Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common * Development and Distribution License("CDDL") (collectively, the * "License"). You may not use this file except in compliance with the * License. You can obtain a copy of the License at * http://www.netbeans.org/cddl-gplv2.html * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the * specific language governing permissions and limitations under the * License. When distributing the software, include this License Header * Notice in each file and include the License file at * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the GPL Version 2 section of the License file that * accompanied this code. If applicable, add the following below the * License Header, with the fields enclosed by brackets [] replaced by * your own identifying information: * "Portions Copyrighted [year] [name of copyright owner]" * * If you wish your version of this file to be governed by only the CDDL * or only the GPL Version 2, indicate your decision by adding * "[Contributor] elects to include this software in this distribution * under the [CDDL or GPL Version 2] license." If you do not indicate a * single choice of license, a recipient has the option to distribute * your version of this file under either the CDDL, the GPL Version 2 or * to extend the choice of license to its licensees as provided above. * However, if you add GPL Version 2 code and therefore, elected the GPL * Version 2 license, then the option applies only if the new code is * made subject to such option by the copyright holder. * * Contributor(s): * * Portions Copyrighted 2014 Sun Microsystems, Inc. */ package com.junichi11.netbeans.modules.github.issues.options; final class GitHubIssuesOptionsPanel extends javax.swing.JPanel { private static final long serialVersionUID = 1179834339454169527L; private final GitHubIssuesOptionsPanelController controller; GitHubIssuesOptionsPanel(GitHubIssuesOptionsPanelController controller) { this.controller = controller; initComponents(); // TODO listen to changes in form fields and call controller.changed() } /** * 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() { defaultQueriesSeparator = new javax.swing.JSeparator(); defaultQueriesLabel = new javax.swing.JLabel(); openCheckBox = new javax.swing.JCheckBox(); assignedToMeCheckBox = new javax.swing.JCheckBox(); createdByMeCheckBox = new javax.swing.JCheckBox(); repositoriesSeparator = new javax.swing.JSeparator(); repositoriesLabel = new javax.swing.JLabel(); showParentRepositoryCheckBox = new javax.swing.JCheckBox(); issuesSeparator = new javax.swing.JSeparator(); issuesLabel = new javax.swing.JLabel(); insertTemplateCheckBox = new javax.swing.JCheckBox(); org.openide.awt.Mnemonics.setLocalizedText(defaultQueriesLabel, org.openide.util.NbBundle.getMessage(GitHubIssuesOptionsPanel.class, "GitHubIssuesOptionsPanel.defaultQueriesLabel.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(openCheckBox, org.openide.util.NbBundle.getMessage(GitHubIssuesOptionsPanel.class, "GitHubIssuesOptionsPanel.openCheckBox.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(assignedToMeCheckBox, org.openide.util.NbBundle.getMessage(GitHubIssuesOptionsPanel.class, "GitHubIssuesOptionsPanel.assignedToMeCheckBox.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(createdByMeCheckBox, org.openide.util.NbBundle.getMessage(GitHubIssuesOptionsPanel.class, "GitHubIssuesOptionsPanel.createdByMeCheckBox.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(repositoriesLabel, org.openide.util.NbBundle.getMessage(GitHubIssuesOptionsPanel.class, "GitHubIssuesOptionsPanel.repositoriesLabel.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(showParentRepositoryCheckBox, org.openide.util.NbBundle.getMessage(GitHubIssuesOptionsPanel.class, "GitHubIssuesOptionsPanel.showParentRepositoryCheckBox.text")); // NOI18N showParentRepositoryCheckBox.setToolTipText(org.openide.util.NbBundle.getMessage(GitHubIssuesOptionsPanel.class, "GitHubIssuesOptionsPanel.showParentRepositoryCheckBox.toolTipText")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(issuesLabel, org.openide.util.NbBundle.getMessage(GitHubIssuesOptionsPanel.class, "GitHubIssuesOptionsPanel.issuesLabel.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(insertTemplateCheckBox, org.openide.util.NbBundle.getMessage(GitHubIssuesOptionsPanel.class, "GitHubIssuesOptionsPanel.insertTemplateCheckBox.text")); // 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.LEADING) .addGroup(layout.createSequentialGroup() .addGap(12, 12, 12) .addComponent(insertTemplateCheckBox) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(issuesLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(issuesSeparator)) .addGroup(layout.createSequentialGroup() .addComponent(repositoriesLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(repositoriesSeparator)) .addGroup(layout.createSequentialGroup() .addComponent(defaultQueriesLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(defaultQueriesSeparator)) .addGroup(layout.createSequentialGroup() .addGap(12, 12, 12) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(showParentRepositoryCheckBox) .addComponent(createdByMeCheckBox) .addComponent(openCheckBox) .addComponent(assignedToMeCheckBox)) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(defaultQueriesLabel) .addComponent(defaultQueriesSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(openCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addComponent(assignedToMeCheckBox) .addGap(7, 7, 7) .addComponent(createdByMeCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(repositoriesLabel)) .addComponent(repositoriesSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(showParentRepositoryCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(issuesLabel) .addComponent(issuesSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(insertTemplateCheckBox) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); }// </editor-fold>//GEN-END:initComponents void load() { // queries GitHubIssuesOptions options = GitHubIssuesOptions.getInstance(); setOpenQuery(options.isOpenQuery()); setAssignedToMeQuery(options.isAssignedToMeQuery()); setCreatedByMeQuery(options.isCreatedByMeQuery()); // repositories setShowParentRepository(options.showParentRepository()); // issues setInsertDefaultTemplate(options.insertDefaultTemplate()); } void store() { // queries GitHubIssuesOptions options = GitHubIssuesOptions.getInstance(); options.setOpenQuery(isOpenQuery()); options.setAssignedToMeQuery(isAssignedToMeQuery()); options.setCreatedByMeQuery(isCreatedByMeQuery()); // repositories options.setShowParentRepository(showParentRepository()); // issues options.setInsertDefaultTemplate(insertDefaultTemplate()); } boolean valid() { // TODO check whether form is consistent and complete return true; } private boolean isOpenQuery() { return openCheckBox.isSelected(); } private boolean isAssignedToMeQuery() { return assignedToMeCheckBox.isSelected(); } private boolean isCreatedByMeQuery() { return createdByMeCheckBox.isSelected(); } private void setOpenQuery(boolean isEnabled) { openCheckBox.setSelected(isEnabled); } private void setAssignedToMeQuery(boolean isEnabled) { assignedToMeCheckBox.setSelected(isEnabled); } private void setCreatedByMeQuery(boolean isEnabled) { createdByMeCheckBox.setSelected(isEnabled); } // repositories private boolean showParentRepository() { return showParentRepositoryCheckBox.isSelected(); } private void setShowParentRepository(boolean showParent) { showParentRepositoryCheckBox.setSelected(showParent); } // issues private boolean insertDefaultTemplate() { return insertTemplateCheckBox.isSelected(); } private void setInsertDefaultTemplate(boolean insert) { insertTemplateCheckBox.setSelected(insert); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JCheckBox assignedToMeCheckBox; private javax.swing.JCheckBox createdByMeCheckBox; private javax.swing.JLabel defaultQueriesLabel; private javax.swing.JSeparator defaultQueriesSeparator; private javax.swing.JCheckBox insertTemplateCheckBox; private javax.swing.JLabel issuesLabel; private javax.swing.JSeparator issuesSeparator; private javax.swing.JCheckBox openCheckBox; private javax.swing.JLabel repositoriesLabel; private javax.swing.JSeparator repositoriesSeparator; private javax.swing.JCheckBox showParentRepositoryCheckBox; // End of variables declaration//GEN-END:variables }