本文整理汇总了Java中beast.core.Input类的典型用法代码示例。如果您正苦于以下问题:Java Input类的具体用法?Java Input怎么用?Java Input使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Input类属于beast.core包,在下文中一共展示了Input类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: simpleInit
import beast.core.Input; //导入依赖的package包/类
/**
* add combobox with available beastObjects
* a button to edit that beastObject +
* a validation icon
* *
*/
void simpleInit(Input<?> input, BEASTInterface beastObject) {
addInputLabel();
addComboBox(this, input, beastObject);
if (m_bAddButtons) {
if (BEASTObjectPanel.countInputs((BEASTInterface) m_input.get(), doc) > 0) {
m_editBEASTObjectButton = new SmallButton("e", true);
if (input.get() == null) {
m_editBEASTObjectButton.setEnabled(false);
}
m_editBEASTObjectButton.setToolTipText("Edit " + m_inputLabel.getText());
m_editBEASTObjectButton.addActionListener(e -> {
BEASTObjectDialog dlg = new BEASTObjectDialog((BEASTInterface) m_input.get(), m_input.getType(), doc);
if (dlg.showDialog()) {
try {
dlg.accept((BEASTInterface) m_input.get(), doc);
} catch (Exception ex) {
ex.printStackTrace();
}
}
refresh();
validateInput();
refreshPanel();
});
add(m_editBEASTObjectButton);
}
}
addValidationLabel();
}
示例2: addLink
import beast.core.Input; //导入依赖的package包/类
void addLink(BEASTInterface from, BEASTInterface to) {
try {
for (Input<?> input : to.listInputs()) {
if (input.get() instanceof BEASTInterface) {
if (input.get() == from) {
linked.add(input);
return;
}
}
// does it make sense to link list inputs?
// if (input.get() instanceof List<?>) {
// for (Object o : (List<?>) input.get()) {
// if (o instanceof BEASTObject) {
// if (o == from) {
// addLink(input);
// return;
// }
// }
// }
// }
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例3: accept
import beast.core.Input; //导入依赖的package包/类
public void accept(BEASTInterface beastObject, BeautiDoc doc) {
try {
for (Input<?> input : m_panel.m_beastObject.listInputs()) {
if (input.get() != null && (input.get() instanceof List)) {
// setInpuValue (below) on lists does not lead to expected result
// it appends values to the list instead, so we have to clear it first
List<?> list = (List<?>)beastObject.getInput(input.getName()).get();
list.clear();
}
beastObject.setInputValue(input.getName(), input.get());
}
beastObject.setID(m_panel.m_beastObject.getID());
if (doc != null) {
doc.addPlugin(beastObject);
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例4: init
import beast.core.Input; //导入依赖的package包/类
/**
* construct an editor consisting of a label and input entry *
*/
@Override
public void init(Input<?> input, BEASTInterface beastObject, int itemNr, ExpandOption isExpandOption, boolean addButtons) {
m_bAddButtons = addButtons;
m_input = input;
m_beastObject = beastObject;
this.itemNr= itemNr;
addInputLabel();
setUpEntry();
add(m_entry);
add(Box.createHorizontalGlue());
addValidationLabel();
}
示例5: checkForOtherPluginShapes
import beast.core.Input; //导入依赖的package包/类
void checkForOtherPluginShapes(List<Integer> objects, BEASTObjectShape shape) {
// check whether we need to create any input beastObjects
try {
List<Input<?>> inputs = shape.m_beastObject.listInputs();
for (Input<?> input : inputs) {
if (input.get() instanceof BEASTInterface) {
BEASTInterface beastObject = (BEASTInterface) input.get();
BEASTObjectShape beastObjectShape = new BEASTObjectShape(beastObject, this);
beastObjectShape.m_x = Math.max(shape.m_x - DX, 0);
beastObjectShape.m_y = shape.m_y;
beastObjectShape.m_w = 100;
beastObjectShape.m_h = 80;
setPluginID(beastObjectShape);
m_objects.add(beastObjectShape);
objects.add(m_objects.size() - 1);
Arrow arrow = new Arrow(beastObjectShape, shape, input.getName());
m_objects.add(arrow);
objects.add(m_objects.size() - 1);
// recurse
checkForOtherPluginShapes(objects, beastObjectShape);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例6: process
import beast.core.Input; //导入依赖的package包/类
void process(BEASTObjectShape shape, int depth) throws IllegalArgumentException, IllegalAccessException, InstantiationException, ClassNotFoundException {
BEASTInterface beastObject = shape.m_beastObject;
List<Input<?>> inputs = beastObject.listInputs();
for (Input<?> input_ : inputs) {
Object o = input_.get();
if (o != null) {
if (o instanceof List<?>) {
for (Object o2 : (List<?>) o) {
addInput(shape, o2, depth + 1, input_.getName());
}
} else if (o instanceof BEASTInterface) {
addInput(shape, o, depth + 1, input_.getName());
// } else {
// it is a primitive type
}
}
}
}
示例7: findAlignments
import beast.core.Input; //导入依赖的package包/类
/**
* Return first alignment object found underneath BEASTObject obj.
*
* @param obj
* @return Alignment object if found, null otherwise.
* @throws IllegalArgumentException
* @throws IllegalAccessException
*/
private static Set<Alignment> findAlignments(BEASTObject obj) throws IllegalArgumentException, IllegalAccessException {
Set<Alignment> alignments = new HashSet<>();
for (Input input : obj.listInputs()) {
if (input.get() != null) {
if (input.get() instanceof Alignment)
alignments.add((Alignment)input.get());
if (input.get() instanceof List) {
for (Object child : (List)input.get()) {
if (child instanceof BEASTObject) {
alignments.addAll(findAlignments((BEASTObject)child));
}
}
}
if (input.get() instanceof BEASTObject) {
alignments.addAll(findAlignments((BEASTObject)(input.get())));
}
}
}
return alignments;
}
示例8: countInputs
import beast.core.Input; //导入依赖的package包/类
/**
* add all inputs of a beastObject to a box *
*/
public static int countInputs(BEASTInterface beastObject, BeautiDoc doc) {
int inputCount = 0;
try {
if (beastObject == null) {
return 0;
}
List<Input<?>> inputs = beastObject.listInputs();
for (Input<?> input : inputs) {
String fullInputName = beastObject.getClass().getName() + "." + input.getName();
if (!doc.beautiConfig.suppressBEASTObjects.contains(fullInputName)) {
inputCount++;
}
}
} catch (Exception e) {
// ignore
}
return inputCount;
}
示例9: addPluginToMap
import beast.core.Input; //导入依赖的package包/类
static public void addPluginToMap(BEASTInterface beastObject, BeautiDoc doc) {
if (registerPlugin(getID(beastObject), beastObject, doc)) {
return;
}
try {
for (Input<?> input : beastObject.listInputs()) {
if (input.get() != null) {
if (input.get() instanceof BEASTInterface) {
addPluginToMap((BEASTInterface) input.get(), doc);
}
if (input.get() instanceof List<?>) {
for (Object o : (List<?>) input.get()) {
if (o instanceof BEASTInterface) {
addPluginToMap((BEASTInterface) o, doc);
}
}
}
}
}
} catch (Exception e) {
// ignore
Log.warning.println(e.getClass().getName() + " " + e.getMessage());
}
}
示例10: init
import beast.core.Input; //导入依赖的package包/类
/**
* create input editor containing a check box *
*/
@Override
public void init(Input<?> input, BEASTInterface beastObject, int itemNr, ExpandOption isExpandOption, boolean addButtons) {
m_bAddButtons = addButtons;
m_beastObject = beastObject;
m_input = input;
this.itemNr = itemNr;
m_entry = new JCheckBox(formatName(m_input.getName()));
if (input.get() != null) {
m_entry.setSelected((Boolean) input.get());
}
m_entry.setToolTipText(input.getHTMLTipText());
m_entry.addActionListener(e -> {
try {
setValue(m_entry.isSelected());
refreshPanel();
//validateInput();
//m_input.setValue(m_entry.isSelected(), m_beastObject);
} catch (Exception ex) {
Log.err.println("BooleanInputEditor " + ex.getMessage());
}
});
add(m_entry);
add(Box.createHorizontalGlue());
}
示例11: expandedInit
import beast.core.Input; //导入依赖的package包/类
void expandedInit(Input<?> input, BEASTInterface beastObject) {
addInputLabel();
Box box = Box.createVerticalBox();
// add horizontal box with combobox of BEASTObjects to select from
Box combobox = Box.createHorizontalBox();
addComboBox(combobox, input, beastObject);
box.add(combobox);
doc.getInputEditorFactory().addInputs(box, (BEASTInterface) input.get(), this, this, doc);
box.setBorder(new EtchedBorder());
//box.setBorder(BorderFactory.createLineBorder(Color.BLUE));
add(box);
m_expansionBox = box;
}
示例12: replaceItem
import beast.core.Input; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
private void replaceItem(BeautiDoc doc, BEASTInterface oldData, BEASTInterface newData) {
doc.pluginmap.remove(newData.getID());
Set<BEASTInterface> outputs = new LinkedHashSet<>();
outputs.addAll(oldData.getOutputs());
for (BEASTInterface o : outputs) {
for ( Input i : o.listInputs()) {
if (i.get() == oldData) {
i.setValue(newData, o);
} else if (i.get() != null && i.get() instanceof List) {
List list = (List) i.get();
int index = list.indexOf(oldData);
if (index >= 0) {
list.set(index, newData);
newData.getOutputs().add(o);
}
}
}
}
}
示例13: replaceInputs
import beast.core.Input; //导入依赖的package包/类
private void replaceInputs(BEASTInterface beastObject, BEASTInterface original, BEASTInterface replacement) {
try {
for (Input<?> input : beastObject.listInputs()) {
if (input.get() != null) {
if (input.get() instanceof List) {
@SuppressWarnings("unchecked")
List<BEASTInterface> list = (List<BEASTInterface>) input.get();
if (list.contains(original)) {
list.remove(original);
list.add(replacement);
}
} else {
if (input.get().equals(original)) {
input.setValue(replacement, beastObject);
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例14: createInput
import beast.core.Input; //导入依赖的package包/类
@Override
public Object createInput(BEASTInterface beastObject, Input<?> input, PartitionContext context) {
for (BeautiSubTemplate template : beautiConfig.subTemplates) {
try {
if (input.canSetValue(template.instance, beastObject)) {
String partition = beastObject.getID();
partition = parsePartition(partition);
Object o = template.createSubNet(context, beastObject, input, true);
return o;
}
} catch (Exception e) {
// ignore, cannot set value
}
}
return null;
}
示例15: init
import beast.core.Input; //导入依赖的package包/类
@Override
public void init(Input<?> input, BEASTInterface beastObject, int itemNr, ExpandOption isExpandOption, boolean addButtons) {
useDefaultBehavior = !((beastObject instanceof beast.math.distributions.Prior) || beastObject instanceof MRCAPrior || beastObject instanceof TreeDistribution);
// if (useDefaultBehavior && false) {
// super.init(input, beastObject, isExpandOption, addButtons);
// } else {
m_bAddButtons = addButtons;
m_input = input;
m_beastObject = beastObject;
this.itemNr = itemNr;
if (input.get() != null) {
super.init(input, beastObject, itemNr, ExpandOption.TRUE, addButtons);
}
add(createGraph());
// }
}