本文整理汇总了Java中com.trollworks.toolkit.ui.menu.file.Saveable类的典型用法代码示例。如果您正苦于以下问题:Java Saveable类的具体用法?Java Saveable怎么用?Java Saveable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Saveable类属于com.trollworks.toolkit.ui.menu.file包,在下文中一共展示了Saveable类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DockTab
import com.trollworks.toolkit.ui.menu.file.Saveable; //导入依赖的package包/类
/**
* Creates a new {@link DockTab} for the specified {@link Dockable}.
*
* @param dockable The {@link Dockable} to work with.
*/
public DockTab(Dockable dockable) {
super(new PrecisionLayout().setMargins(2, 4, 2, 4).setMiddleVerticalAlignment());
mDockable = dockable;
setOpaque(false);
setBorder(new EmptyBorder(2, 1, 0, 1));
addContainerListener(this);
mTitle = new JLabel(getFullTitle(), dockable.getTitleIcon(), SwingConstants.LEFT);
IconButton closeButton = new IconButton(StdImage.DOCK_CLOSE, CLOSE_TOOLTIP, this::attemptClose);
add(mTitle, new PrecisionLayoutData().setGrabHorizontalSpace(true).setHeightHint(Math.max(mTitle.getPreferredSize().height, closeButton.getPreferredSize().height)));
if (dockable instanceof CloseHandler) {
add(closeButton, new PrecisionLayoutData().setEndHorizontalAlignment());
}
if (dockable instanceof Saveable) {
((Saveable) dockable).addDataModifiedListener(this);
}
addMouseListener(this);
setToolTipText(dockable.getTitleTooltip());
DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_MOVE, this);
}
示例2: windowClosing
import com.trollworks.toolkit.ui.menu.file.Saveable; //导入依赖的package包/类
@Override
public void windowClosing(WindowEvent event) {
if (!hasOwnedWindowsShowing(this)) {
List<Saveable> saveables = new ArrayList<>();
collectSaveables(this, saveables);
if (SaveCommand.attemptSave(saveables)) {
dispose();
}
}
}
示例3: collectSaveables
import com.trollworks.toolkit.ui.menu.file.Saveable; //导入依赖的package包/类
private void collectSaveables(Component component, List<Saveable> saveables) {
if (component instanceof Container) {
Container container = (Container) component;
int count = container.getComponentCount();
for (int i = 0; i < count; i++) {
collectSaveables(container.getComponent(i), saveables);
}
}
if (component instanceof Saveable) {
saveables.add((Saveable) component);
}
}
示例4: getFullTitle
import com.trollworks.toolkit.ui.menu.file.Saveable; //导入依赖的package包/类
/** @return The full title used by the tab. */
public String getFullTitle() {
StringBuilder buffer = new StringBuilder();
if (mDockable instanceof Saveable) {
if (((Saveable) mDockable).isModified()) {
buffer.append('*');
}
}
buffer.append(mDockable.getTitle());
return buffer.toString();
}