本文整理汇总了Java中org.jdesktop.swingx.action.AbstractActionExt类的典型用法代码示例。如果您正苦于以下问题:Java AbstractActionExt类的具体用法?Java AbstractActionExt怎么用?Java AbstractActionExt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractActionExt类属于org.jdesktop.swingx.action包,在下文中一共展示了AbstractActionExt类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCancelAction
import org.jdesktop.swingx.action.AbstractActionExt; //导入依赖的package包/类
/**
* Creates and returns an Action which cancels an ongoing edit correctly.
* Note: the correct thing to do is to call the editor's cancelEditing, the
* wrong thing to do is to call table removeEditor (as core JTable does...).
* So this is a quick hack around a core bug, reported against SwingX in
* #610-swingx.
*
* @return an Action which cancels an edit.
*/
private Action createCancelAction() {
Action action = new AbstractActionExt() {
@Override
public void actionPerformed(ActionEvent e) {
if (!isEditing())
return;
getCellEditor().cancelCellEditing();
}
@Override
public boolean isEnabled() {
return isEditing();
}
};
return action;
}
示例2: installWrapper
import org.jdesktop.swingx.action.AbstractActionExt; //导入依赖的package包/类
/**
* Creates an life action wrapper around the action registered with
* actionKey, sets its SMALL_ICON property to the given icon and installs
* itself with the newActionKey.
*
* @param actionKey the key of the action to wrap around
* @param newActionKey the key of the wrapper action
* @param icon the icon to use in the wrapper action
*/
private void installWrapper(final String actionKey, String newActionKey,
Icon icon) {
AbstractActionExt wrapper = new AbstractActionExt(null, icon) {
@Override
public void actionPerformed(ActionEvent e) {
Action action = monthView.getActionMap().get(actionKey);
if (action != null) {
action.actionPerformed(e);
}
}
};
monthView.getActionMap().put(newActionKey, wrapper);
}
示例3: interactiveUpdateUIPickerMonthView
import org.jdesktop.swingx.action.AbstractActionExt; //导入依赖的package包/类
/**
* Issue #706-swingx: picker doesn't update monthView.
*
*/
public void interactiveUpdateUIPickerMonthView() {
final JXDatePicker picker = new JXDatePicker();
JXFrame frame = showInFrame(picker, "picker update ui");
Action action = new AbstractActionExt("toggleUI") {
@Override
public void actionPerformed(ActionEvent e) {
String uiClass = (String) UIManager.get(JXMonthView.uiClassID);
boolean custom = uiClass.indexOf("Custom") > 0;
if (!custom) {
UIManager.put(JXMonthView.uiClassID, "org.jdesktop.swingx.test.CustomMonthViewUI");
} else {
UIManager.put(JXMonthView.uiClassID, null);
}
picker.updateUI();
custom = !custom;
}
};
addAction(frame, action);
frame.pack();
}
示例4: interactiveTreeTableClipIssueDefaultRenderer
import org.jdesktop.swingx.action.AbstractActionExt; //导入依赖的package包/类
/**
* Experiments to try and understand clipping issues: occasionally, the text
* in the tree column is clipped even if there is enough space available.
*
* Here we don't change any renderers.
*/
public void interactiveTreeTableClipIssueDefaultRenderer() {
final JXTreeTable treeTable = new JXTreeTable(createActionTreeModel());
treeTable.setHorizontalScrollEnabled(true);
treeTable.setRootVisible(true);
treeTable.collapseAll();
treeTable.packColumn(0, -1);
final JTree tree = new JTree(treeTable.getTreeTableModel());
tree.collapseRow(0);
JXFrame frame = wrapWithScrollingInFrame(treeTable,
tree, "JXTreeTable vs. core JTree: default renderer");
Action revalidate = new AbstractActionExt("revalidate") {
@Override
public void actionPerformed(ActionEvent e) {
treeTable.revalidate();
tree.revalidate();
} };
addAction(frame, revalidate);
frame.setVisible(true);
}
示例5: interactiveFindDialogSelectionTree
import org.jdesktop.swingx.action.AbstractActionExt; //导入依赖的package包/类
/**
* Issue #720, 692-swingx: findDialog on tree selection as match-marker lost
*
* Scenario (#692): open find via button
* - press button to open find
* - run a search with match, selects a node
* - close findDialog, clears selection
*
* Scenario (#702): open find via ctrl-f
* - focus tree
* - ctrl-f to open findDialog
* - run a search with match, selects a node
* - close findDialog
* - tab to button, clears selection
*/
public void interactiveFindDialogSelectionTree() {
final JXTree table = new JXTree();
JComponent comp = Box.createVerticalBox();
comp.add(new JScrollPane(table));
Action action = new AbstractActionExt("open find dialog") {
public void actionPerformed(ActionEvent e) {
SearchFactory.getInstance().showFindDialog(table, table.getSearchable());
}
};
comp.add(new JButton(action));
JXFrame frame = wrapInFrame(comp, "Tree FindDialog: selection lost");
frame.setVisible(true);
}
示例6: interactiveScrollRectToVisible
import org.jdesktop.swingx.action.AbstractActionExt; //导入依赖的package包/类
/**
* Issue #1181-swingx: scrollRectToVisible not effective if component in JXTaskPane.
* Yet another one for the same issue - moved from TaskPaneIssues.
*
* example adapted from tjwolf,
* http://forums.java.net/jive/thread.jspa?threadID=66759&tstart=0
*/
public void interactiveScrollRectToVisible() {
final JXTree tree = new JXTree();
tree.expandAll();
JXTaskPane pane = new JXTaskPane();
pane.add(tree);
JComponent component = new JPanel(new BorderLayout());
component.add(pane);
JXFrame frame = wrapWithScrollingInFrame(component, "scroll to last row must work");
Action action = new AbstractActionExt("scrollToLastRow") {
@Override
public void actionPerformed(ActionEvent e) {
tree.scrollRowToVisible(tree.getRowCount()- 1);
}
};
addAction(frame, action);
// small dimension, make sure there is something to scroll
show(frame, 300, 200);
}
示例7: interactiveLocaleColumnControl
import org.jdesktop.swingx.action.AbstractActionExt; //导入依赖的package包/类
/**
* Issue #459-swingx: columnControl properties not updated on locale setting.
*
*/
public void interactiveLocaleColumnControl() {
final JXTable table = new JXTable(10, 4);
table.setColumnControlVisible(true);
table.getColumnExt(0).setTitle(table.getLocale().getLanguage());
Action toggleLocale = new AbstractActionExt("toggleLocale") {
@Override
public void actionPerformed(ActionEvent e) {
Locale old = table.getLocale();
table.setLocale(old == A_LOCALE ? OTHER_LOCALE : A_LOCALE);
table.getColumnExt(0).setTitle(table.getLocale().getLanguage());
}
};
JXFrame frame = wrapWithScrollingInFrame(table, "toggle locale on table - column control not updated");
addAction(frame, toggleLocale);
frame.setVisible(true);
}
示例8: interactiveTestColumnControlInvisibleColumns
import org.jdesktop.swingx.action.AbstractActionExt; //导入依赖的package包/类
/**
* Issue #192: initially invisibility columns are hidden but marked as
* visible in control.
*
* Issue #38 (swingx): initially invisble columns don't show up in the
* column control list.
*
* Visual check: first enable column control then set column invisible.
*
*/
public void interactiveTestColumnControlInvisibleColumns() {
final JXTable table = new JXTable(new AncientSwingTeam());
table.setColumnControlVisible(true);
final TableColumnExt firstNameColumn = table.getColumnExt("First Name");
firstNameColumn.setVisible(false);
JXFrame frame = wrapWithScrollingInFrame(
table,
"ColumnControl (#192, #38-swingx) first enable ColumnControl then column invisible");
Action toggleHideable = new AbstractActionExt(
"toggle hideable first Name") {
@Override
public void actionPerformed(ActionEvent e) {
firstNameColumn.setHideable(!firstNameColumn.isHideable());
}
};
addAction(frame, toggleHideable);
show(frame);
}
示例9: testAdditonalActionGrouping
import org.jdesktop.swingx.action.AbstractActionExt; //导入依赖的package包/类
/**
* Issue: add support for custom grouping of additional actions
* http://java.net/jira/browse/SWINGX-968
*/
@Test
public void testAdditonalActionGrouping() {
JXTable table = new JXTable(10, 4);
AbstractActionExt custom = new AbstractActionExt("Custom") {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
}
};
custom.putValue(GroupKeyActionGrouper.GROUP_KEY, 0);
table.getActionMap().put(ColumnControlButton.COLUMN_CONTROL_MARKER + "myCommand", custom);
ColumnControlButton button = new ColumnControlButton(table);
button.setActionGrouper(new GroupKeyActionGrouper());
DefaultColumnControlPopup popup = (DefaultColumnControlPopup) button.getColumnControlPopup();
assertEquals("additional actions visible, component count expected ",
table.getColumnCount()
+ 1 /* separator */ + 3 /*default actions with column. prefix*/
+ 1 /* separator custom group */ + 1 /* custom action */,
popup.getPopupMenu().getComponentCount());
}
示例10: interactiveMinimalDaysInFirstWeekPicker
import org.jdesktop.swingx.action.AbstractActionExt; //导入依赖的package包/类
/**
* Issue #736-swingx: monthView cannot cope with minimalDaysInFirstWeek.
*
* Here: look at impact of forcing the minimalDays to a value different
* from the calendar. Days must be displayed in starting from the
* first row under the days-of-week. Selection must be reflected in the
* datepicker.
*/
public void interactiveMinimalDaysInFirstWeekPicker() {
JXDatePicker picker = new JXDatePicker();
final JXMonthView monthView = picker.getMonthView();
monthView.setShowingWeekNumber(true);
monthView.setShowingLeadingDays(true);
monthView.setShowingTrailingDays(true);
Action action = new AbstractActionExt("toggle minimal") {
@Override
public void actionPerformed(ActionEvent e) {
int minimal = monthView.getSelectionModel().getMinimalDaysInFirstWeek();
monthView.getSelectionModel().setMinimalDaysInFirstWeek(minimal > 1 ? 1 : 4);
}
};
final JXFrame frame = wrapInFrame(picker, "click unselectable fires ActionEvent");
addAction(frame, action);
frame.pack();
frame.setVisible(true);
}
示例11: interactiveUpdateUIMonthView
import org.jdesktop.swingx.action.AbstractActionExt; //导入依赖的package包/类
/**
* Issue #706-swingx: picker doesn't update monthView.
*
* Here: visualize weird side-effects of monthView.updateUI - year
* incremented.
*/
public void interactiveUpdateUIMonthView() {
// calendar.set(1955, 10, 9);
final JXMonthView monthView = new JXMonthView();
monthView.setTraversable(true);
final JXFrame frame = showInFrame(monthView, "MonthView update ui - visible month kept");
Action action = new AbstractActionExt("toggleUI") {
@Override
public void actionPerformed(ActionEvent e) {
monthView.updateUI();
}
};
addAction(frame, action);
frame.pack();
}
示例12: interactiveUpdateUIMonthViewCustomUI
import org.jdesktop.swingx.action.AbstractActionExt; //导入依赖的package包/类
/**
* Issue #706-swingx: picker doesn't update monthView.
*
* Show toggle of UI (selectin color)
*/
public void interactiveUpdateUIMonthViewCustomUI() {
final JXMonthView monthView = new JXMonthView();
monthView.setSelectionDate(new Date());
final JXFrame frame = showInFrame(monthView, "MonthView custom ui (selection color)");
Action action = new AbstractActionExt("toggleUI") {
@Override
public void actionPerformed(ActionEvent e) {
String uiClass = (String) UIManager.get(JXMonthView.uiClassID);
boolean custom = uiClass.indexOf("Custom") > 0;
if (!custom) {
UIManager.put(JXMonthView.uiClassID, "org.jdesktop.swingx.test.CustomMonthViewUI");
} else {
UIManager.put(JXMonthView.uiClassID, null);
}
monthView.updateUI();
custom = !custom;
}
};
addAction(frame, action);
frame.pack();
}
示例13: interactiveAutoScrollOnResize
import org.jdesktop.swingx.action.AbstractActionExt; //导入依赖的package包/类
/**
* #705-swingx: JXMonthview must not scroll on revalidate.
*
* Misbehaviour here : multi-month spanning selection, travers two month into the future and
* resize the frame - jumps back to first. Auto-scroll in the delegates
* selection listener would have a similar effect.
*
*/
public void interactiveAutoScrollOnResize() {
final JXMonthView us = new JXMonthView();
us.setTraversable(true);
us.setSelectionMode(SelectionMode.SINGLE_INTERVAL_SELECTION);
final Calendar today = Calendar.getInstance();
CalendarUtils.endOfMonth(today);
Date start = today.getTime();
today.add(Calendar.DAY_OF_MONTH, 60);
us.setSelectionInterval(start, today.getTime());
JXFrame frame = wrapInFrame(us, "resize");
// quick check if lastDisplayed is updated on resize
Action printLast = new AbstractActionExt("log last") {
@Override
public void actionPerformed(ActionEvent e) {
LOG.info("last updated?" + us.getLastDisplayedDay());
}
};
addAction(frame, printLast);
frame.pack();
frame.setVisible(true);
}
示例14: interactiveLastDisplayed
import org.jdesktop.swingx.action.AbstractActionExt; //导入依赖的package包/类
/**
* Issue #659-swingx: lastDisplayedDate must be synched.
*
*/
public void interactiveLastDisplayed() {
final JXMonthView month = new JXMonthView();
month.setSelectionMode(SelectionMode.SINGLE_INTERVAL_SELECTION);
month.setTraversable(true);
Action action = new AbstractActionExt("check lastDisplayed") {
@Override
public void actionPerformed(ActionEvent e) {
Calendar cal = Calendar.getInstance();
cal.setTime(month.getLastDisplayedDay());
Date viewLast = cal.getTime();
cal.setTime(month.getUI().getLastDisplayedDay());
Date uiLast = cal.getTime();
LOG.info("last(view/ui): " + viewLast + "/" + uiLast);
}
};
JXFrame frame = wrapInFrame(month, "default - for debugging only");
addAction(frame, action);
frame.setVisible(true);
}
示例15: interactiveColumnSelection
import org.jdesktop.swingx.action.AbstractActionExt; //导入依赖的package包/类
/**
* Issue #875-swingx: cell selection incorrect in hierarchical column.
*
*/
public void interactiveColumnSelection() {
final JXTreeTable treeTable = new JXTreeTable(new FileSystemModel());
treeTable.setColumnSelectionAllowed(true);
final JTable table = new JTable(new AncientSwingTeam());
table.setColumnSelectionAllowed(true);
JXFrame frame = wrapWithScrollingInFrame(treeTable, table, "columnSelection in treetable");
Action action = new AbstractActionExt("Toggle dnd: false") {
@Override
public void actionPerformed(ActionEvent e) {
boolean dragEnabled = !treeTable.getDragEnabled();
treeTable.setDragEnabled(dragEnabled);
table.setDragEnabled(dragEnabled);
setName("Toggle dnd: " + dragEnabled);
}
};
addAction(frame, action);
show(frame);
}