RecordingDialog.java
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
3  * All rights reserved. This program is made available under the terms of the
4  * Eclipse Public License v1.0 which accompanies this distribution, and is
5  * available at http://www.eclipse.org/legal/epl-v10.html
6  * Contributors:
7  * General Robotix Inc.
8  * National Institute of Advanced Industrial Science and Technology (AIST)
9  */
17 package com.generalrobotix.ui.view.tdview;
18 
19 import java.awt.*;
20 import javax.swing.*;
21 
26 
27 @SuppressWarnings("serial") //$NON-NLS-1$
28 public class RecordingDialog extends ModalDialog {
29 
30 // --------------------------------------------------------------------
31  // Instance variables
32  private static final Dimension[] imageSize_ =
33  new Dimension[] {
34  new Dimension(320, 240),
35  new Dimension(640, 480),
36  new Dimension(800, 600),
37  };
38  private static final double[] playbackRate_ =
39  new double[] { 4, 2, 1, 0.5, 0.25 };
40  private static final String[] playbackRateString_ =
41  new String[] { "x 4", "x 2", "x 1", "x 1/2", "x 1/4" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
42 
44  private JComboBox imSizeCombo_;
45  private JComboBox playbackRateCombo_;
46  private JTextField frameRateField_;
47  private JTextField startTimeField_;
48  private JTextField endTimeField_;
49  private double logEndTime_;
50  public RecordingDialog(Frame owner, double endTime) {
51  super(
52  owner,
53  MessageBundle.get("RecordingDialog.dialog.title.recording"), //$NON-NLS-1$
54  MessageBundle.get("RecordingDialog.dialog.message.recording"), //$NON-NLS-1$
55  OK_CANCEL_TYPE
56  );
57 
58  fileInput_ = new FileInput(new String[] { "mov" }, Activator.getDefault().getPreferenceStore().getString("PROJECT_DIR")); //$NON-NLS-1$ //$NON-NLS-2$
59  imSizeCombo_ = new JComboBox(_makeSizeStrings(imageSize_));
60  playbackRateCombo_ = new JComboBox(playbackRateString_);
61  playbackRateCombo_.setSelectedIndex(2);
62  frameRateField_ = new JTextField("10"); //$NON-NLS-1$
63  startTimeField_ = new JTextField("0.0");
64  endTimeField_ = new JTextField(String.format("%.5f", endTime));
65  logEndTime_ = endTime;
66 
67  addInputComponent(MessageBundle.get("RecordingDialog.label.fileName"), fileInput_, MULTILINE_CAPTION, true); //$NON-NLS-1$
68  addInputComponent(MessageBundle.get("RecordingDialog.label.imageSize"), imSizeCombo_, MULTILINE_CAPTION, true); //$NON-NLS-1$
69  addInputComponent(MessageBundle.get("RecordingDialog.label.playRate"), playbackRateCombo_, MULTILINE_CAPTION, true); //$NON-NLS-1$
70  addInputComponent(MessageBundle.get("RecordingDialog.label.frameRate"), frameRateField_, MULTILINE_CAPTION, true); //$NON-NLS-1$
71  addInputComponent(MessageBundle.get("RecordingDialog.label.startTime"), startTimeField_, INLINE_CAPTION, true);
72  addInputComponent(MessageBundle.get("RecordingDialog.label.endTime"), endTimeField_, INLINE_CAPTION, true);
73  setInputAreaWidth(300);
74  }
75 
76  public double getStartTime(){
77  double startTime;
78  try{
79  startTime = Double.parseDouble(startTimeField_.getText());
80  }catch (NumberFormatException e){
81  startTime = 0.0;
82  }
83  if(startTime < 0.0)
84  startTime = 0.0;
85  return startTime;
86  }
87 
88  public double getEndTime(){
89  double endTime;
90  try{
91  endTime = Double.parseDouble(endTimeField_.getText());
92  }catch (NumberFormatException e){
93  endTime = 0.0;
94  }
95  if(endTime > logEndTime_)
96  endTime = logEndTime_;
97  return endTime;
98  }
99 
100  public String getFileName() {
101  return fileInput_.getFileName();
102  }
103 
104  public Dimension getImageSize() {
105  return new Dimension(imageSize_[imSizeCombo_.getSelectedIndex()]);
106  }
107 
108  public double getPlaybackRate() throws NumberFormatException {
109  return playbackRate_[playbackRateCombo_.getSelectedIndex()];
110  }
111 
112  public int getFrameRate() throws NumberFormatException {
113  return Integer.parseInt(frameRateField_.getText());
114  }
115 
116  private String[] _makeSizeStrings(Dimension[] size) {
117  String[] sizeString = new String[size.length];
118  for (int i = 0; i < size.length; i ++) {
119  StringBuffer buf = new StringBuffer();
120  buf.append(size[i].width);
121  buf.append('x');
122  buf.append(size[i].height);
123  sizeString[i] = buf.toString();
124  }
125  return sizeString;
126  }
127 
128  }
static final String get(String key)
png_uint_32 size
Definition: png.h:1521
png_uint_32 i
Definition: png.h:2735
png_infop png_uint_32 * width
Definition: png.h:2309
png_infop png_uint_32 png_uint_32 * height
Definition: png.h:2309
png_bytep buf
Definition: png.h:2729


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat May 8 2021 02:42:40