当前位置: 首页>>代码示例>>Java>>正文


Java DataTypes类代码示例

本文整理汇总了Java中org.meteoinfo.data.DataTypes的典型用法代码示例。如果您正苦于以下问题:Java DataTypes类的具体用法?Java DataTypes怎么用?Java DataTypes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataTypes类属于org.meteoinfo.data包,在下文中一共展示了DataTypes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDataType

import org.meteoinfo.data.DataTypes; //导入依赖的package包/类
private DataTypes getDataType(Object value){
    if (value instanceof Integer)
        return DataTypes.Integer;
    else if (value instanceof Float)
        return DataTypes.Float;
    else if (value instanceof Double)
        return DataTypes.Double;
    else if (value instanceof Boolean)
        return DataTypes.Boolean;
    else if (value instanceof String)
        return DataTypes.String;
    else if (value instanceof Date)
        return DataTypes.Date;
    else
        return null;
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:17,代码来源:ColumnData.java

示例2: jMenuItem_NewLayerActionPerformed

import org.meteoinfo.data.DataTypes; //导入依赖的package包/类
private void jMenuItem_NewLayerActionPerformed(ActionEvent evt) {
    Object[] options = {"Point Layer", "Polyline Layer", "Polygon Layer"};
    String option = (String) JOptionPane.showInputDialog(this, "Select Layer Type:",
            "Select", JOptionPane.PLAIN_MESSAGE, null, options, "Point Layer");
    if (option != null) {
        ShapeTypes type = ShapeTypes.Point;
        if (option.equals("Polyline Layer")) {
            type = ShapeTypes.Polyline;
        } else if (option.equals("Polygon Layer")) {
            type = ShapeTypes.Polygon;
        }
        VectorLayer layer = new VectorLayer(type);
        layer.setLayerName("New " + option);
        layer.editAddField("ID", DataTypes.Integer);
        layer.setProjInfo(this._mapDocument.getActiveMapFrame().getMapView().getProjection().getProjInfo());
        this._mapDocument.getActiveMapFrame().addLayer(layer);
        this._mapDocument.paintGraphics();
    }
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoMap,代码行数:20,代码来源:FrmMain.java

示例3: jComboBox_TypeActionPerformed

import org.meteoinfo.data.DataTypes; //导入依赖的package包/类
private void jComboBox_TypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox_TypeActionPerformed
    // TODO add your handling code here:
    if (this.jComboBox_Type.getItemCount() > 0) {
        switch ((DataTypes) this.jComboBox_Type.getSelectedItem()) {
            case Integer:
                this.jSpinner_Width.setValue(8);
                this.jSpinner_Precision.setValue(0);
                this.jSpinner_Precision.setVisible(false);
                break;
            case Double:
                this.jSpinner_Width.setValue(10);
                this.jSpinner_Precision.setValue(4);
                this.jSpinner_Precision.setVisible(true);
                break;
            case String:
                this.jSpinner_Width.setValue(20);
                this.jSpinner_Precision.setValue(0);
                this.jSpinner_Precision.setVisible(false);
                break;
        }
    }
}
 
开发者ID:Yaqiang,项目名称:TrajStat,代码行数:23,代码来源:FrmAddData.java

示例4: FrmAddField

import org.meteoinfo.data.DataTypes; //导入依赖的package包/类
/**
 * Creates new form FrmAddField
 */
public FrmAddField(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();
    
    this.jComboBox_FieldType.removeAllItems();
    this.jComboBox_FieldType.addItem(DataTypes.String);
    this.jComboBox_FieldType.addItem(DataTypes.Integer);
    this.jComboBox_FieldType.addItem(DataTypes.Double);
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:13,代码来源:FrmAddField.java

示例5: Field

import org.meteoinfo.data.DataTypes; //导入依赖的package包/类
/**
 * Constructor
 * @param fName Field name
 * @param type Field data type
 */
public Field(String fName, DataTypes type) {
    this.setColumnName(fName);
    this.setDataType(type);
    switch (type) {
        case String:
            fieldLen = 255;
            break;
        case Date:
            fieldLen = 8;
            break;
        case Float:
            fieldLen = 18;
            fieldNumDec = 6;
            break;
        case Double:
            fieldLen = 18;
            fieldNumDec = 9;
            break;
        case Decimal:
            fieldLen = 18;
            fieldNumDec = 9;
            break;
        case Integer:
            fieldLen = 11;
            break;
        case Boolean:
            fieldLen = 1;
            break;
    }
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:36,代码来源:Field.java

示例6: jMenuItem_AddFieldActionPerformed

import org.meteoinfo.data.DataTypes; //导入依赖的package包/类
private void jMenuItem_AddFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem_AddFieldActionPerformed
    // TODO add your handling code here:
    FrmAddField frmField = new FrmAddField(null, true);
    frmField.setLocationRelativeTo(this);
    frmField.setVisible(true);
    if (frmField.isOK()) {
        String fieldName = frmField.getFieldName();
        if (fieldName.isEmpty()) {
            JOptionPane.showMessageDialog(null, "Field name is empty!");
            return;
        }
        List<String> fieldNames = _layer.getFieldNames();
        if (fieldNames.contains(fieldName)) {
            JOptionPane.showMessageDialog(null, "Field name has exist in the data table!");
            return;
        }
        DataTypes dataType = frmField.getDataType();
        try {                
            _dataTable.addColumn(new Field(fieldName, dataType));
            //this.jTable1.revalidate();
            DataTableModel dataTableModel = new DataTableModel(_dataTable) {
                @Override
                public boolean isCellEditable(int row, int column) {
                    return true;
                }
            };
            this.jTable1.setModel(dataTableModel);
        } catch (Exception ex) {
            Logger.getLogger(FrmAttriData.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:33,代码来源:FrmAttriData.java

示例7: addColumnData

import org.meteoinfo.data.DataTypes; //导入依赖的package包/类
/**
 * Add column data
 *
 * @param colName Column name
 * @param dataType Data type
 * @param colData The column data
 * @throws Exception
 */
public void addColumnData(String colName, DataTypes dataType, List<Object> colData) throws Exception {
    DataColumn col = this.addColumn(colName, dataType);
    int i = 0;
    for (DataRow row : this.rows) {
        if (i < colData.size()) {
            row.setValue(col, colData.get(i));
        }
        i++;
    }
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:19,代码来源:DataTable.java

示例8: add

import org.meteoinfo.data.DataTypes; //导入依赖的package包/类
/**
 * Add a data column
 * @param colName
 * @param dataType
 * @return The added data column
 */
public DataColumn add(String colName, DataTypes dataType){
    DataColumn aCol = new DataColumn(colName, dataType);
    this.add(aCol);
    nameMap.put(aCol.getColumnName(), aCol);
    return aCol;
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:13,代码来源:DataColumnCollection.java

示例9: DataColumn

import org.meteoinfo.data.DataTypes; //导入依赖的package包/类
/**
 * Constructor
 *
 * @param columnName Column name
 * @param dataType Data type
 */
public DataColumn(String columnName, DataTypes dataType) {
    this.dataType = dataType;
    this.columnName = columnName;
    if (this.dataType == DataTypes.Date){
        this.format = "YYYYMMddHH";
    }
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:14,代码来源:DataColumn.java

示例10: getValueAt

import org.meteoinfo.data.DataTypes; //导入依赖的package包/类
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
    if (_dataTable.getColumns().get(columnIndex).getDataType() == DataTypes.Date){
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        return format.format((Date)_dataTable.getValue(rowIndex, columnIndex));
    } else 
        return _dataTable.getValue(rowIndex, columnIndex);
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:9,代码来源:DataTableModel.java

示例11: FrmAddField

import org.meteoinfo.data.DataTypes; //导入依赖的package包/类
/**
 * Creates new form FrmAddField
 * @param parent
 * @param modal
 */
public FrmAddField(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();
    
    this.jComboBox_FieldType.removeAllItems();
    this.jComboBox_FieldType.addItem(DataTypes.String);
    this.jComboBox_FieldType.addItem(DataTypes.Integer);
    this.jComboBox_FieldType.addItem(DataTypes.Double);
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoMap,代码行数:15,代码来源:FrmAddField.java

示例12: FrmAddData

import org.meteoinfo.data.DataTypes; //导入依赖的package包/类
/**
 * Creates new form FrmAddXYData
 * @param parent
 * @param modal
 */
public FrmAddData(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();

    app = (IApplication) parent;
    this.jTextArea1.setText("This tool will add data from a comma-delimited text file to trajectories"
            + " according to the date field. The file must contain column titles as the first row and"
            + " one or two date columns.");
    this.jPanel_SelFields.setEnabled(false);
    this.jPanel_FieldProp.setEnabled(false);
    this.jComboBox_DataField.removeAllItems();
    this.jComboBox_StartDateField.removeAllItems();
    this.jComboBox_EndDateField.removeAllItems();
    this.jComboBox_DateFormat.setEditable(true);
    this.jComboBox_DateFormat.removeAllItems();        
    this.jComboBox_DateFormat.addItem("yyyyMMddHH");
    this.jComboBox_DateFormat.addItem("yyyy-MM-dd HH:mm");
    this.jComboBox_DateFormat.addItem("yyyy/M/d H:mm");
    this.jComboBox_TimeZone.removeAllItems();
    for (int i = -12; i <= 12; i++) {
        this.jComboBox_TimeZone.addItem(this.getTimeZoneString(i));
    }
    this.jComboBox_TimeZone.setSelectedItem(this.getTimeZoneString(0));
    this.jButton_AddData.setEnabled(false);
    this.jComboBox_Type.removeAllItems();
    this.jComboBox_Type.addItem(DataTypes.Integer);
    this.jComboBox_Type.addItem(DataTypes.Double);
    this.jComboBox_Type.addItem(DataTypes.String);
    this.jComboBox_Type.setSelectedIndex(1);
}
 
开发者ID:Yaqiang,项目名称:TrajStat,代码行数:36,代码来源:FrmAddData.java

示例13: getDataType

import org.meteoinfo.data.DataTypes; //导入依赖的package包/类
public DataTypes getDataType(){
    return DataTypes.valueOf(this.jComboBox_FieldType.getSelectedItem().toString());
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:4,代码来源:FrmAddField.java

示例14: fill

import org.meteoinfo.data.DataTypes; //导入依赖的package包/类
/**
 * This populates the Table with data from the file.
 *
 * @param numRows In the event that the dbf file is not found, this
 * indicates how many blank rows should exist in the attribute Table.
 * @throws java.io.FileNotFoundException
 */
public void fill(int numRows) throws FileNotFoundException, IOException, Exception {
    if (!_loaded) {
        load();
    }
    //_dataRowWatch = new Stopwatch();

    _dataTable.getRows().clear(); // if we have already loaded data, clear the data.

    //File aFile = new File(_fileName);
    if (!_file.exists()) {
        _numRecords = numRows;
        //_dataTable.BeginLoadData();
        _dataTable.addColumn("FID", DataTypes.Integer);
        for (int row = 0; row < numRows; row++) {
            DataRow dr = _dataTable.newRow();
            dr.setValue("FID", row);
            _dataTable.addRow(dr);
        }
        //_dataTable.EndLoadData();
        return;
    }
    //Stopwatch sw = new Stopwatch();
    //sw.Start();

    //_dataTable.BeginLoadData();
    // Reading the Table elements as well as the shapes in a single progress loop.
    for (int row = 0; row < _numRecords; row++) {
        // --------- DATABASE --------- CurrentFeature = ReadTableRow(myReader);
        try {
            //_dataTable.Rows.Add(ReadTableRowFromChars(row));
            _dataTable.addRow(readTableRowFromBytes(row));
        } catch (Exception ex) {
            System.out.println(ex.getMessage());
            _dataTable.addRow(_dataTable.newRow());
        }
    }
    //_dataTable.EndLoadData();
    //sw.Stop();

    //Debug.WriteLine("Load Time:" + sw.ElapsedMilliseconds + " Milliseconds");
    //Debug.WriteLine("Conversion:" + _dataRowWatch.ElapsedMilliseconds + " Milliseconds");
    _attributesPopulated = true;
    //onAttributesFilled();
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:52,代码来源:AttributeTable.java

示例15: addClusterToLayers

import org.meteoinfo.data.DataTypes; //导入依赖的package包/类
private void addClusterToLayers(final List<String[]> cDataArray, final List<VectorLayer> layers) {
    SwingWorker worker = new SwingWorker<String, String>() {
        @Override
        protected String doInBackground() throws Exception {
            //---- Show progressbar
            FrmClusterCal.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            app.getProgressBar().setVisible(true);
            app.getProgressBar().setValue(0);
            app.getProgressBarLabel().setVisible(true);
            app.getProgressBarLabel().setText("...");

            //---- Add cluster to layers
            int sNum;
            int j;
            String aDateStr;
            Date aDate;
            SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHH");
            Calendar cal = Calendar.getInstance();

            for (VectorLayer layer : layers) {
                app.getProgressBarLabel().setText(layer.getLayerName());
                if (layer.getFieldIdxByName("Cluster") == -1) {
                    layer.editAddField("Cluster", DataTypes.String);
                }
                sNum = layer.getShapeNum();
                for (int i = 0; i < sNum; i++) {
                    aDate = (Date) layer.getCellValue("Date", i);
                    cal.setTime(aDate);
                    int hour = Integer.parseInt(layer.getCellValue("Hour", i).toString());
                    cal.set(Calendar.HOUR_OF_DAY, hour);
                    aDateStr = format.format(cal.getTime());
                    String height = layer.getCellValue("Height", i).toString();
                    for (j = 0; j < cDataArray.size(); j++) {
                        if (aDateStr.equals(cDataArray.get(j)[0]) && height.equals(cDataArray.get(j)[1])) {
                            layer.editCellValue("Cluster", i, cDataArray.get(j)[2]);
                            break;
                        }
                    }
                    app.getProgressBar().setValue((int) ((float) (i + 1) / sNum * 100));
                }

                layer.getAttributeTable().save();
            }

            return "";
        }

        @Override
        protected void done() {
            app.getProgressBar().setVisible(false);
            app.getProgressBarLabel().setVisible(false);
            FrmClusterCal.this.setCursor(Cursor.getDefaultCursor());
        }
    };

    worker.execute();
}
 
开发者ID:Yaqiang,项目名称:TrajStat,代码行数:58,代码来源:FrmClusterCal.java


注:本文中的org.meteoinfo.data.DataTypes类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。