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

x33g5p2x  于2022-01-23 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(146)

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

List.setItem介绍

[英]Sets the text of the item in the receiver's list at the given zero-relative index to the string argument.
[中]在给定的字符串参数的零相对索引处设置接收方列表中项的文本。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

@Override
 public void focusLost( FocusEvent event ) {
  definitions.get( wInputList.getSelectionIndex() ).setInputStepname( wInputStep.getText() );
  String label = !Utils.isEmpty( wInputStep.getText() ) ? wInputStep.getText()
   : tabTitle + ( wInputList.getSelectionIndex() > 0 ? String.valueOf( wInputList.getSelectionIndex() + 1 )
   : "" );
  wInputList.setItem( wInputList.getSelectionIndex(), label );
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void modifyText( ModifyEvent event ) {
  // See if there is a selected Validation
  //
  if ( wValidationsList != null
   && wValidationsList.getItemCount() > 0 && wValidationsList.getSelection().length == 1 ) {
   int index = wValidationsList.getSelectionIndex();
   String description = wValidationsList.getItem( index );
   Validation validation = Validation.findValidation( selectionList, description );
   String newDescription = wDescription.getText();
   validation.setName( newDescription );
   wValidationsList.setItem( index, newDescription );
   wValidationsList.select( index );
  }
 }
} );

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.databinding

@Override
  public void handleReplace(int index, Object oldElement,
      Object newElement) {
    list.setItem(index, (String) newElement);
  }
});

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

