use of javax.swing.event.ChangeEvent in project adempiere by adempiere.
the class VOrderDistributionReceipt method saveSelection.
// tableChanged
/**
* Save Selection & return selecion Query or ""
* @return where clause like C_Order_ID IN (...)
*/
private void saveSelection() {
log.info("");
// ID selection may be pending
miniTable.editingStopped(new ChangeEvent(this));
// Array of Integers
ArrayList<Integer> results = new ArrayList<Integer>();
selection = null;
// Get selected entries
int rows = miniTable.getRowCount();
for (int i = 0; i < rows; i++) {
// ID in column 0
IDColumn id = (IDColumn) miniTable.getValueAt(i, 0);
// log.fine( "Row=" + i + " - " + id);
if (id != null && id.isSelected())
results.add(id.getRecord_ID());
}
if (results.size() == 0)
return;
log.config("Selected #" + results.size());
selection = results;
}
use of javax.swing.event.ChangeEvent in project adempiere by adempiere.
the class WFActivity method jbInit.
// dynInit
/**
* Static Init.
* Called after Dynamic Init
* @throws Exception
*/
private void jbInit() throws Exception {
int width = 150;
centerPanel.setLayout(centerLayout);
fNode.setReadWrite(false);
fDescription.setReadWrite(false);
fDescription.setPreferredSize(new Dimension(width, 40));
fHelp.setReadWrite(false);
fHelp.setPreferredSize(new Dimension(width, 40));
fHistory.setReadWrite(false);
fHistory.setPreferredSize(new Dimension(width, 80));
fTextMsg.setPreferredSize(new Dimension(width, 40));
//
// bPrevious.addActionListener(this);
// bNext.addActionListener(this);
selTable.setModel(selTableModel);
// 0-ID
selTable.setColumnClass(0, IDColumn.class, false, " ");
// 1-Priority
selTable.setColumnClass(1, Integer.class, true);
// 2-AD_WF_Node_ID
selTable.setColumnClass(2, String.class, true);
// 3-Summary
selTable.setColumnClass(3, String.class, true);
selTable.getSelectionModel().addListSelectionListener(this);
// Listen the Column Move Event
selTable.getColumnModel().addColumnModelListener(new TableColumnModelListener() {
public void columnMoved(TableColumnModelEvent e) {
if (columnValue == -1)
columnValue = e.getFromIndex();
columnNewValue = e.getToIndex();
}
@Override
public void columnAdded(TableColumnModelEvent e) {
}
@Override
public void columnMarginChanged(ChangeEvent e) {
}
@Override
public void columnRemoved(TableColumnModelEvent e) {
}
@Override
public void columnSelectionChanged(ListSelectionEvent e) {
}
});
//Listen the mouse released Moved
selTable.getTableHeader().addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
if (columnValue != -1 && (columnValue == 0 || columnNewValue == 0))
selTable.moveColumn(columnNewValue, columnValue);
columnValue = -1;
columnNewValue = -1;
}
});
bZoom.addActionListener(this);
bOK.addActionListener(this);
//
this.setLayout(new BorderLayout());
this.add(centerPanel, BorderLayout.CENTER);
this.add(statusBar, BorderLayout.SOUTH);
//
// answers.setOpaque(false);
answers.add(fAnswerText);
answers.add(fAnswerList);
answers.add(fAnswerButton);
fAnswerButton.addActionListener(this);
//
int row = 0;
selPane.setPreferredSize(new Dimension(width, 60));
selPane.setMinimumSize(new Dimension(100, 60));
centerPanel.add(selPane, new GridBagConstraints(0, row, 4, 1, 0.3, 0.3, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(5, 10, 5, 10), 0, 0));
centerPanel.add(lNode, new GridBagConstraints(0, ++row, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 10, 5, 5), 0, 0));
centerPanel.add(fNode, new GridBagConstraints(1, row, 3, 2, 0.5, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 10), 0, 0));
centerPanel.add(lDesctiption, new GridBagConstraints(0, ++row, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 10, 5, 5), 0, 0));
centerPanel.add(fDescription, new GridBagConstraints(1, row, 3, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 10), 0, 0));
centerPanel.add(lHelp, new GridBagConstraints(0, ++row, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(2, 10, 5, 5), 0, 0));
centerPanel.add(fHelp, new GridBagConstraints(1, row, 3, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 5, 10), 0, 0));
centerPanel.add(lHistory, new GridBagConstraints(0, ++row, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 10, 5, 5), 0, 0));
centerPanel.add(fHistory, new GridBagConstraints(1, row, 3, 1, 0.5, 0.5, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(5, 0, 5, 10), 0, 0));
centerPanel.add(lAnswer, new GridBagConstraints(0, ++row, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(10, 10, 5, 5), 0, 0));
centerPanel.add(answers, new GridBagConstraints(1, row, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 5, 5), 0, 0));
centerPanel.add(bZoom, new GridBagConstraints(3, row, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(10, 0, 10, 10), 0, 0));
centerPanel.add(lTextMsg, new GridBagConstraints(0, ++row, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 10, 5, 5), 0, 0));
centerPanel.add(fTextMsg, new GridBagConstraints(1, row, 3, 1, 0.5, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 10), 0, 0));
centerPanel.add(lForward, new GridBagConstraints(0, ++row, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(10, 10, 5, 5), 0, 0));
centerPanel.add(fForward, new GridBagConstraints(1, row, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 0, 5, 0), 0, 0));
centerPanel.add(lOptional, new GridBagConstraints(2, row, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 5, 5, 5), 0, 0));
centerPanel.add(bOK, new GridBagConstraints(3, row, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(10, 5, 5, 10), 0, 0));
}
use of javax.swing.event.ChangeEvent in project jmeter by apache.
the class RespTimeGraphVisualizer method init.
/**
* Initialize the GUI.
*/
private void init() {
// WARNING: called from ctor so must not be overridden (i.e. must be private or final)
this.setLayout(new BorderLayout());
// MAIN PANEL
JPanel mainPanel = new JPanel();
Border margin = new EmptyBorder(10, 10, 5, 10);
Border margin2 = new EmptyBorder(10, 10, 5, 10);
mainPanel.setBorder(margin);
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
mainPanel.add(makeTitlePanel());
JPanel settingsPane = new VerticalPanel();
settingsPane.setBorder(margin2);
graphPanel = new RespTimeGraphChart();
graphPanel.setPreferredSize(new Dimension(DEFAULT_WIDTH, DEFAULT_HEIGTH));
settingsPane.add(createGraphActionsPane());
settingsPane.add(createGraphSettingsPane());
settingsPane.add(createGraphTitlePane());
settingsPane.add(createLinePane());
settingsPane.add(createGraphDimensionPane());
JPanel axisPane = new JPanel(new BorderLayout());
axisPane.add(createGraphXAxisPane(), BorderLayout.WEST);
axisPane.add(createGraphYAxisPane(), BorderLayout.CENTER);
settingsPane.add(axisPane);
settingsPane.add(createLegendPane());
//$NON-NLS-1$
tabbedGraph.addTab(JMeterUtils.getResString("aggregate_graph_tab_settings"), settingsPane);
//$NON-NLS-1$
tabbedGraph.addTab(JMeterUtils.getResString("aggregate_graph_tab_graph"), graphPanel);
// If clic on the Graph tab, make the graph (without apply interval or filter)
ChangeListener changeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent changeEvent) {
JTabbedPane srcTab = (JTabbedPane) changeEvent.getSource();
int index = srcTab.getSelectedIndex();
if (srcTab.getTitleAt(index).equals(JMeterUtils.getResString("aggregate_graph_tab_graph"))) {
//$NON-NLS-1$
actionMakeGraph();
}
}
};
tabbedGraph.addChangeListener(changeListener);
this.add(mainPanel, BorderLayout.NORTH);
this.add(tabbedGraph, BorderLayout.CENTER);
}
use of javax.swing.event.ChangeEvent in project intellij-community by JetBrains.
the class AbstractTreeClassChooserDialog method createCenterPanel.
@Override
protected JComponent createCenterPanel() {
final DefaultTreeModel model = new DefaultTreeModel(new DefaultMutableTreeNode());
myTree = new Tree(model);
ProjectAbstractTreeStructureBase treeStructure = new AbstractProjectTreeStructure(myProject) {
@Override
public boolean isFlattenPackages() {
return false;
}
@Override
public boolean isShowMembers() {
return myIsShowMembers;
}
@Override
public boolean isHideEmptyMiddlePackages() {
return true;
}
@Override
public boolean isAbbreviatePackageNames() {
return false;
}
@Override
public boolean isShowLibraryContents() {
return myIsShowLibraryContents;
}
@Override
public boolean isShowModules() {
return false;
}
};
myBuilder = new ProjectTreeBuilder(myProject, myTree, model, AlphaComparator.INSTANCE, treeStructure);
myTree.setRootVisible(false);
myTree.setShowsRootHandles(true);
myTree.expandRow(0);
myTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
myTree.setCellRenderer(new NodeRenderer());
UIUtil.setLineStyleAngled(myTree);
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree);
scrollPane.setPreferredSize(JBUI.size(500, 300));
myTree.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (KeyEvent.VK_ENTER == e.getKeyCode()) {
doOKAction();
}
}
});
new DoubleClickListener() {
@Override
protected boolean onDoubleClick(MouseEvent event) {
TreePath path = myTree.getPathForLocation(event.getX(), event.getY());
if (path != null && myTree.isPathSelected(path)) {
doOKAction();
return true;
}
return false;
}
}.installOn(myTree);
myTree.addTreeSelectionListener(new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent e) {
handleSelectionChanged();
}
});
new TreeSpeedSearch(myTree);
myTabbedPane = new TabbedPaneWrapper(getDisposable());
final JPanel dummyPanel = new JPanel(new BorderLayout());
String name = null;
/*
if (myInitialClass != null) {
name = myInitialClass.getName();
}
*/
myGotoByNamePanel = new ChooseByNamePanel(myProject, createChooseByNameModel(), name, myScope.isSearchInLibraries(), getContext()) {
@Override
protected void showTextFieldPanel() {
}
@Override
protected void close(boolean isOk) {
super.close(isOk);
if (isOk) {
doOKAction();
} else {
doCancelAction();
}
}
@NotNull
@Override
protected Set<Object> filter(@NotNull Set<Object> elements) {
return doFilter(elements);
}
@Override
protected void initUI(ChooseByNamePopupComponent.Callback callback, ModalityState modalityState, boolean allowMultipleSelection) {
super.initUI(callback, modalityState, allowMultipleSelection);
dummyPanel.add(myGotoByNamePanel.getPanel(), BorderLayout.CENTER);
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
IdeFocusManager.getGlobalInstance().requestFocus(IdeFocusTraversalPolicy.getPreferredFocusedComponent(myGotoByNamePanel.getPanel()), true);
});
}
@Override
protected void showList() {
super.showList();
if (myInitialClass != null && myList.getModel().getSize() > 0) {
myList.setSelectedValue(myInitialClass, true);
myInitialClass = null;
}
}
@Override
protected void chosenElementMightChange() {
handleSelectionChanged();
}
};
Disposer.register(myDisposable, myGotoByNamePanel);
myTabbedPane.addTab(IdeBundle.message("tab.chooser.search.by.name"), dummyPanel);
myTabbedPane.addTab(IdeBundle.message("tab.chooser.project"), scrollPane);
myGotoByNamePanel.invoke(new MyCallback(), getModalityState(), false);
myTabbedPane.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
handleSelectionChanged();
}
});
return myTabbedPane.getComponent();
}
use of javax.swing.event.ChangeEvent in project intellij-community by JetBrains.
the class FileStructureDialog method addNarrowDownCheckbox.
private void addNarrowDownCheckbox(final JPanel panel) {
final JCheckBox checkBox = new JCheckBox(IdeBundle.message("checkbox.narrow.down.the.list.on.typing"));
checkBox.setSelected(PropertiesComponent.getInstance().isTrueValue(ourPropertyKey));
checkBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
myShouldNarrowDown = checkBox.isSelected();
PropertiesComponent.getInstance().setValue(ourPropertyKey, myShouldNarrowDown);
ProjectListBuilder builder = (ProjectListBuilder) myCommanderPanel.getBuilder();
if (builder == null) {
return;
}
builder.addUpdateRequest();
}
});
checkBox.setFocusable(false);
panel.add(checkBox);
//,new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0));
}
Aggregations