本文整理汇总了Java中gate.creole.FeatureSchema类的典型用法代码示例。如果您正苦于以下问题:Java FeatureSchema类的具体用法?Java FeatureSchema怎么用?Java FeatureSchema使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FeatureSchema类属于gate.creole包,在下文中一共展示了FeatureSchema类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: populate
import gate.creole.FeatureSchema; //导入依赖的package包/类
/**
* Called internally whenever the data represented changes.
* Get feature names from targetFeatures and schema then sort them
* and add them to featureList.
* Fire a table data changed event for the feature table whith featureList
* used as data model.
*/
protected void populate(){
featureList.clear();
//get all the existing features
Set fNames = new HashSet();
if(targetFeatures != null){
//add all the schema features
fNames.addAll(targetFeatures.keySet());
if(schema != null && schema.getFeatureSchemaSet() != null){
for(FeatureSchema featureSchema : schema.getFeatureSchemaSet()) {
// if(featureSchema.isRequired())
fNames.add(featureSchema.getFeatureName());
}
}
List featureNames = new ArrayList(fNames);
Collections.sort(featureNames);
for(Object featureName : featureNames) {
String name = (String) featureName;
Object value = targetFeatures.get(name);
featureList.add(new Feature(name, value));
}
}
if (!featureList.contains(emptyFeature)) {
featureList.add(emptyFeature);
}
featuresModel.fireTableDataChanged();
// mainTable.setSize(mainTable.getPreferredScrollableViewportSize());
}
示例2: populate
import gate.creole.FeatureSchema; //导入依赖的package包/类
/**
* Called internally whenever the data represented changes.
*
*/
protected void populate() {
featureList.clear();
// get all the exisitng features
Set<Object> features = new LinkedHashSet<Object>();
if(targetFeatures != null) {
// add all the schema features
for(Object key : targetFeatures.keySet()) {
Object value = targetFeatures.get(key);
if(key.equals(Settings.VALUE_FEATURES_DIALOG_GUI_LABEL)){
initValueEditor(value);
featureList.add(new Feature(key.toString(), value));
} else{
featureList.add(new Feature(key.toString(), value));
}
features.add(key.toString());
}
}
if(schema != null && schema.getFeatureSchemaSet() != null) {
Iterator fSchemaIter = schema.getFeatureSchemaSet().iterator();
while(fSchemaIter.hasNext()) {
FeatureSchema fSchema = (FeatureSchema)fSchemaIter.next();
if(!features.contains(fSchema.getFeatureName())) {
featureList
.add(new Feature(fSchema.getFeatureName(), new ArrayList()));
}
}
}
featureList.add(emptyFeature);
featuresModel.fireTableDataChanged();
mainTable.setSize(mainTable.getPreferredScrollableViewportSize());
}
示例3: populate
import gate.creole.FeatureSchema; //导入依赖的package包/类
/**
* Called internally whenever the data represented changes.
*
*/
protected void populate() {
featureList.clear();
// get all the existing features
Set features = new HashSet();
if(targetFeatures != null) {
// add all the schema features
for(Object key : targetFeatures.keySet()) {
Object value = targetFeatures.get(key);
featureList.add(new Feature(key.toString(), value));
features.add(key.toString());
}
}
if(schema != null && schema.getFeatureSchemaSet() != null) {
Iterator fSchemaIter = schema.getFeatureSchemaSet().iterator();
while(fSchemaIter.hasNext()) {
FeatureSchema fSchema = (FeatureSchema)fSchemaIter.next();
if(!features.contains(fSchema.getFeatureName())) {
featureList
.add(new Feature(fSchema.getFeatureName(), new ArrayList()));
}
}
}
featureList.add(emptyFeature);
featuresModel.fireTableDataChanged();
mainTable.setSize(mainTable.getPreferredScrollableViewportSize());
}
示例4: isCorrect
import gate.creole.FeatureSchema; //导入依赖的package包/类
boolean isCorrect(){
if(schema == null) return true;
FeatureSchema fSchema = schema.getFeatureSchema(name);
return fSchema == null || fSchema.getPermittedValues() == null||
fSchema.getPermittedValues().contains(value);
}
示例5: isRequired
import gate.creole.FeatureSchema; //导入依赖的package包/类
boolean isRequired(){
if(schema == null) return false;
FeatureSchema fSchema = schema.getFeatureSchema(name);
return fSchema != null && fSchema.isRequired();
}
示例6: getDefaultValue
import gate.creole.FeatureSchema; //导入依赖的package包/类
Object getDefaultValue(){
if(schema == null) return null;
FeatureSchema fSchema = schema.getFeatureSchema(name);
return fSchema == null ? null : fSchema.getFeatureValue();
}
示例7: prepareCombo
import gate.creole.FeatureSchema; //导入依赖的package包/类
protected void prepareCombo(JComboBox combo, int row, int column){
Feature feature = featureList.get(row);
DefaultComboBoxModel comboModel = (DefaultComboBoxModel)combo.getModel();
comboModel.removeAllElements();
switch(column){
case NAME_COL:
List<String> fNames = new ArrayList<String>();
if(schema != null && schema.getFeatureSchemaSet() != null){
Iterator<FeatureSchema> fSchemaIter = schema.getFeatureSchemaSet().iterator();
while(fSchemaIter.hasNext())
fNames.add(fSchemaIter.next().getFeatureName());
}
if(!fNames.contains(feature.name))fNames.add(feature.name);
Collections.sort(fNames);
for(Iterator<String> nameIter = fNames.iterator();
nameIter.hasNext();
comboModel.addElement(nameIter.next()));
combo.getEditor().getEditorComponent().setBackground(defaultBackground);
combo.setSelectedItem(feature.name);
break;
case VALUE_COL:
List<Object> fValues = new ArrayList<Object>();
if(feature.isSchemaFeature()){
Set<Object> permValues = schema.getFeatureSchema(feature.name).
getPermittedValues();
if(permValues != null) fValues.addAll(permValues);
}
if(!fValues.contains(feature.value)) fValues.add(feature.value);
Collections.sort(fValues, defaultComparator);
for(Iterator<Object> valIter = fValues.iterator();
valIter.hasNext();
comboModel.addElement(valIter.next()));
combo.getEditor().getEditorComponent().setBackground(feature.isCorrect() ?
defaultBackground :
(feature.isRequired() ? REQUIRED_WRONG : OPTIONAL_WRONG));
combo.setSelectedItem(feature.value);
break;
default: ;
}
}
示例8: isCorrect
import gate.creole.FeatureSchema; //导入依赖的package包/类
boolean isCorrect() {
if(schema == null) return true;
FeatureSchema fSchema = schema.getFeatureSchema(name);
return fSchema == null || fSchema.getPermittedValues() == null
|| fSchema.getPermittedValues().contains(value);
}
示例9: isRequired
import gate.creole.FeatureSchema; //导入依赖的package包/类
boolean isRequired() {
if(schema == null) return false;
FeatureSchema fSchema = schema.getFeatureSchema(name);
return fSchema != null && fSchema.isRequired();
}
示例10: getDefaultValue
import gate.creole.FeatureSchema; //导入依赖的package包/类
Object getDefaultValue() {
if(schema == null) return null;
FeatureSchema fSchema = schema.getFeatureSchema(name);
return fSchema == null ? null : fSchema.getFeatureValue();
}
示例11: prepareCombo
import gate.creole.FeatureSchema; //导入依赖的package包/类
protected void prepareCombo(JComboBox combo, int row, int column) {
Feature feature = (Feature)featureList.get(row);
DefaultComboBoxModel comboModel = (DefaultComboBoxModel)combo.getModel();
comboModel.removeAllElements();
switch(column){
case NAME_COL:
List fNames = new ArrayList();
if(schema != null && schema.getFeatureSchemaSet() != null) {
Iterator fSchemaIter = schema.getFeatureSchemaSet().iterator();
while(fSchemaIter.hasNext())
fNames.add(((FeatureSchema)fSchemaIter.next()).getFeatureName());
}
if(!fNames.contains(feature.name)) fNames.add(feature.name);
Collections.sort(fNames);
for(Iterator nameIter = fNames.iterator(); nameIter.hasNext(); comboModel
.addElement(nameIter.next()))
;
combo.getEditor().getEditorComponent().setBackground(
FeaturesEditor.this.getBackground());
combo.setSelectedItem(feature.name);
break;
case VALUE_COL:
List fValues = new ArrayList();
if(feature.isSchemaFeature()) {
Set permValues =
schema.getFeatureSchema(feature.name).getPermittedValues();
if(permValues != null) fValues.addAll(permValues);
}
if(!fValues.contains(feature.value)) fValues.add(feature.value);
Collections.sort(fValues, defaultComparator);
for(Iterator valIter = fValues.iterator(); valIter.hasNext(); comboModel
.addElement(valIter.next()))
;
combo.getEditor().getEditorComponent().setBackground(
feature.isCorrect()
? FeaturesEditor.this.getBackground()
: (feature.isRequired() ? REQUIRED_WRONG : OPTIONAL_WRONG));
combo.setSelectedItem(feature.value);
break;
default:
;
}
}