當前位置: 首頁>>代碼示例>>Java>>正文


Java FocusEvent類代碼示例

本文整理匯總了Java中org.eclipse.swt.events.FocusEvent的典型用法代碼示例。如果您正苦於以下問題:Java FocusEvent類的具體用法?Java FocusEvent怎麽用?Java FocusEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FocusEvent類屬於org.eclipse.swt.events包,在下文中一共展示了FocusEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: open

import org.eclipse.swt.events.FocusEvent; //導入依賴的package包/類
/**
 * Activates the editor at the given position.
 * 
 * @param row
 * @param col
 * @param rect
 */
public void open(KTable table, int col, int row, Rectangle rect) {
  m_Table = table;
  m_Model = table.getModel();
  m_Rect = rect;
  m_Row = row;
  m_Col = col;
  if (m_Control == null) {
    m_Control = createControl();
    m_Control.setToolTipText(toolTip);
    m_Control.addFocusListener(new FocusAdapter() {
      public void focusLost(FocusEvent arg0) {
        close(true);
      }
    });
  }
  setBounds(m_Rect);
  GC gc = new GC(m_Table);
  m_Table.drawCell(gc, m_Col, m_Row);
  gc.dispose();
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:28,代碼來源:KTableCellEditor.java

示例2: createViewer

import org.eclipse.swt.events.FocusEvent; //導入依賴的package包/類
protected  SourceViewer createViewer (Composite composite) {
	SourceViewer viewer = ViewerHelper.createEditor(composite);	
	viewer.getControl().setData(WIDGET_ID, WIDGET_ACTION_SCRIPT);
	FocusListener listener = new FocusListener() {
		@Override
		public void focusGained(FocusEvent e) {
		}

		@Override
		public void focusLost(FocusEvent event) {
			if (!notification) return;
            if (viewer.getDocument() == null) return;
            String content  = viewer.getDocument().get();
            getProperties().setPropertyValue(ModelProperties.PROPERTY_EDGE_ACTION, content);

		}
	};
	viewer.getControl().addFocusListener(listener);
	return viewer;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:21,代碼來源:EdgeActionSection.java

示例3: createViewer

import org.eclipse.swt.events.FocusEvent; //導入依賴的package包/類
protected  SourceViewer createViewer (Composite composite) {
	SourceViewer viewer = ViewerHelper.createEditor(composite);	
	viewer.getControl().setData(WIDGET_ID, WIDGET_GUARD_SCRIPT);
	FocusListener listener = new FocusListener() {
		@Override
		public void focusGained(FocusEvent e) {
		}

		@Override
		public void focusLost(FocusEvent event) {
			if (!notification) return;
            if (viewer.getDocument() == null) return;
            String content  = viewer.getDocument().get();
            getProperties().setPropertyValue(ModelProperties.PROPERTY_EDGE_GUARD, content);
		}
	};
	viewer.getControl().addFocusListener(listener);
	return viewer;		
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:20,代碼來源:EdgeGuardSection.java

示例4: focusLost

import org.eclipse.swt.events.FocusEvent; //導入依賴的package包/類
@Override
public void focusLost(FocusEvent e) {
	if (!notification)
		return;
	GW4EVertexEditPartProperties properties = (GW4EVertexEditPartProperties) sectionProvider
			.getAdapter(IPropertySource.class);

	txtSharedNameDecorator.hide();

	String value = textSharedName.getText();
	if (value == null || value.trim().length() == 0) {
		txtSharedNameDecorator.show();
		return;
	}
	
	properties.setPropertyValue(ModelProperties.PROPERTY_VERTEX_SHAREDNAME,value);
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:18,代碼來源:VertexDefaultSection.java

示例5: focusLost

import org.eclipse.swt.events.FocusEvent; //導入依賴的package包/類
public void focusLost(FocusEvent e) {
    if (e.getSource() == this.minimumRangeValue) {
        // verify min value
        if (! validateMinimum( this.minimumRangeValue.getText()))
            this.minimumRangeValue.setText(String.valueOf(
                    this.minimumValue));
        else
            this.minimumValue = Double.parseDouble(
                    this.minimumRangeValue.getText());
    }
    else if (e.getSource() == this.maximumRangeValue) {
        // verify max value
        if (! validateMaximum(this.maximumRangeValue.getText()))
            this.maximumRangeValue.setText(String.valueOf(
                    this.maximumValue));
        else
            this.maximumValue = Double.parseDouble(
                    this.maximumRangeValue.getText());
    }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:21,代碼來源:SWTNumberAxisEditor.java

示例6: focusLost

import org.eclipse.swt.events.FocusEvent; //導入依賴的package包/類
public void focusLost(FocusEvent e) {
    if (e.getSource() == this.minimumRangeValue) {
        // verify min value
        if (!validateMinimum(this.minimumRangeValue.getText()))
            this.minimumRangeValue.setText(String.valueOf(
                    this.minimumValue));
        else
            this.minimumValue = Double.parseDouble(
                    this.minimumRangeValue.getText());
    }
    else if (e.getSource() == this.maximumRangeValue) {
        // verify max value
        if (!validateMaximum(this.maximumRangeValue.getText()))
            this.maximumRangeValue.setText(String.valueOf(
                    this.maximumValue));
        else
            this.maximumValue = Double.parseDouble(
                    this.maximumRangeValue.getText());
    }
}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:21,代碼來源:SWTNumberAxisEditor.java

示例7: focusGained

import org.eclipse.swt.events.FocusEvent; //導入依賴的package包/類
@Override
public void focusGained(final FocusEvent e) {
    if (!(e.widget instanceof Text)) {
        return;
    }

    final Text text = (Text) e.widget;

    final Boolean b = (Boolean) text.getData(DECORATED_KEY);
    if (b != null) {
        if (b.booleanValue()) {
            final ModifyListener modifyListener = (ModifyListener) text.getData(MODIFY_LISTENER_KEY);
            if (modifyListener != null) {
                text.removeModifyListener(modifyListener);
            }
            text.setForeground(null);
            text.setText(""); //$NON-NLS-1$
            if (modifyListener != null) {
                text.addModifyListener(modifyListener);
            }
        }

        text.setData(DECORATED_KEY, Boolean.FALSE);
    }
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:26,代碼來源:WITSearchDialog.java

示例8: focusGained

import org.eclipse.swt.events.FocusEvent; //導入依賴的package包/類
@Override
public void focusGained(final FocusEvent e) {
    final Text text = (Text) e.widget;

    final Boolean addedDecoration = (Boolean) e.widget.getData(HISTORY_TEXT_DECORATION_KEY);
    if (addedDecoration == null || !addedDecoration.booleanValue()) {
        return;
    }

    final ModifyListener modifyListener = (ModifyListener) text.getData(UPDATE_WORK_ITEM_LISTENER_KEY);
    text.removeModifyListener(modifyListener);
    text.setText(""); //$NON-NLS-1$
    text.addModifyListener(modifyListener);

    // Mac hack: grow to at least 60px so that the scroll bar displays
    // properly
    if (WindowSystem.isCurrentWindowSystem(WindowSystem.AQUA)) {
        ((GridData) text.getLayoutData()).heightHint = 70;
        text.getParent().layout(true);
    }

    e.widget.setData(HISTORY_TEXT_DECORATION_KEY, null);
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:24,代碼來源:WorkItemHistoryControl.java

示例9: focusLost

import org.eclipse.swt.events.FocusEvent; //導入依賴的package包/類
@Override
public void focusLost(final FocusEvent e) {
    final Text text = (Text) e.widget;

    if (text.getText().trim().length() != 0) {
        return;
    }

    final Boolean addedDecoration = (Boolean) e.widget.getData(HISTORY_TEXT_DECORATION_KEY);
    if (addedDecoration != null && addedDecoration.booleanValue()) {
        return;
    }

    final ModifyListener modifyListener = (ModifyListener) text.getData(UPDATE_WORK_ITEM_LISTENER_KEY);
    text.removeModifyListener(modifyListener);
    text.setText(DECORATION_TEXT);
    text.addModifyListener(modifyListener);

    e.widget.setData(HISTORY_TEXT_DECORATION_KEY, Boolean.valueOf(true));
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:21,代碼來源:WorkItemHistoryControl.java

示例10: edit

import org.eclipse.swt.events.FocusEvent; //導入依賴的package包/類
private void edit(final TableItem item, final TableEditor tableEditor) {
    final Text text = new Text(table, SWT.NONE);
    text.setText(item.getText(targetColumn));

    text.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(final FocusEvent e) {
            item.setText(targetColumn, text.getText());
            text.dispose();
        }

    });

    tableEditor.setEditor(text, item, targetColumn);
    text.setFocus();
    text.selectAll();
}
 
開發者ID:roundrop,項目名稱:ermasterr,代碼行數:19,代碼來源:ModelPropertiesDialog.java

示例11: edit

import org.eclipse.swt.events.FocusEvent; //導入依賴的package包/類
private void edit(final TableItem item, final TableEditor tableEditor) {
	final Text text = new Text(table, SWT.NONE);
	text.setText(item.getText(targetColumn));

	text.addFocusListener(new FocusAdapter() {

		@Override
		public void focusLost(FocusEvent e) {
			item.setText(targetColumn, text.getText());
			text.dispose();
		}

	});

	tableEditor.setEditor(text, item, targetColumn);
	text.setFocus();
	text.selectAll();
}
 
開發者ID:kozake,項目名稱:ermaster-k,代碼行數:19,代碼來源:ModelPropertiesDialog.java

示例12: focusGained

import org.eclipse.swt.events.FocusEvent; //導入依賴的package包/類
@Override
public void focusGained(FocusEvent e) {
	Control c = (Control) e.getSource();
	ServiceInstance service = (ServiceInstance) c.getData();

	Rectangle bounds = service.getAppxLocation(); // child.getBounds();
	Rectangle area = scrollComp.getClientArea();
	Point origin = scrollComp.getOrigin();

	// Our view is lower than the item
	if (origin.y > bounds.y) {
		origin.y = Math.max(0, bounds.y);
	}

	// Our view is above the item
	if (origin.y + area.height < bounds.y + bounds.height) {
		origin.y = Math.max(0, bounds.y + bounds.height - area.height);
	}

	scrollComp.setOrigin(origin);
}
 
開發者ID:eclipse,項目名稱:cft,代碼行數:22,代碼來源:CloudFoundryServiceWizardPageRightPanel.java

示例13: focusChanged

import org.eclipse.swt.events.FocusEvent; //導入依賴的package包/類
private void focusChanged(FocusEvent e)
{
	Control control = fControl;
	if (Helper.okToUse(control))
	{
		Display d = control.getDisplay();
		if (d != null)
		{
			d.asyncExec(new Runnable()
			{
				public void run()
				{
					if (!fProposalPopup.hasFocus()
							&& (fContextInfoPopup == null || !fContextInfoPopup.hasFocus()))
					{
						hide();
					}
				}
			});
		}
	}
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:23,代碼來源:ContentAssistant.java

示例14: focusLost

import org.eclipse.swt.events.FocusEvent; //導入依賴的package包/類
/**
 * @see org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt.events.FocusEvent)
 */
public void focusLost(FocusEvent e) {
    if (association.getName().equals(labelTextName.getText())) {
        return;
    }

    DomainUtil.run(new TransactionalAction() {
        /**
         * @see nexcore.tool.uml.manager.transaction.TransactionalAction#doExecute()
         */
        @Override
        public void doExecute() {
            association.setName(labelTextName.getText());
        }
    });
}
 
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:19,代碼來源:AssociationGeneralSection.java

示例15: focusLost

import org.eclipse.swt.events.FocusEvent; //導入依賴的package包/類
/**
 * @see org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt.events.FocusEvent)
 */
public void focusLost(FocusEvent e) {
    String text = multiplicityCombo.getText();

    try {
        final int value = new Integer(text).intValue();
        final Property property = this.getData();
        if (value > 0) {

            DomainUtil.run(new TransactionalAction() {
                @Override
                public void doExecute() {
                    property.setLower(value);
                    property.setUpper(value);
                }
            });
        }
    } catch (Exception e2) {
        // TODO: handle exception
    }

}
 
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:25,代碼來源:MultiplicityGeneralSection.java


注:本文中的org.eclipse.swt.events.FocusEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。