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


Java Rex类代码示例

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


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

示例1: setBytes

import goryachev.common.util.Rex; //导入依赖的package包/类
protected final void setBytes(byte[] value)
{
	if(value == null)
	{
		encrypted = null;
	}
	else
	{
		try
		{
			encrypted = MemCrypt.encrypt(value);
		}
		catch(Exception e)
		{
			// should not happen
			throw new Rex(e);
		}
	}
}
 
开发者ID:andy-goryachev,项目名称:PasswordSafe,代码行数:20,代码来源:OpaqueMemObject.java

示例2: getBytes

import goryachev.common.util.Rex; //导入依赖的package包/类
/**
 * Returns decrypted byte array representing the stored object.
 */
public final byte[] getBytes()
{
	if(encrypted == null)
	{
		return null;
	}
	else
	{
		try
		{
			byte[] b = MemCrypt.decrypt(encrypted);
			return b;
		}
		catch(Exception e)
		{
			// should not happen
			throw new Rex(e);
		}
	}
}
 
开发者ID:andy-goryachev,项目名称:PasswordSafe,代码行数:24,代码来源:OpaqueMemObject.java

示例3: zero

import goryachev.common.util.Rex; //导入依赖的package包/类
public static void zero(CipherParameters p)
{
	try
	{
		if(p != null)
		{
			if(p instanceof KeyParameter)
			{
				zero(((KeyParameter)p).getKey());
			}
			else if(p instanceof ParametersWithIV)
			{
				zero(((ParametersWithIV)p).getParameters());
			}
			else
			{
				// should not see this in production
				throw new Rex("unknown " + p.getClass());
			}
		}
	}
	catch(Throwable e)
	{
		Log.ex(e);
	}
}
 
开发者ID:andy-goryachev,项目名称:PasswordSafe,代码行数:27,代码来源:Crypto.java

示例4: attach

import goryachev.common.util.Rex; //导入依赖的package包/类
public void attach(JComponent c)
{
	Object x = c.getClientProperty(KEY);
	if(x == null)
	{
		c.putClientProperty(KEY, this);
	}
	else if(x instanceof ComponentSettings)
	{
		((ComponentSettings)x).append(this);
	}
	else
	{
		throw new Rex("unable to attach, " + x);
	}
}
 
开发者ID:andy-goryachev,项目名称:PasswordSafe,代码行数:17,代码来源:ComponentSettings.java

示例5: getValue

import goryachev.common.util.Rex; //导入依赖的package包/类
public Object getValue(Component c)
{
	if(c instanceof JTextComponent)
	{
		return ((JTextComponent)c).getText();
	}
	if(c instanceof JCheckBox)
	{
		return ((JCheckBox)c).isSelected();
	}
	if(c instanceof JRadioButton)
	{
		return ((JRadioButton)c).isSelected();
	}
	else
	{
		throw new Rex("not supported: " + CKit.className(c));
	}
}
 
开发者ID:andy-goryachev,项目名称:PasswordSafe,代码行数:20,代码来源:FormLogic.java

示例6: monitor

import goryachev.common.util.Rex; //导入依赖的package包/类
/** each JTextComponent gets its own instance of CUndoManager */
public static void monitor(Object ... xs)
{
	for(Object x: xs)
	{
		CUndoManager u = getUndoManager(x);
		if(u == null)
		{
			if(x instanceof JTextComponent)
			{
				Document d = ((JTextComponent)x).getDocument();
				d.addUndoableEditListener(new CUndoManager());
			}
			else if(x instanceof AbstractDocument)
			{
				((AbstractDocument)x).addUndoableEditListener(new CUndoManager());
			}
			else
			{
				throw new Rex("unable to attach undo manager to " + CKit.simpleName(x));
			}
		}
	}
}
 
开发者ID:andy-goryachev,项目名称:PasswordSafe,代码行数:25,代码来源:CUndoManager.java

示例7: add

import goryachev.common.util.Rex; //导入依赖的package包/类
public void add(JComponent c)
{
	if(c instanceof JTextComponent)
	{
		JTextComponent tc = (JTextComponent)c;
		tc.getDocument().addDocumentListener(this);
		tc.addPropertyChangeListener(PROPERTY_DOCUMENT, this);
	}
	else if(c instanceof ItemSelectable)
	{
		((ItemSelectable)c).addItemListener(this);
	}
	else
	{
		throw new Rex("ignored: " + c);
	}
}
 
开发者ID:andy-goryachev,项目名称:PasswordSafe,代码行数:18,代码来源:InputTracker.java

示例8: check

import goryachev.common.util.Rex; //导入依赖的package包/类
private void check()
{
	SelectionSegment prev = null;
	for(SelectionSegment s: segments)
	{
		if(prev != null)
		{
			if(!prev.isBefore(s))
			{
				throw new Rex("selection is not ordered " + this);
			}
		}
		prev = s;
	}
}
 
开发者ID:andy-goryachev,项目名称:FxEditor,代码行数:16,代码来源:EditorSelection.java

示例9: register

import goryachev.common.util.Rex; //导入依赖的package包/类
@Deprecated // switch to KRecord everywhere
public static synchronized void register(String id, Class<?> type, PersistenceHandler h)
{
	// disallow disparate handlers
	// ok to register the same handler twice 
	PrimitiveHandler old = handlers.get(type);
	if(old != null)
	{
		if(old.getClass() != h.getClass())
		{
			throw new Rex("duplicate registration of type " + type);
		}
	}
	
	old = handlers.get(id);
	if(old != null)
	{
		if(id != ((PersistenceHandler)old).getTypeID())
		{
			throw new Rex("duplicate registration of type id " + id);
		}
	}
	
	h.setTypeID(id);
	handlers.put(type, h);
	handlers.put(id, h);
}
 
开发者ID:andy-goryachev,项目名称:FxEditor,代码行数:28,代码来源:Persister.java

示例10: createInputStream

import goryachev.common.util.Rex; //导入依赖的package包/类
private static final InputStream createInputStream(byte[] key, byte[] iv, InputStream is)
{
	PaddedBufferedBlockCipher c = new PaddedBufferedBlockCipher(new CBCBlockCipher(new AESEngine()));
	if(iv.length != c.getBlockSize())
	{
		throw new Rex("invalid block size");
	}
	CipherParameters p = new ParametersWithIV(new KeyParameter(key), iv);
	return new XCipherInputStream(c, p, is);
}
 
开发者ID:andy-goryachev,项目名称:PasswordSafe,代码行数:11,代码来源:DataFormatV1.java

示例11: createOutputStream

import goryachev.common.util.Rex; //导入依赖的package包/类
private static final OutputStream createOutputStream(byte[] key, byte[] iv, OutputStream os)
{
	PaddedBufferedBlockCipher c = new PaddedBufferedBlockCipher(new CBCBlockCipher(new AESEngine()));
	if(iv.length != c.getBlockSize())
	{
		throw new Rex("invalid block size");
	}
	CipherParameters p = new ParametersWithIV(new KeyParameter(key), iv);
	return new XCipherOutputStream(c, p, os);
}
 
开发者ID:andy-goryachev,项目名称:PasswordSafe,代码行数:11,代码来源:DataFormatV1.java

示例12: attach

import goryachev.common.util.Rex; //导入依赖的package包/类
private void attach(Component x)
{
	JComponent c = getJComponent(x);
	if(c == null)
	{
		throw new Rex("JFrame, JDialog, or JComponent");
	}
	c.putClientProperty(KEY, this);
}
 
开发者ID:andy-goryachev,项目名称:PasswordSafe,代码行数:10,代码来源:LocalSettings.java

示例13: add

import goryachev.common.util.Rex; //导入依赖的package包/类
public void add(Component c, String prop)
{
	if(components.put(prop, c) != null)
	{
		throw new Rex("name already present: " + prop); 
	}
}
 
开发者ID:andy-goryachev,项目名称:PasswordSafe,代码行数:8,代码来源:LocalSettings.java

示例14: setLayout

import goryachev.common.util.Rex; //导入依赖的package包/类
public void setLayout(LayoutManager m)
{
	if(m instanceof CTableLayout)
	{
		super.setLayout(m);
	}
	else
	{
		throw new Rex();
	}
}
 
开发者ID:andy-goryachev,项目名称:PasswordSafe,代码行数:12,代码来源:CPanel.java

示例15: setAction

import goryachev.common.util.Rex; //导入依赖的package包/类
private static void setAction(Container comp, Action a, int condition, KeyStroke k)
{
	if(k != null)
	{
		JComponent c;
		if(comp instanceof JComponent)
		{
			c = (JComponent)comp;
		}
		else if(comp instanceof RootPaneContainer)
		{
			c = ((RootPaneContainer)comp).getRootPane();
		}
		else
		{
			throw new Rex();
		}
		
		if(a == null)
		{
			c.getInputMap(condition).remove(k);
		}
		else
		{
			c.getActionMap().put(a, a);
			c.getInputMap(condition).put(k, a);
		}
	}
}
 
开发者ID:andy-goryachev,项目名称:PasswordSafe,代码行数:30,代码来源:UI.java


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