本文整理汇总了Java中com.jgoodies.binding.beans.PropertyAdapter类的典型用法代码示例。如果您正苦于以下问题:Java PropertyAdapter类的具体用法?Java PropertyAdapter怎么用?Java PropertyAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PropertyAdapter类属于com.jgoodies.binding.beans包,在下文中一共展示了PropertyAdapter类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createLabel
import com.jgoodies.binding.beans.PropertyAdapter; //导入依赖的package包/类
private JLabel createLabel(String text, final JComponent targetComponent, int hitCharNo){
JLabel label = new JLabel(text);
label.setLabelFor(targetComponent);
if(targetComponent != null){
Bindings.bind(label, "visible", new IsVisibleValueModel(targetComponent));
Bindings.bind(label, "enabled", new PropertyAdapter<JComponent>(targetComponent, "enabled", true));
}
if(hitCharNo >= 0) {
label.setDisplayedMnemonic(text.charAt(hitCharNo));
label.setDisplayedMnemonicIndex(hitCharNo);
}
return label;
}
示例2: createLabel
import com.jgoodies.binding.beans.PropertyAdapter; //导入依赖的package包/类
private JLabel createLabel(String text, final JComponent targetComponent, int hitCharNo) {
JLabel label = new JLabel(text);
label.setLabelFor(targetComponent);
if (targetComponent != null) {
Bindings.bind(label, "visible", new IsVisibleValueModel(targetComponent));
Bindings.bind(label, "enabled", new PropertyAdapter<JComponent>(targetComponent, "enabled", true));
}
if (hitCharNo >= 0) {
label.setDisplayedMnemonic(text.charAt(hitCharNo));
label.setDisplayedMnemonicIndex(hitCharNo);
}
return label;
}
示例3: createFormElements
import com.jgoodies.binding.beans.PropertyAdapter; //导入依赖的package包/类
/**
* Create GUI components for entering the values of a {@link MultiLingualText}. The created GUI
* components are inserted into the builder's layout at the specified row. Rows are added to the
* layout for the inserted components.
*
* @param builder - the panel builder for creating the GUI components
* @param row - the row in the layout for the first GUI component
*
* @return A map with the language ID as key and the property adapter for entering the text as
* value.
*/
public static Map<String, PropertyAdapter<MultiLingualText.Element>> createFormElements(PanelBuilder builder, int row)
{
FormLayout layout = builder.getLayout();
Validate.notNull(layout, "builder has no layout set");
Map<String, PropertyAdapter<MultiLingualText.Element>> labelElems = new HashMap<String, PropertyAdapter<MultiLingualText.Element>>();
Project project = ProdEdit.getInstance().getProject();
ArrayListModel<Language> langs = project.getLanguages();
String defaultLangId = project.getDefaultLangId();
CellConstraints cc = new CellConstraints();
MultiLingualText.Element noElem = new MultiLingualText.Element();
for (Language lang : langs)
{
layout.insertRow(row++, RowSpec.decode("2dlu"));
layout.insertRow(row, RowSpec.decode("p"));
PropertyAdapter<MultiLingualText.Element> labelValue = new PropertyAdapter<MultiLingualText.Element>(noElem,
"text");
labelElems.put(lang.getId(), labelValue);
JTextComponent nameField = BasicComponentFactory.createTextField(labelValue, false);
boolean isDefault = lang.getId().equals(defaultLangId);
String name = " " + lang.getName();
if (isDefault)
name += '*';
builder.addLabel(name, cc.rc(row, 2));
builder.add(nameField, cc.rc(row, 4));
row++;
}
layout.invalidateLayout(builder.getPanel());
return labelElems;
}
示例4: setParameter
import com.jgoodies.binding.beans.PropertyAdapter; //导入依赖的package包/类
/**
* Set the parameter that is edited.
*
* @param parameter - the parameter to set
*/
public void setParameter(Parameter parameter)
{
this.parameter = parameter;
detailsModel.setBean(parameter);
if (parameter == null)
return;
MultiLingualText label = (MultiLingualText) labelValue.getValue();
for (Entry<String, PropertyAdapter<MultiLingualText.Element>> entry : labelElems.entrySet())
entry.getValue().setBean(label.getElement(entry.getKey()));
parameterTypeChanged();
}
示例5: ParameterTypeValues
import com.jgoodies.binding.beans.PropertyAdapter; //导入依赖的package包/类
/**
* Create a panel that displays the values of a parameter type.
*
* @param paramTypeModel - the model of the parameter type of which the values
* are displayed.
*/
public ParameterTypeValues(final ValueModel paramTypeModel)
{
super();
setLayout(new BorderLayout(0, 0));
ParameterValueListCellRenderer valuesListRenderer = new ParameterValueListCellRenderer(valuesList.getCellRenderer());
valuesListRenderer.setShowValue(true);
valuesList.setCellRenderer(valuesListRenderer);
splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
add(splitPane, BorderLayout.CENTER);
JPanel leftPanel = new JPanel();
leftPanel.setLayout(new BorderLayout());
leftPanel.add(toolBar, BorderLayout.NORTH);
leftPanel.add(valuesScrollPane, BorderLayout.CENTER);
splitPane.setLeftComponent(leftPanel);
setupToolBar();
setupDetails();
selectionInList.addValueChangeListener(new PropertyChangeListener()
{
@Override
public void propertyChange(PropertyChangeEvent e)
{
ParameterValue paramValue = (ParameterValue) e.getNewValue();
if (paramValue == null) return;
MultiLingualText label = paramValue.getLabel();
for (Entry<String, PropertyAdapter<MultiLingualText.Element>> entry : labelElems.entrySet())
{
entry.getValue().setBean(label.getElement(entry.getKey()));
}
}
});
paramTypeModel.addValueChangeListener(new PropertyChangeListener()
{
@Override
public void propertyChange(PropertyChangeEvent evt)
{
paramType = (ParameterType) paramTypeModel.getValue();
splitPane.setDividerLocation(0.4);
if (values != null)
values.removeListDataListener(valuesListener);
values = paramType.getValues();
selectionInList.setList(values);
if (values != null && !values.isEmpty())
selectionInList.setSelection(values.get(0));
if (values != null)
values.addListDataListener(valuesListener);
}
});
ProdEdit.getInstance().getProject().getLanguages().addListDataListener(languagesListener);
}