当前位置: 首页>>代码示例>>Java>>正文


Java Saveable类代码示例

本文整理汇总了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);
}
 
开发者ID:Ayutac,项目名称:toolkit,代码行数:25,代码来源:DockTab.java

示例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();
		}
	}
}
 
开发者ID:Ayutac,项目名称:toolkit,代码行数:11,代码来源:BaseWindow.java

示例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);
	}
}
 
开发者ID:Ayutac,项目名称:toolkit,代码行数:13,代码来源:BaseWindow.java

示例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();
}
 
开发者ID:Ayutac,项目名称:toolkit,代码行数:12,代码来源:DockTab.java


注:本文中的com.trollworks.toolkit.ui.menu.file.Saveable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。