📄 uitextareaimpl.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: UITextAreaImpl.java
package org.gudy.azureus2.pluginsimpl.local.ui.components;
import java.io.*;
import java.util.Iterator;
import java.util.LinkedList;
import org.gudy.azureus2.core3.util.*;
import org.gudy.azureus2.plugins.ui.components.UIPropertyChangeListener;
import org.gudy.azureus2.plugins.ui.components.UITextArea;
// Referenced classes of package org.gudy.azureus2.pluginsimpl.local.ui.components:
// UIComponentImpl
public class UITextAreaImpl extends UIComponentImpl
implements UITextArea
{
private int max_size;
private int max_file_size;
PrintWriter pw;
int current_file_size;
File file;
boolean useFile;
AEMonitor file_mon;
LinkedList delay_text;
int delay_size;
FrequencyLimitedDispatcher dispatcher;
public UITextAreaImpl()
{
max_size = 60000;
max_file_size = 20 * max_size;
useFile = true;
file_mon = new AEMonitor("filemon");
delay_text = new LinkedList();
delay_size = 0;
dispatcher = new FrequencyLimitedDispatcher(new AERunnable() {
final UITextAreaImpl this$0;
public void runSupport()
{
delayAppend();
}
{
this$0 = UITextAreaImpl.this;
super();
}
}, 500);
setText("");
}
public void setText(String text)
{
if (!useFile)
break MISSING_BLOCK_LABEL_104;
file_mon.enter();
if (pw != null)
break MISSING_BLOCK_LABEL_84;
file = AETemporaryFileHandler.createTempFile();
FileWriter fr = new FileWriter(file);
pw = new PrintWriter(fr);
pw.print(text);
current_file_size = text.length();
pw.flush();
file_mon.exit();
return;
IOException e;
e;
file_mon.exit();
break MISSING_BLOCK_LABEL_104;
Exception exception;
exception;
file_mon.exit();
throw exception;
if (text.length() > max_size)
{
int size_to_show = max_size - 10000;
if (size_to_show < 0)
size_to_show = max_size;
text = text.substring(text.length() - size_to_show);
}
setProperty("value", text);
return;
}
public void appendText(String text)
{
if (!useFile || pw == null)
break MISSING_BLOCK_LABEL_83;
file_mon.enter();
if (current_file_size > max_file_size)
getFileText();
pw.print(text);
current_file_size += text.length();
pw.flush();
file_mon.exit();
return;
Exception exception;
exception;
file_mon.exit();
throw exception;
synchronized (this)
{
delay_text.addLast(text);
String s;
for (delay_size += text.length(); delay_size > max_size && delay_text.size() != 0; delay_size -= s.length())
s = (String)delay_text.removeFirst();
}
dispatcher.dispatch();
return;
}
protected void delayAppend()
{
String str = getText();
String text;
synchronized (this)
{
if (delay_text.size() == 1)
{
text = (String)delay_text.get(0);
} else
{
StringBuffer sb = new StringBuffer(delay_size);
for (Iterator it = delay_text.iterator(); it.hasNext(); sb.append((String)it.next()));
text = sb.toString();
}
delay_text.clear();
delay_size = 0;
}
if (str == null)
setText(text);
else
setText((new StringBuilder()).append(str).append(text).toString());
}
public String getText()
{
if (useFile && pw != null)
return getFileText();
else
return (String)getProperty("value");
}
public void setMaximumSize(int _max_size)
{
max_size = _max_size;
}
private String getFileText()
{
boolean recreate = pw != null;
String s;
file_mon.enter();
if (recreate)
pw.close();
String text = null;
try
{
text = FileUtil.readFileEndAsString(file, max_size);
}
catch (IOException e)
{
e.printStackTrace();
}
if (text == null)
text = "";
if (recreate)
try
{
FileWriter fr = new FileWriter(file);
pw = new PrintWriter(fr);
pw.print(text);
current_file_size = text.length();
}
catch (IOException e)
{
useFile = false;
e.printStackTrace();
}
s = text;
file_mon.exit();
return s;
Exception exception;
exception;
file_mon.exit();
throw exception;
}
public void addPropertyChangeListener(UIPropertyChangeListener l)
{
if (!useFile)
break MISSING_BLOCK_LABEL_66;
if (pw == null)
break MISSING_BLOCK_LABEL_53;
file_mon.enter();
pw.close();
pw = null;
file_mon.exit();
break MISSING_BLOCK_LABEL_53;
Exception exception;
exception;
file_mon.exit();
throw exception;
useFile = false;
setText(getFileText());
super.addPropertyChangeListener(l);
return;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -