本文整理匯總了Java中com.trollworks.toolkit.ui.widget.outline.OutlineModel.hasSelection方法的典型用法代碼示例。如果您正苦於以下問題:Java OutlineModel.hasSelection方法的具體用法?Java OutlineModel.hasSelection怎麽用?Java OutlineModel.hasSelection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.trollworks.toolkit.ui.widget.outline.OutlineModel
的用法示例。
在下文中一共展示了OutlineModel.hasSelection方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getTarget
import com.trollworks.toolkit.ui.widget.outline.OutlineModel; //導入方法依賴的package包/類
private static HasSourceReference getTarget() {
HasSourceReference ref = null;
Component comp = getFocusOwner();
if (comp instanceof Outline) {
OutlineModel model = ((Outline) comp).getModel();
if (model.hasSelection()) {
Selection selection = model.getSelection();
if (selection.getCount() == 1) {
Row row = model.getFirstSelectedRow();
if (row instanceof HasSourceReference) {
ref = (HasSourceReference) row;
}
}
}
}
return ref;
}
示例2: canDeleteSelection
import com.trollworks.toolkit.ui.widget.outline.OutlineModel; //導入方法依賴的package包/類
@Override
public boolean canDeleteSelection() {
OutlineModel model = getModel();
boolean can = mAddButton.isEnabled() && model.hasSelection();
if (can) {
for (Modifier row : new FilteredIterator<>(model.getSelectionAsList(), Modifier.class)) {
if (row.isReadOnly()) {
return false;
}
}
}
return can;
}
示例3: actionPerformed
import com.trollworks.toolkit.ui.widget.outline.OutlineModel; //導入方法依賴的package包/類
@Override
public void actionPerformed(ActionEvent event) {
Component focus = getFocusOwner();
if (focus instanceof OutlineProxy) {
focus = ((OutlineProxy) focus).getRealOutline();
}
ListOutline outline = (ListOutline) focus;
OutlineModel model = outline.getModel();
if (!model.isLocked() && model.hasSelection()) {
ArrayList<Row> rows = new ArrayList<>();
ArrayList<Row> topRows = new ArrayList<>();
DataFile dataFile = outline.getDataFile();
dataFile.startNotify();
model.setDragRows(model.getSelectionAsList(true).toArray(new Row[0]));
outline.convertDragRowsToSelf(rows);
model.setDragRows(null);
for (Row row : rows) {
if (row.getDepth() == 0) {
topRows.add(row);
}
}
outline.addRow(topRows.toArray(new ListRow[0]), DUPLICATE_UNDO, true);
dataFile.endNotify();
model.select(topRows, false);
outline.scrollSelectionIntoView();
}
}
示例4: actionPerformed
import com.trollworks.toolkit.ui.widget.outline.OutlineModel; //導入方法依賴的package包/類
@Override
public void actionPerformed(ActionEvent event) {
LibraryDockable library = getTarget(LibraryDockable.class);
if (library != null) {
OutlineModel outlineModel = library.getOutline().getModel();
if (outlineModel.hasSelection()) {
SheetDockable sheet = SheetDockable.getLastActivated();
if (sheet != null) {
sheet.addRows(outlineModel.getSelectionAsList(true));
}
}
}
}
示例5: actionPerformed
import com.trollworks.toolkit.ui.widget.outline.OutlineModel; //導入方法依賴的package包/類
@Override
public void actionPerformed(ActionEvent event) {
LibraryDockable library = getTarget(LibraryDockable.class);
if (library != null) {
OutlineModel outlineModel = library.getOutline().getModel();
if (outlineModel.hasSelection()) {
TemplateDockable template = TemplateDockable.getLastActivated();
if (template != null) {
template.addRows(outlineModel.getSelectionAsList(true));
}
}
}
}
示例6: canDeleteSelection
import com.trollworks.toolkit.ui.widget.outline.OutlineModel; //導入方法依賴的package包/類
@Override
public boolean canDeleteSelection() {
OutlineModel model = getModel();
return !model.isLocked() && model.hasSelection();
}