@Override
protected void listSetItem(int index, String string) {
  list.setItem(index, string);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

@Override
protected void listSetItem(int index, String string) {
  list.setItem(index, string);
}

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

protected void listSetItem(int index, String string) {
  list.setItem(index, string);
}

代码示例来源:origin: net.java.dev.glazedlists/glazedlists_java16

/**
 * Updates the value at the specified row.
 */
private void updateRow(int row, E value) {
  list.setItem(row, itemFormat.format(value));
}

代码示例来源:origin: com.haulmont.thirdparty/glazedlists

/**
 * Updates the value at the specified row.
 */
private void updateRow(int row, Object value) {
  list.setItem(row, labelProvider.getText(value));
}

代码示例来源:origin: net.java.dev.glazedlists/glazedlists_java15

/**
 * Updates the value at the specified row.
 */
private void updateRow(int row, E value) {
  list.setItem(row, itemFormat.format(value));
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

/**
 * Sets the text of the item in the receiver's list at the given
 * zero-relative index to the string argument. This is equivalent
 * to <code>remove</code>'ing the old item at the index, and then
 * <code>add</code>'ing the new item at that index.
 *
 * @param index the index for the item
 * @param string the new text for the item
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
 *    <li>ERROR_NULL_ARGUMENT - if the string is null</li>
 * </ul>
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 */
public void setItem (int index, String string) {
  checkWidget();
  list.setItem (index, string);
}
/**

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

/**
 * Sets the text of the item in the receiver's list at the given
 * zero-relative index to the string argument. This is equivalent
 * to <code>remove</code>'ing the old item at the index, and then
 * <code>add</code>'ing the new item at that index.
 *
 * @param index the index for the item
 * @param string the new text for the item
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
 *    <li>ERROR_NULL_ARGUMENT - if the string is null</li>
 * </ul>
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 */
public void setItem (int index, String string) {
  checkWidget();
  list.setItem (index, string);
}
/**

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

/**
 * Sets the text of the item in the receiver's list at the given
 * zero-relative index to the string argument. This is equivalent
 * to <code>remove</code>'ing the old item at the index, and then
 * <code>add</code>'ing the new item at that index.
 *
 * @param index the index for the item
 * @param string the new text for the item
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
 *    <li>ERROR_NULL_ARGUMENT - if the string is null</li>
 * </ul>
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 */
public void setItem (int index, String string) {
  checkWidget();
  list.setItem (index, string);
}
/**

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

/**
 * Sets the text of the item in the receiver's list at the given
 * zero-relative index to the string argument. This is equivalent
 * to <code>remove</code>'ing the old item at the index, and then
 * <code>add</code>'ing the new item at that index.
 *
 * @param index the index for the item
 * @param string the new text for the item
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
 *    <li>ERROR_NULL_ARGUMENT - if the string is null</li>
 * </ul>
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 */
public void setItem (int index, String string) {
  checkWidget();
  list.setItem (index, string);
}
/**

代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui

/**
 * Sets the text of the item in the receiver's list at the given
 * zero-relative index to the string argument. This is equivalent
 * to <code>remove</code>'ing the old item at the index, and then
 * <code>add</code>'ing the new item at that index.
 *
 * @param index the index for the item
 * @param string the new text for the item
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
 *    <li>ERROR_NULL_ARGUMENT - if the string is null</li>
 * </ul>
 * @exception org.eclipse.swt.SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 */
public void setItem (int index, String string) {
 checkWidget();
 list.setItem (index, string);
}
/**

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

/**
 * Sets the text of the item in the receiver's list at the given
 * zero-relative index to the string argument. This is equivalent
 * to <code>remove</code>'ing the old item at the index, and then
 * <code>add</code>'ing the new item at that index.
 *
 * @param index the index for the item
 * @param string the new text for the item
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
 *    <li>ERROR_NULL_ARGUMENT - if the string is null</li>
 * </ul>
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 */
public void setItem (int index, String string) {
  checkWidget();
  list.setItem (index, string);
}
/**

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

public static void setItem(Control ccombo, Object value, int index){
  String str = value == null ? "" : String.valueOf(value);
  
  if(ccombo instanceof CCombo){
    ((CCombo) ccombo).setItem(index, str);
  }else if(ccombo instanceof Combo){
    ((Combo) ccombo).setItem(index, str);
  }else if(ccombo instanceof org.eclipse.swt.widgets.List){
    ((org.eclipse.swt.widgets.List) ccombo).setItem(index, str);
  }
}

代码示例来源:origin: net.sf.okapi.filters/okapi-filter-regex-ui

private void moveUpRule () {
  int n = lbRules.getSelectionIndex();
  if ( n < 1 ) return;
  saveRuleData(ruleIndex);
  ruleIndex = -1;
  // Move in the rules array
  Rule tmp = rules.get(n);
  rules.set(n, rules.get(n-1));
  rules.set(n-1, tmp);
  // Refresh the list box
  lbRules.setItem(n, rules.get(n).getRuleName());
  lbRules.setItem(n-1, rules.get(n-1).getRuleName());
  lbRules.select(n-1);
  updateRule();
  updateRuleButtons();
}

代码示例来源:origin: org.microemu/microemu-javase-swt

public void handleEvent(Event event)
  {
    DeviceEntry entry = (DeviceEntry) deviceModel.elementAt(lsDevices.getSelectionIndex());
    for (int i = 0; i < deviceModel.size(); i++) {
      DeviceEntry tmp = (DeviceEntry) deviceModel.elementAt(i);
      if (tmp == entry) {
        tmp.setDefaultDevice(true);
        lsDevices.setItem(i, tmp.getName() + " (default)");
      } else {
        tmp.setDefaultDevice(false);
        lsDevices.setItem(i, tmp.getName());
      }
      Config.changeDeviceEntry(tmp);
    }
    btDefault.setEnabled(false);
  }
};

代码示例来源:origin: net.sf.okapi.filters/okapi-filter-regex-ui

private void moveDownRule () {
  int n = lbRules.getSelectionIndex();
  if ( n < 0 ) return;
  saveRuleData(ruleIndex);
  ruleIndex = -1;
  // Move in the rules array
  Rule tmp = rules.get(n);
  rules.set(n, rules.get(n+1));
  rules.set(n+1, tmp);
  // Refresh the list box
  lbRules.setItem(n, rules.get(n).getRuleName());
  lbRules.setItem(n+1, rules.get(n+1).getRuleName());
  lbRules.select(n+1);
  updateRule();
  updateRuleButtons();
}

代码示例来源:origin: net.sf.okapi.filters/okapi-filter-regex-ui

private void renameRule () {
  try {
    int n = lbRules.getSelectionIndex();
    if ( n == -1 ) return;
    Rule rule = rules.get(n);
    String name = rule.getRuleName();
    InputDialog dlg = new InputDialog(shell, Res.getString("Editor.renameRule"), //$NON-NLS-1$
      Res.getString("Editor.newRuleName"), name, null, 0, -1, -1); //$NON-NLS-1$
    if ( (name = dlg.showDialog()) == null ) return;
    rule.setRuleName(name);
    lbRules.setItem(n, name);
  }
  catch ( Throwable e ) {
    Dialogs.showError(shell, e.getMessage(), null);
  }
}

相关文章

微信公众号

最新文章

更多

List类方法