Gmail API的history.list错误的messagesAdded值

时间:2017-03-30 07:47:46

标签: gmail-api

建议history list端点使用特定的更改类型字段,例如public class TaskFrame extends JFrame implements ActionListener { private JPanel taskPanel, buttonPanel, viewPanel, titlePanel; private JButton editButton; private String[] labelNames = {"Notes", "Paging", "Event Mgmt - Early", "Event Mgmt - Late", "Airhub 2DA", "Airhub 1DA", "GSSD", "GSSI", "GSSRR", "Holdovers", "Radio", "PTI", "Phones 1300", "Publishing"}; private JLabel[] labelArray = new JLabel[labelNames.length]; private JLabel titleLabel = new JLabel("Task Dashboard"); private JTextField[] textArray = new JTextField[labelNames.length]; private String[] namesArray = new String[labelNames.length]; private Font titleFont = new Font("Helvetica", Font.BOLD, 24); private Color backgroundColor = new Color(255,250,245); @Override public void actionPerformed(ActionEvent arg0) { } public static void main(String[] args) { TaskFrame frame = new TaskFrame(); frame.setTitle("Task List"); frame.setSize(300, 450); frame.setResizable(false); frame.setVisible(true); } public TaskFrame() { //Create the locked task panel taskPanel = new JPanel(new GridLayout(14,2,1,2)); buttonPanel = new JPanel(new FlowLayout()); titlePanel = new JPanel(new FlowLayout()); titleLabel.setFont(titleFont); titlePanel.add(titleLabel, SwingConstants.CENTER); viewPanel = new JPanel(new FlowLayout()); //create the button object and assign the event handler editButton = new JButton("Edit Tasks"); editButton.setPreferredSize(new Dimension(100,25)); editButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(!textArray[0].isEditable()) { for(int i = 0; i < labelNames.length; i++) { textArray[i].setEditable(true); } editButton.setText("Save Tasks"); } else { try { PrintWriter writeNames = new PrintWriter("Techs.txt", "UTF-8"); for(int i = 0; i < labelNames.length; i ++) { writeNames.println(textArray[i].getText()); textArray[i].setEditable(false); } writeNames.close(); } catch (FileNotFoundException e1) { e1.getMessage(); } catch (UnsupportedEncodingException e1) { e1.getMessage(); } } } }); buttonPanel.add(editButton); //Loop to create all the viewPanel objects, JLabels and JTextFields try { FileReader fr = new FileReader("Techs.txt"); BufferedReader br = new BufferedReader(fr); for(int i = 0; i < labelNames.length; i++) { labelArray[i] = new JLabel(labelNames[i] + ": ", SwingConstants.LEFT); textArray[i] = new JTextField(10); namesArray[i] = new String(); namesArray[i] = br.readLine(); textArray[i].setText(namesArray[i]); textArray[i].setEditable(false); taskPanel.add(labelArray[i]); taskPanel.add(textArray[i]); } } catch (FileNotFoundException e1) { e1.getMessage(); } catch (IOException e1) { e1.getMessage(); } //Assign the defined background color to all panels titlePanel.setBackground(backgroundColor); taskPanel.setBackground(backgroundColor); buttonPanel.setBackground(backgroundColor); viewPanel.setBackground(backgroundColor); viewPanel.add(titlePanel, BorderLayout.NORTH); viewPanel.add(taskPanel, BorderLayout.CENTER); viewPanel.add(buttonPanel, BorderLayout.SOUTH); add(viewPanel); viewPanel.setVisible(true); } } 而不是messagesAdded字段。

但是我注意到,当收到带有附件或没有正文的电子邮件(只是主题)时,messages字段为空,而messagesAdded字段有条目。

这是正确的行为吗?我期待messages键也带有值。

0 个答案:

没有答案