org.eclipse.swt.widgets.Tree.getData()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(158)

本文整理了Java中org.eclipse.swt.widgets.Tree.getData()方法的一些代码示例,展示了Tree.getData()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.getData()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Tree
类名称:Tree
方法名:getData

Tree.getData介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

private int getFixedColumns() {
 Object fixedColumns = getData( RWT.FIXED_COLUMNS );
 if( fixedColumns instanceof Integer ) {
  if( !( getData( RWT.ROW_TEMPLATE ) instanceof Template ) ) {
   return ( ( Integer )fixedColumns ).intValue();
  }
 }
 return -1;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.css.swt

/**
 * @return the color to be used to draw the tree arrows foreground.
 */
public Color getTreeArrowsForegroundColor() {
  Tree tree = getTree();
  Object data = tree.getData(TREE_ARROWS_FOREGROUND_COLOR);
  if (data instanceof Color) {
    return (Color) data;
  }
  return null;
}

代码示例来源:origin: org.xworker/xworker_swt

public static ThingPropertiesEditor getInstance(ActionContext actionContext) {
  Tree tree = actionContext.getObject("tree");
  
  return (ThingPropertiesEditor) tree.getData(EDITOR);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.css.swt

/**
 * @return the way to draw the tree arrows.
 *
 * @see #TREE_ARROWS_MODE_TRIANGLE
 * @see #TREE_ARROWS_MODE_SQUARE
 */
public String getTreeArrowsMode() {
  Tree tree = getTree();
  Object data = tree.getData(TREE_ARROWS_MODE);
  if (TREE_ARROWS_MODE_TRIANGLE.equals(data) || TREE_ARROWS_MODE_SQUARE.equals(data)) {
    return (String) data;
  }
  // Default is arrows
  return TREE_ARROWS_MODE_TRIANGLE;
}

代码示例来源:origin: org.xworker/xworker_swt

public static Object getTreeItem(Tree item, String winPath){
  Thing data = (Thing) item.getData();
  if(data != null && UtilString.eq(data, "winPath", winPath)){
    return item;
  }
  
  for(TreeItem childItem : item.getItems()){
    Object itm = getTreeItem(childItem, winPath);
    if(itm != null){
      return itm;
    }
  }
  
  return null;
}

代码示例来源:origin: org.xworker/xworker_swt

public static void tabelSelectionAction(ActionContext actionContext){
    Event event = (Event) actionContext.get("event");
    TreeItem item = (TreeItem) event.item;
    Tree table = item.getParent();
    Thing store = (Thing) table.getData("_store");
    
    Object record = event.item.getData();
    store.put("currentRecord", record);
  }
}

代码示例来源:origin: org.xworker/xworker_swt

TreeItem item = (TreeItem) actionContext.get("item");
Map<String, Object> record =  (Map<String, Object>) item.getData();
List<Thing> columns = (List<Thing>) item.getParent().getData("_columns");

代码示例来源:origin: org.xworker/xworker_swt

List<Thing> columns = (List<Thing>) item.getParent().getData("_columns");
Thing store = (Thing) item.getParent().getData("_store");
int column = (Integer) actionContext.get("column");
Thing columnAttr = columns.get(column);

代码示例来源:origin: BiglySoftware/BiglyBT

TreeItem item = (TreeItem) event.item;
if (tree.getData("dragging") != null) {
  TreeItem[] selection = tree.getSelection();
  boolean ok = true;

代码示例来源:origin: org.xworker/xworker_swt

@Override
public void disposed(Object result) {
  Map<String, Object> dataObject = (Map<String, Object>) result;     
  if(dataObject != null){
    DataObject db = new DataObject((Thing) dataStore.get("dataObject"));
    db.putAll(dataObject);
    db = db.create(actionContext);
    if(db != null){
      actionContext.peek().put("self", dataTree.getData("storeListener"));
      actionContext.peek().put("record", db);
      String[] texts = TreeDataStoreListener.recordToRowTexts(actionContext);
      
      TreeItem treeItem = new TreeItem(parentTreeItem, SWT.NONE);
      treeItem.setText(texts);
      treeItem.setData(db);
      treeItem.setData("_store_record", db);
    }
  }  
}

代码示例来源:origin: org.xworker/xworker_swt

actionContext.peek().put("self", dataTree.getData("storeListener"));
actionContext.peek().put("record", dataObject);
String[] texts = TreeDataStoreListener.recordToRowTexts(actionContext);

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.css.swt

Object data = parent.getData(TREE_ARROWS_FOREGROUND_COLOR);
if (!(data instanceof Color)) {

代码示例来源:origin: org.xworker/xworker_swt

public static void tableEditAction(ActionContext actionContext){
  //表格中的行
  Event event = (Event) actionContext.get("event");
  World world = World.getInstance();
  TreeItem item = (TreeItem) event.item;
  Tree table = item.getParent();
  //创建编辑窗体
  ActionContext ac = new ActionContext();
  Thing store = (Thing) table.getData("_store");
  ac.put("store", store);
  ac.put("parent", table.getShell());
  Thing editorThing = world.getThing("xworker.app.view.swt.widgets.table.DataObjectGridRowEditor/@shell");
  editorThing.doAction("create", ac);
  ((Thing) ac.get("form")).doAction("setDataObject", ac, UtilMap.toMap("dataObject", item.getData()));
  Shell shell = (Shell) ac.get("shell");
  shell.pack();
  SwtUtils.centerShell(shell);
  shell.open();
}

代码示例来源:origin: org.xworker/xworker_swt

public static void tableSelectionListener(ActionContext actionContext){
  Tree table = (Tree) UtilEvent.getEventWidget(actionContext);
  TreeCursor cursor = (TreeCursor) table.getData("tableCursor");
  
  ControlEditor editor = (ControlEditor) cursor.getData("editor");
  if(editor.getEditor() != null && !editor.getEditor().isDisposed()){
    if(cursor.getColumn() != (Integer) cursor.getData("oldColumn") || cursor.getRow() != cursor.getData("oldRow")){
      try{
        //先设置当前编辑器的值,实现编辑器焦点移开后保存编辑结果
        Thing editorThing = (Thing) editor.getEditor().getData("editorThing");
        ActionContext editorContext = (ActionContext) editor.getEditor().getData("editorContext");
        TreeItem item = (TreeItem) editor.getEditor().getData("item");
        int column = (Integer) editor.getEditor().getData("column");
        Object value = editorThing.doAction("getValue", editorContext);        
        Thing cursorThing = (Thing) cursor.getData("thing");
        cursorThing.doAction("setValue", actionContext, UtilMap.toParams(new Object[]{"item", item, "column", column, "value", value}));
          
        //然后销毁编辑器
        editor.getEditor().dispose();
      }finally{
        editor.getEditor().dispose();
      }
    }
  }       
}

相关文章

Tree类方法