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


Java Listener类代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.Listener的典型用法代码示例。如果您正苦于以下问题:Java Listener类的具体用法?Java Listener怎么用?Java Listener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Listener类属于org.eclipse.swt.widgets包,在下文中一共展示了Listener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTextBoxValue1Listener

import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
/**
 * Gets the text box value 1 listener.
 * 
 * @param conditionsList
 *            the conditions list
 * @param fieldsAndTypes
 *            the fields and types
 * @param fieldNames
 *            the field names
 * @param saveButton
 *            the save button
 * @param displayButton
 *            the display button
 * @return the text box value 1 listener
 */
public  Listener getTextBoxValue1Listener(final List<Condition> conditionsList, 
		final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) {
	Listener listener = new Listener() {
		
		@Override
		public void handleEvent(Event event) {
			Text text = (Text)event.widget;
			int index = (int) text.getData(FilterConstants.ROW_INDEX);
			Condition filterConditions = conditionsList.get(index);
			filterConditions.setValue1(text.getText());
			validateText(text, filterConditions.getFieldName(), fieldsAndTypes, filterConditions.getConditionalOperator());
			toggleSaveDisplayButton(conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton);
		}
	};
	return listener;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:32,代码来源:FilterHelper.java

示例2: configureShell

import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
@Override
  protected void configureShell(Shell newShell) {
      super.configureShell(newShell);
      this.currentShell = newShell;
      this.currentShell.setText(this.title);
      this.currentShell.getDisplay().addFilter(SWT.Traverse, new Listener() {
	@Override
	public void handleEvent(Event event) {
		switch (event.detail) {
		case SWT.TRAVERSE_ESCAPE:
			event.doit = false;
			cancelPressed();
			break;

		default:
			break;
		}
	}
});
  }
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:21,代码来源:ProjectNewOpen.java

示例3: open

import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
public void open() {
	final Shell shell = new Shell(getParent(), getStyle());
	shell.setText("Find/replace");
	createContents(shell);
	shell.pack();
	shell.open();

	Listener researcherListener = new Listener() {
		public void handleEvent(Event event) {
			if (resultsIterator != null)
				resultsIterator = null;
		}
	};
	text.addListener(SWT.Modify, researcherListener);

	Display display = getParent().getDisplay();
	while (!shell.isDisposed())
		if (!display.readAndDispatch())
			display.sleep();

	text.removeListener(SWT.Modify, researcherListener);
	clearSearchResults();
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:24,代码来源:FindReplaceDialog.java

示例4: renderTransparency

import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
private void renderTransparency(final Shell shell) {
	Group group = new Group(shell, SWT.NONE);
	group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 6, 1));
	group.setLayout(new GridLayout(1, false));
	group.setText("Transparency");
	final Scale transparencySlider = new Scale(group, SWT.HORIZONTAL);
	transparencySlider.setMinimum(20);
	transparencySlider.setMaximum(100);
	transparencySlider.setPageIncrement(90);
	transparencySlider.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
	transparencySlider.setSelection(100);
	transparencySlider.addListener(SWT.Selection, new Listener() {

		@Override
		public void handleEvent(Event event) {
			shell.setAlpha(255 * transparencySlider.getSelection() / 100);
		}
	});
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:20,代码来源:FindReplaceDialog.java

示例5: createDialogArea

import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);
	
	Link link = new Link(container, SWT.NONE);
	link.setText("Your project has been successfully deployed.\n\nYou can try it with this URL:\n<a href=\""+ projectURL + "\">" + projectURL + "</a>");
	link.addListener (SWT.Selection, new Listener () {
		
		public void handleEvent(Event event) {
			org.eclipse.swt.program.Program.launch(event.text);
		}
		
	});
			
	link.setSize(330, 150);

	return container;
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:23,代码来源:ProjectDeploySuccessfulDialog.java

示例6: GeneratorChoiceComposite

import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
public GeneratorChoiceComposite(Composite parent, int style, IStructuredSelection selection, Listener listener) {
	super(parent, style);

	setLayout(new GridLayout(12, false));
	GridData gridData = new GridData();
	gridData.horizontalAlignment = GridData.FILL;
	gridData.grabExcessHorizontalSpace = true;
	setLayoutData(gridData);

	this.listener = listener;
	this.selection = selection;
	IFile file = (IFile) selection.getFirstElement();
	loadAncestor(file);
	findStartElement () ;
	Label explanationLabel = new Label(this, SWT.NONE);
	explanationLabel.setLayoutData(new GridData(SWT.FILL));
	explanationLabel.setText(MessageUtil.getString("three_modes_explanation"));

	skip(this);

	createAppendMode();
	createExtendMode();
	createNewMode();

}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:26,代码来源:GeneratorChoiceComposite.java

示例7: buildLeftColumn

import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
private void buildLeftColumn() {
	final Composite composite = new Composite(this.shell, SWT.NONE);
	final GridData gd = new GridData(GridData.FILL, GridData.BEGINNING, false,
			true, 1, 1);
	composite.setLayoutData(gd);
	final FillLayout compositeLayout = new FillLayout();
	compositeLayout.marginWidth = 2;
	composite.setLayout(compositeLayout);
	final Label label = new Label(composite, SWT.NONE);
	if (this.image == null) {
		this.image = new Image(display, this.getClass().getClassLoader()
				.getResourceAsStream("images/document_wrench_color.png"));
		shell.addListener(SWT.Close, new Listener() {
			@Override
			public void handleEvent(Event event) {
				image.dispose();
			}
		});

	}
	label.setImage(this.image);
}
 
开发者ID:sergueik,项目名称:SWET,代码行数:23,代码来源:TipDayEx.java

示例8: buildLeftColumn

import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
private void buildLeftColumn() {
	final Composite composite = new Composite(this.shell, SWT.NONE);
	final GridData gd = new GridData(GridData.FILL, GridData.BEGINNING, false,
			true, 1, 1);
	composite.setLayoutData(gd);
	final FillLayout compositeLayout = new FillLayout();
	compositeLayout.marginWidth = 2;
	composite.setLayout(compositeLayout);
	final Label label = new Label(composite, SWT.NONE);
	if (this.image == null) {
		this.image = new Image(display, this.getClass().getClassLoader()
				.getResourceAsStream("images/light1.png"));
		shell.addListener(SWT.Close, new Listener() {
			@Override
			public void handleEvent(Event event) {
				image.dispose();
			}
		});

	}
	label.setImage(this.image);
}
 
开发者ID:sergueik,项目名称:SWET,代码行数:23,代码来源:TipDayEx.java

示例9: attachMouseScrollButtonListener

import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
private void attachMouseScrollButtonListener(final ScrolledComposite scrolledComposite){
	scrolledComposite.addListener(SWT.MouseWheel, new Listener() {
		@Override
		public void handleEvent(Event event) {
			int wheelCount = event.count;
			wheelCount = (int) Math.ceil(wheelCount / 3.0f);
			while (wheelCount < 0) {
				scrolledComposite.getVerticalBar().setIncrement(4);
				wheelCount++;
			}

			while (wheelCount > 0) {
				scrolledComposite.getVerticalBar().setIncrement(-4);
				wheelCount--;
			}
		}
	});
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:19,代码来源:PropertyDialogBuilder.java

示例10: created

import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
@Override
public void created(final MainStatusBar.CLabelPadding label) {
	final Listener click_listener = new Listener() {
		@Override
		public void handleEvent(Event e) {
			onClick();
		}
	};

	Utils.execSWTThread(new AERunnable() {
		@Override
		public void runSupport() {
			label.addListener(SWT.MouseDoubleClick, click_listener);
		}
	}, true);
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:17,代码来源:UISWTStatusEntryImpl.java

示例11: getListener

import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper, Widget... widgets) {
	final Widget[] widgetList = widgets;
	if (helper != null){
		txtDecorator = (ControlDecoration) helper.get(HelperType.CONTROL_DECORATION);
	}
	
	Listener listener = new Listener() {
		@Override
		public void handleEvent(Event event) {
			String charSet = ((Text) widgetList[0]).getText();
			if(SWT.FocusIn == event.type) {
					if (StringUtils.isEmpty(charSet)) {
					txtDecorator.show();
					((Text) widgetList[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 255, 255));
					((Text) widgetList[0]).setToolTipText(txtDecorator.getDescriptionText());
				} else {
					txtDecorator.hide();
				}
			}
		}
	};
	return listener;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:25,代码来源:DelimiterFocusInListener.java

示例12: getListener

import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
@Override
public Listener getListener(
		PropertyDialogButtonBar propertyDialogButtonBar,
		ListenerHelper helper, Widget... widgets) {
	final Widget[] widgetList = widgets;
	if (helper != null) {
		txtDecorator = (ControlDecoration) helper.get(HelperType.CONTROL_DECORATION);
	}

	Listener listener = new Listener() {

		@Override
		public void handleEvent(Event event) {
			String charSet = ((Text) widgetList[0]).getText().trim();
			if (event.type == SWT.FocusIn) {
				((Text) widgetList[0]).setText(charSet.replace("@{", "").replace("}", ""));
			}
		}
	};

	return listener;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:23,代码来源:ELTFocusGainedListener.java

示例13: getListener

import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper,  Widget... widgets) {
		if (helper != null) {
			txtDecorator = (ControlDecoration) helper.get(HelperType.CONTROL_DECORATION);
		}

		Listener listener=new Listener() {
			@Override
			public void handleEvent(Event event) {
				String string=event.text;
				Matcher matchs=Pattern.compile("[\\d]*").matcher(string);
				if(!matchs.matches()){
					txtDecorator.setDescriptionText(Messages.FIELDBATCH);
					txtDecorator.show();
					event.doit=false;
			}else
				txtDecorator.hide();
			}
		};
	return listener;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:22,代码来源:ELTVerifyNumbericListener.java

示例14: IntListParameter

import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
public IntListParameter(Composite composite, final String name,
	int defaultValue, final String labels[], final int values[]) {
super(name);
this.name = name;
this.values = values;

    if(labels.length != values.length)
      return;
    int value = COConfigurationManager.getIntParameter(name,defaultValue);
    int index = findIndex(value,values);
    list = new Combo(composite,SWT.SINGLE | SWT.READ_ONLY);
    for(int i = 0 ; i < labels.length  ;i++) {
      list.add(labels[i]);
    }

    setIndex(index);

    list.addListener(SWT.Selection, new Listener() {
         @Override
         public void handleEvent(Event e) {
        	 setIndex(list.getSelectionIndex());
         }
       });

  }
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:26,代码来源:IntListParameter.java

示例15: getListener

import org.eclipse.swt.widgets.Listener; //导入依赖的package包/类
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helpers,
		Widget... widgets) {
	final Widget[] widgetList = widgets;
	
	Listener listener = new Listener() {
		@Override
		public void handleEvent(Event event) {
			if (StringUtils.equalsIgnoreCase(((Button) widgetList[0]).getText(), String.valueOf(FAST_LOAD)) && ((Button) widgetList[0]).getSelection() ) {
				MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(),
						SWT.ICON_INFORMATION | SWT.OK);
				messageBox.setText(INFORMATION);
				messageBox.setMessage(Messages.FAST_LOAD_ERROR_MESSAGE);
				messageBox.open();
			}
		}
	};
	return listener;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:20,代码来源:VerifyTeraDataFastLoadOption.java


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