當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。