📄 csvsettingspanel.java
字号:
/*************************************************************************** CSVSettingsPanel.java ----------------- begin : 7 juil. 2004 copyright : (C) 2004 by Thomas Alexandre email : alexthomas@ganttproject.org ***************************************************************************//*************************************************************************** * * * 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 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/package net.sourceforge.ganttproject.gui.options;import java.awt.BorderLayout;import java.awt.Component;import java.awt.Container;import java.awt.FlowLayout;import java.awt.Font;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JCheckBox;import javax.swing.JComboBox;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JRadioButton;import javax.swing.JSeparator;import javax.swing.JTextField;import net.sourceforge.ganttproject.GanttProject;import net.sourceforge.ganttproject.io.CSVOptions;import net.sourceforge.ganttproject.language.GanttLanguage;/** * @author athomas Panel to edit the text export parameters */public class CSVSettingsPanel extends GeneralOptionPanel implements ActionListener { JRadioButton bFixedSize = null; JRadioButton bSeparatedText = null; JRadioButton bDoubleDot = null; JRadioButton bDotComa = null; JRadioButton bComa = null; JRadioButton bSpace = null; JRadioButton bOther = null; JComboBox cbTextSeparator = null; JTextField tfOther = null; JCheckBox cbTaskID; JCheckBox cbTaskName; JCheckBox cbStartDate; JCheckBox cbEndDate; JCheckBox cbTaskPercent; JCheckBox cbTaskDuration; JCheckBox cbTaskWebLink; JCheckBox cbTaskResources; JCheckBox cbTaskNotes; JCheckBox cbResID; JCheckBox cbResName; JCheckBox cbResMail; JCheckBox cbResPhone; JCheckBox cbResRole; private GanttProject appli; /** Constructor. */ public CSVSettingsPanel(GanttProject parent) { super(GanttProject.correctLabel(GanttLanguage.getInstance().getText( "csvexport")), GanttLanguage.getInstance().getText( "settingsCVSExport"), parent); appli = parent; vb.add(new JSeparator()); JPanel genePanel = new JPanel(new BorderLayout()); JLabel lblSeparatedField = new JLabel(language .getText("separatedFields")); lblSeparatedField.setFont(new Font(lblSeparatedField.getFont() .getFontName(), Font.BOLD, lblSeparatedField.getFont() .getSize())); genePanel.add(lblSeparatedField, BorderLayout.WEST); vb.add(genePanel); JPanel fixedPanel = new JPanel(new BorderLayout()); fixedPanel.add(bFixedSize = new JRadioButton(), BorderLayout.WEST); // bFixedSize.setEnabled(false); bFixedSize.addActionListener(this); fixedPanel.add(new JLabel(language.getText("fixedWidth")), BorderLayout.CENTER); vb.add(fixedPanel); JPanel separatedPanel = new JPanel(new BorderLayout()); separatedPanel.add(bSeparatedText = new JRadioButton(), BorderLayout.WEST); bSeparatedText.addActionListener(this); separatedPanel.add(new JLabel(language.getText("separated")), BorderLayout.CENTER); vb.add(separatedPanel); JPanel separatorFieldPanel = new JPanel(new GridBagLayout()); vb.add(separatorFieldPanel); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.WEST; gbc.insets.right = 15; gbc.insets.left = 10; gbc.insets.top = 10; addUsingGBL(separatorFieldPanel, bDoubleDot = new JRadioButton(), gbc, 0, 0, 1, 1); bDoubleDot.addActionListener(this); addUsingGBL(separatorFieldPanel, new JLabel(language .getText("doubledot")), gbc, 1, 0, 1, 1); addUsingGBL(separatorFieldPanel, bDotComa = new JRadioButton(), gbc, 3, 0, 1, 1); bDotComa.addActionListener(this); addUsingGBL(separatorFieldPanel, new JLabel(language.getText("dotComa")), gbc, 4, 0, 1, 1); addUsingGBL(separatorFieldPanel, bComa = new JRadioButton(), gbc, 6, 0, 1, 1); bComa.addActionListener(this); addUsingGBL(separatorFieldPanel, new JLabel(language.getText("coma")), gbc, 7, 0, 1, 1); bSpace = new JRadioButton(); // addUsingGBL(separatorFieldPanel, bSpace , gbc, 0, 1, 1, 1); bSpace.addActionListener(this); // addUsingGBL(separatorFieldPanel, new // JLabel(language.getText("space")), gbc, 1, 1, 1, 1); addUsingGBL(separatorFieldPanel, bOther = new JRadioButton(), gbc, 6, 1, 1, 1); bOther.addActionListener(this); addUsingGBL(separatorFieldPanel, new JLabel(language.getText("other")), gbc, 7, 1, 1, 1); addUsingGBL(separatorFieldPanel, tfOther = new JTextField(5), gbc, 8, 1, 1, 1); JPanel textSeparatorFieldPanel = new JPanel(new FlowLayout()); vb.add(textSeparatorFieldPanel); textSeparatorFieldPanel.add(new JLabel(language .getText("textSeparator"))); cbTextSeparator = new JComboBox(appli.getOptions().getCSVOptions() .getSeparatedTextChars()); textSeparatorFieldPanel.add(new JLabel(" ")); textSeparatorFieldPanel.add(cbTextSeparator); vb.add(new JPanel()); // ///////////////////////////////////////////////// vb.add(new JSeparator()); JPanel taskPanel = new JPanel(new BorderLayout()); JLabel lblTaskField = new JLabel(language.getText("taskFields")); lblTaskField.setFont(new Font(lblTaskField.getFont().getFontName(), Font.BOLD, lblTaskField.getFont().getSize())); taskPanel.add(lblTaskField, BorderLayout.WEST); vb.add(taskPanel); JPanel taskFieldPanel = new JPanel(new GridBagLayout()); vb.add(taskFieldPanel); addUsingGBL(taskFieldPanel, cbTaskID = new JCheckBox(), gbc, 0, 0, 1, 1); addUsingGBL(taskFieldPanel, new JLabel(language.getText("id")), gbc, 1, 0, 1, 1); addUsingGBL(taskFieldPanel, cbTaskName = new JCheckBox(), gbc, 3, 0, 1, 1); addUsingGBL(taskFieldPanel, new JLabel(language.getText("name")), gbc, 4, 0, 1, 1); addUsingGBL(taskFieldPanel, cbTaskDuration = new JCheckBox(), gbc, 6, 0, 1, 1); addUsingGBL(taskFieldPanel, new JLabel(language.getText("length")), gbc, 7, 0, 1, 1); addUsingGBL(taskFieldPanel, cbStartDate = new JCheckBox(), gbc, 0, 1, 1, 1); addUsingGBL(taskFieldPanel, new JLabel(language .getText("dateOfBegining")), gbc, 1, 1, 1, 1); addUsingGBL(taskFieldPanel, cbEndDate = new JCheckBox(), gbc, 3, 1, 1, 1); addUsingGBL(taskFieldPanel, new JLabel(language.getText("dateOfEnd")), gbc, 4, 1, 1, 1); addUsingGBL(taskFieldPanel, cbTaskPercent = new JCheckBox(), gbc, 6, 1, 1, 1); addUsingGBL(taskFieldPanel, new JLabel(language.getText("advancement")), gbc, 7, 1, 1, 1); addUsingGBL(taskFieldPanel, cbTaskWebLink = new JCheckBox(), gbc, 0, 2, 1, 1); addUsingGBL(taskFieldPanel, new JLabel(language.getText("webLink")), gbc, 1, 2, 1, 1); addUsingGBL(taskFieldPanel, cbTaskResources = new JCheckBox(), gbc, 3, 2, 1, 1); addUsingGBL(taskFieldPanel, new JLabel(language.getText("resources")), gbc, 4, 2, 1, 1); addUsingGBL(taskFieldPanel, cbTaskNotes = new JCheckBox(), gbc, 6, 2, 1, 1); addUsingGBL(taskFieldPanel, new JLabel(language.getText("notes")), gbc, 7, 2, 1, 1); vb.add(new JPanel()); // ///////////////////////////////////////////////// vb.add(new JSeparator()); JPanel resPanel = new JPanel(new BorderLayout()); JLabel lblResField = new JLabel(language.getText("resFields")); lblResField.setFont(new Font(lblResField.getFont().getFontName(), Font.BOLD, lblResField.getFont().getSize())); resPanel.add(lblResField, BorderLayout.WEST); vb.add(resPanel); JPanel resFieldPanel = new JPanel(new GridBagLayout()); vb.add(resFieldPanel); addUsingGBL(resFieldPanel, cbResID = new JCheckBox(), gbc, 0, 0, 1, 1); addUsingGBL(resFieldPanel, new JLabel(language.getText("id")), gbc, 1, 0, 1, 1); addUsingGBL(resFieldPanel, cbResName = new JCheckBox(), gbc, 3, 0, 1, 1); addUsingGBL(resFieldPanel, new JLabel(language.getText("colName")), gbc, 4, 0, 1, 1); addUsingGBL(resFieldPanel, cbResMail = new JCheckBox(), gbc, 6, 0, 1, 1); addUsingGBL(resFieldPanel, new JLabel(language.getText("colMail")), gbc, 7, 0, 1, 1); addUsingGBL(resFieldPanel, cbResPhone = new JCheckBox(), gbc, 0, 1, 1, 1); addUsingGBL(resFieldPanel, new JLabel(language.getText("colPhone")), gbc, 1, 1, 1, 1); addUsingGBL(resFieldPanel, cbResRole = new JCheckBox(), gbc, 3, 1, 1, 1); addUsingGBL(resFieldPanel, new JLabel(language.getText("colRole")), gbc, 4, 1, 1, 1); applyComponentOrientation(language.getComponentOrientation()); } /** add a component to container by using GridBagConstraints. */ private void addUsingGBL(Container container, Component component, GridBagConstraints gbc, int x, int y, int w, int h) { gbc.gridx = x; gbc.gridy = y; gbc.gridwidth = w; gbc.gridheight = h; gbc.weighty = 0; container.add(component, gbc); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -