use of java.beans.PropertyChangeEvent in project intellij-community by JetBrains.
the class MacIntelliJComboBoxUI method createPopup.
@Override
protected ComboPopup createPopup() {
return new BasicComboPopup(myComboBox) {
@Override
protected void configurePopup() {
super.configurePopup();
setBorderPainted(false);
setBorder(JBUI.Borders.empty());
setBackground(Gray.xFF);
}
@Override
protected void configureList() {
super.configureList();
wrapRenderer();
}
@Override
protected PropertyChangeListener createPropertyChangeListener() {
final PropertyChangeListener listener = super.createPropertyChangeListener();
return new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
listener.propertyChange(evt);
if ("renderer".equals(evt.getPropertyName())) {
wrapRenderer();
}
}
};
}
class ComboBoxRendererWrapper implements ListCellRenderer {
private final ListCellRenderer myRenderer;
public ComboBoxRendererWrapper(@NotNull ListCellRenderer renderer) {
myRenderer = renderer;
}
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
Component c = myRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
BorderLayoutPanel panel = JBUI.Panels.simplePanel(c).withBorder(JBUI.Borders.empty(0, 8));
panel.setBackground(c.getBackground());
return panel;
}
}
private void wrapRenderer() {
ListCellRenderer renderer = list.getCellRenderer();
if (!(renderer instanceof ComboBoxRendererWrapper) && renderer != null) {
list.setCellRenderer(new ComboBoxRendererWrapper(renderer));
}
}
};
}
use of java.beans.PropertyChangeEvent in project intellij-community by JetBrains.
the class MacIntelliJComboBoxUI method installUI.
@Override
public void installUI(final JComponent c) {
super.installUI(c);
myEditorBorderChangeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
Object value = evt.getNewValue();
if (value == ourDefaultEditorBorder)
return;
ComboBoxEditor editor = ((JComboBox) c).getEditor();
if (editor != null) {
Component component = editor.getEditorComponent();
if (component instanceof JComponent) {
((JComponent) component).setBorder(ourDefaultEditorBorder);
}
}
}
};
myEditorChangeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
Object value = evt.getNewValue();
Object oldEditor = evt.getOldValue();
if (oldEditor instanceof ComboBoxEditor) {
Component component = ((ComboBoxEditor) oldEditor).getEditorComponent();
if (component instanceof JComponent) {
component.removePropertyChangeListener("border", myEditorBorderChangeListener);
}
}
if (value instanceof ComboBoxEditor) {
Component component = ((ComboBoxEditor) value).getEditorComponent();
if (component instanceof JComponent) {
JComponent comboBoxEditor = (JComponent) component;
comboBoxEditor.setBorder(ourDefaultEditorBorder);
comboBoxEditor.addPropertyChangeListener("border", myEditorBorderChangeListener);
}
}
}
};
c.addPropertyChangeListener("editor", myEditorChangeListener);
}
use of java.beans.PropertyChangeEvent in project adempiere by adempiere.
the class Graph method loadData.
private void loadData() {
list = builder.loadData();
JFreeChart chart = builder.createChart(builder.getMGoal().getChartType());
if (chartPanel != null)
remove(chartPanel);
chartPanel = new ChartPanel(chart);
chartPanel.setSize(getSize());
chartPanel.addChartMouseListener(this);
add(chartPanel, BorderLayout.CENTER);
if (m_userSelection) {
int AD_Reference_Value_ID = DB.getSQLValue(null, "SELECT AD_Reference_ID FROM AD_Reference WHERE Name = ?", "PA_Goal ChartType");
MLookupInfo info = MLookupFactory.getLookup_List(Env.getLanguage(Env.getCtx()), AD_Reference_Value_ID);
MLookup mLookup = new MLookup(info, 0);
VLookup lookup = new VLookup("ChartType", false, false, true, mLookup);
lookup.addVetoableChangeListener(new VetoableChangeListener() {
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException {
Object value = evt.getNewValue();
if (value == null)
return;
JFreeChart chart = null;
chart = builder.createChart(value.toString());
if (chart != null) {
if (chartPanel != null)
remove(chartPanel);
chartPanel = new ChartPanel(chart);
chartPanel.setSize(getSize());
chartPanel.addChartMouseListener(Graph.this);
add(chartPanel, BorderLayout.CENTER);
getParent().validate();
}
}
});
add(lookup, BorderLayout.NORTH);
}
this.setMinimumSize(paneldimension);
}
use of java.beans.PropertyChangeEvent in project intellij-community by JetBrains.
the class TodoConfiguration method doSetTodoPatterns.
private void doSetTodoPatterns(@NotNull TodoPattern[] todoPatterns, final boolean shouldNotifyIndices) {
TodoPattern[] oldTodoPatterns = myTodoPatterns;
IndexPattern[] oldIndexPatterns = myIndexPatterns;
myTodoPatterns = todoPatterns;
buildIndexPatterns();
// only trigger index refresh actual index patterns have changed
if (shouldNotifyIndices && !Arrays.deepEquals(myIndexPatterns, oldIndexPatterns)) {
PropertyChangeEvent event = new PropertyChangeEvent(this, IndexPatternProvider.PROP_INDEX_PATTERNS, oldTodoPatterns, todoPatterns);
myMessageBus.syncPublisher(IndexPatternProvider.INDEX_PATTERNS_CHANGED).propertyChange(event);
}
// only trigger gui and code daemon refresh when either the index patterns or presentation attributes have changed
if (!Arrays.deepEquals(myTodoPatterns, oldTodoPatterns)) {
PropertyChangeListener multicaster = myPropertyChangeMulticaster.getMulticaster();
multicaster.propertyChange(new PropertyChangeEvent(this, PROP_TODO_PATTERNS, oldTodoPatterns, todoPatterns));
}
}
use of java.beans.PropertyChangeEvent in project intellij-community by JetBrains.
the class TodoConfiguration method setTodoFilters.
public void setTodoFilters(@NotNull TodoFilter[] filters) {
TodoFilter[] oldFilters = myTodoFilters;
myTodoFilters = filters;
myPropertyChangeMulticaster.getMulticaster().propertyChange(new PropertyChangeEvent(this, PROP_TODO_FILTERS, oldFilters, filters));
}
Aggregations