text:
.class Landroid/net/LocalSocketImpl;
.super Ljava/lang/Object;
.source "LocalSocketImpl.java"

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Landroid/net/LocalSocketImpl$SocketOutputStream;,
        Landroid/net/LocalSocketImpl$SocketInputStream;
    }
.end annotation

# instance fields
.field private fd:Ljava/io/FileDescriptor;

.field private fis:Landroid/net/LocalSocketImpl$SocketInputStream;

.field private fos:Landroid/net/LocalSocketImpl$SocketOutputStream;

.field inboundFileDescriptors:[Ljava/io/FileDescriptor;

.field outboundFileDescriptors:[Ljava/io/FileDescriptor;

.field private readMonitor:Ljava/lang/Object;

.field private writeMonitor:Ljava/lang/Object;

# direct methods
.method constructor <init>()V
    .locals 1

    .prologue
    .line 183
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 33
    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Landroid/net/LocalSocketImpl;->readMonitor:Ljava/lang/Object;

    .line 34
    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Landroid/net/LocalSocketImpl;->writeMonitor:Ljava/lang/Object;

    .line 184
    return-void
.end method

.method constructor <init>(Ljava/io/FileDescriptor;)V
    .locals 1
    .parameter "fd"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 194
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 33
    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Landroid/net/LocalSocketImpl;->readMonitor:Ljava/lang/Object;

    .line 34
    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Landroid/net/LocalSocketImpl;->writeMonitor:Ljava/lang/Object;

    .line 195
    iput-object p1, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    .line 196
    return-void
.end method

.method private native accept(Ljava/io/FileDescriptor;Landroid/net/LocalSocketImpl;)Ljava/io/FileDescriptor;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation
.end method

.method static synthetic access$000(Landroid/net/LocalSocketImpl;)Ljava/io/FileDescriptor;
    .locals 1
    .parameter "x0"

    .prologue
    .line 29
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    return-object v0
.end method

.method static synthetic access$100(Landroid/net/LocalSocketImpl;Ljava/io/FileDescriptor;)I
    .locals 1
    .parameter "x0"
    .parameter "x1"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 29
    invoke-direct {p0, p1}, Landroid/net/LocalSocketImpl;->available_native(Ljava/io/FileDescriptor;)I

    move-result v0

    return v0
.end method

.method static synthetic access$200(Landroid/net/LocalSocketImpl;)Ljava/lang/Object;
    .locals 1
    .parameter "x0"

    .prologue
    .line 29
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->readMonitor:Ljava/lang/Object;

    return-object v0
.end method

.method static synthetic access$300(Landroid/net/LocalSocketImpl;Ljava/io/FileDescriptor;)I
    .locals 1
    .parameter "x0"
    .parameter "x1"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 29
    invoke-direct {p0, p1}, Landroid/net/LocalSocketImpl;->read_native(Ljava/io/FileDescriptor;)I

    move-result v0

    return v0
.end method

.method static synthetic access$400(Landroid/net/LocalSocketImpl;[BIILjava/io/FileDescriptor;)I
    .locals 1
    .parameter "x0"
    .parameter "x1"
    .parameter "x2"
    .parameter "x3"
    .parameter "x4"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 29
    invoke-direct {p0, p1, p2, p3, p4}, Landroid/net/LocalSocketImpl;->readba_native([BIILjava/io/FileDescriptor;)I

    move-result v0

    return v0
.end method

.method static synthetic access$500(Landroid/net/LocalSocketImpl;)Ljava/lang/Object;
    .locals 1
    .parameter "x0"

    .prologue
    .line 29
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->writeMonitor:Ljava/lang/Object;

    return-object v0
.end method

.method static synthetic access$600(Landroid/net/LocalSocketImpl;[BIILjava/io/FileDescriptor;)V
    .locals 0
    .parameter "x0"
    .parameter "x1"
    .parameter "x2"
    .parameter "x3"
    .parameter "x4"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 29
    invoke-direct {p0, p1, p2, p3, p4}, Landroid/net/LocalSocketImpl;->writeba_native([BIILjava/io/FileDescriptor;)V

    return-void
.end method

.method static synthetic access$700(Landroid/net/LocalSocketImpl;ILjava/io/FileDescriptor;)V
    .locals 0
    .parameter "x0"
    .parameter "x1"
    .parameter "x2"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 29
    invoke-direct {p0, p1, p2}, Landroid/net/LocalSocketImpl;->write_native(ILjava/io/FileDescriptor;)V

    return-void
.end method

.method private native available_native(Ljava/io/FileDescriptor;)I
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation
.end method

.method private native bindLocal(Ljava/io/FileDescriptor;Ljava/lang/String;I)V
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation
.end method

.method private native close_native(Ljava/io/FileDescriptor;)V
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation
.end method

.method private native connectLocal(Ljava/io/FileDescriptor;Ljava/lang/String;I)V
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation
.end method

.method private native create_native(Z)Ljava/io/FileDescriptor;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation
.end method

.method private native getOption_native(Ljava/io/FileDescriptor;I)I
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation
.end method

.method private native getPeerCredentials_native(Ljava/io/FileDescriptor;)Landroid/net/Credentials;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation
.end method

.method private native listen_native(Ljava/io/FileDescriptor;I)V
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation
.end method

.method private native read_native(Ljava/io/FileDescriptor;)I
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation
.end method

.method private native readba_native([BIILjava/io/FileDescriptor;)I
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation
.end method

.method private native setOption_native(Ljava/io/FileDescriptor;III)V
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation
.end method

.method private native shutdown(Ljava/io/FileDescriptor;Z)V
.end method

.method private native write_native(ILjava/io/FileDescriptor;)V
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation
.end method

.method private native writeba_native([BIILjava/io/FileDescriptor;)V
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation
.end method

# virtual methods
.method protected accept(Landroid/net/LocalSocketImpl;)V
    .locals 2
    .parameter "s"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 275
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    if-nez v0, :cond_0

    .line 276
    new-instance v0, Ljava/io/IOException;

    const-string/jumbo v1, "socket not created"

    invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 279
    :cond_0
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    invoke-direct {p0, v0, p1}, Landroid/net/LocalSocketImpl;->accept(Ljava/io/FileDescriptor;Landroid/net/LocalSocketImpl;)Ljava/io/FileDescriptor;

    move-result-object v0

    iput-object v0, p1, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    .line 280
    return-void
.end method

.method protected available()I
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 332
    invoke-virtual {p0}, Landroid/net/LocalSocketImpl;->getInputStream()Ljava/io/InputStream;

    move-result-object v0

    invoke-virtual {v0}, Ljava/io/InputStream;->available()I

    move-result v0

    return v0
.end method

.method public bind(Landroid/net/LocalSocketAddress;)V
    .locals 3
    .parameter "endpoint"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 250
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    if-nez v0, :cond_0

    .line 251
    new-instance v0, Ljava/io/IOException;

    const-string/jumbo v1, "socket not created"

    invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 254
    :cond_0
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    invoke-virtual {p1}, Landroid/net/LocalSocketAddress;->getName()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p1}, Landroid/net/LocalSocketAddress;->getNamespace()Landroid/net/LocalSocketAddress$Namespace;

    move-result-object v2

    invoke-virtual {v2}, Landroid/net/LocalSocketAddress$Namespace;->getId()I

    move-result v2

    invoke-direct {p0, v0, v1, v2}, Landroid/net/LocalSocketImpl;->bindLocal(Ljava/io/FileDescriptor;Ljava/lang/String;I)V

    .line 255
    return-void
.end method

.method public close()V
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 223
    monitor-enter p0

    .line 224
    :try_start_0
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    if-nez v0, :cond_0

    monitor-exit p0

    .line 228
    :goto_0
    return-void

    .line 225
    :cond_0
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    invoke-direct {p0, v0}, Landroid/net/LocalSocketImpl;->close_native(Ljava/io/FileDescriptor;)V

    .line 226
    const/4 v0, 0x0

    iput-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    .line 227
    monitor-exit p0

    goto :goto_0

    :catchall_0
    move-exception v0

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method protected connect(Landroid/net/LocalSocketAddress;I)V
    .locals 3
    .parameter "address"
    .parameter "timeout"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 234
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    if-nez v0, :cond_0

    .line 235
    new-instance v0, Ljava/io/IOException;

    const-string/jumbo v1, "socket not created"

    invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 238
    :cond_0
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    invoke-virtual {p1}, Landroid/net/LocalSocketAddress;->getName()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p1}, Landroid/net/LocalSocketAddress;->getNamespace()Landroid/net/LocalSocketAddress$Namespace;

    move-result-object v2

    invoke-virtual {v2}, Landroid/net/LocalSocketAddress$Namespace;->getId()I

    move-result v2

    invoke-direct {p0, v0, v1, v2}, Landroid/net/LocalSocketImpl;->connectLocal(Ljava/io/FileDescriptor;Ljava/lang/String;I)V

    .line 239
    return-void
.end method

.method public create(Z)V
    .locals 1
    .parameter "stream"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 212
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    if-nez v0, :cond_0

    .line 213
    invoke-direct {p0, p1}, Landroid/net/LocalSocketImpl;->create_native(Z)Ljava/io/FileDescriptor;

    move-result-object v0

    iput-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    .line 215
    :cond_0
    return-void
.end method

.method protected finalize()V
    .locals 0
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 487
    invoke-virtual {p0}, Landroid/net/LocalSocketImpl;->close()V

    .line 488
    return-void
.end method

.method public getAncillaryFileDescriptors()[Ljava/io/FileDescriptor;
    .locals 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 452
    iget-object v2, p0, Landroid/net/LocalSocketImpl;->readMonitor:Ljava/lang/Object;

    monitor-enter v2

    .line 453
    :try_start_0
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->inboundFileDescriptors:[Ljava/io/FileDescriptor;

    .line 455
    .local v0, result:[Ljava/io/FileDescriptor;
    const/4 v1, 0x0

    iput-object v1, p0, Landroid/net/LocalSocketImpl;->inboundFileDescriptors:[Ljava/io/FileDescriptor;

    .line 456
    monitor-exit v2

    return-object v0

    .line 457
    .end local v0           #result:[Ljava/io/FileDescriptor;
    :catchall_0
    move-exception v1

    monitor-exit v2
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v1
.end method

.method protected getFileDescriptor()Ljava/io/FileDescriptor;
    .locals 1

    .prologue
    .line 365
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    return-object v0
.end method

.method protected getInputStream()Ljava/io/InputStream;
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 290
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    if-nez v0, :cond_0

    .line 291
    new-instance v0, Ljava/io/IOException;

    const-string/jumbo v1, "socket not created"

    invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 294
    :cond_0
    monitor-enter p0

    .line 295
    :try_start_0
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fis:Landroid/net/LocalSocketImpl$SocketInputStream;

    if-nez v0, :cond_1

    .line 296
    new-instance v0, Landroid/net/LocalSocketImpl$SocketInputStream;

    invoke-direct {v0, p0}, Landroid/net/LocalSocketImpl$SocketInputStream;-><init>(Landroid/net/LocalSocketImpl;)V

    iput-object v0, p0, Landroid/net/LocalSocketImpl;->fis:Landroid/net/LocalSocketImpl$SocketInputStream;

    .line 299
    :cond_1
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fis:Landroid/net/LocalSocketImpl$SocketInputStream;

    monitor-exit p0

    return-object v0

    .line 300
    :catchall_0
    move-exception v0

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public getOption(I)Ljava/lang/Object;
    .locals 3
    .parameter "optID"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 380
    iget-object v1, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    if-nez v1, :cond_0

    .line 381
    new-instance v1, Ljava/io/IOException;

    const-string/jumbo v2, "socket not created"

    invoke-direct {v1, v2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v1

    .line 384
    :cond_0
    const/16 v1, 0x1006

    if-ne p1, v1, :cond_1

    .line 385
    const/4 v1, 0x0

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    .line 396
    :goto_0
    return-object v1

    .line 388
    :cond_1
    iget-object v1, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    invoke-direct {p0, v1, p1}, Landroid/net/LocalSocketImpl;->getOption_native(Ljava/io/FileDescriptor;I)I

    move-result v0

    .line 389
    .local v0, value:I
    packed-switch p1, :pswitch_data_0

    .line 396
    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    goto :goto_0

    .line 393
    :pswitch_0
    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    goto :goto_0

    .line 389
    :pswitch_data_0
    .packed-switch 0x1001
        :pswitch_0
        :pswitch_0
    .end packed-switch
.end method

.method protected getOutputStream()Ljava/io/OutputStream;
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 311
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    if-nez v0, :cond_0

    .line 312
    new-instance v0, Ljava/io/IOException;

    const-string/jumbo v1, "socket not created"

    invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 315
    :cond_0
    monitor-enter p0

    .line 316
    :try_start_0
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fos:Landroid/net/LocalSocketImpl$SocketOutputStream;

    if-nez v0, :cond_1

    .line 317
    new-instance v0, Landroid/net/LocalSocketImpl$SocketOutputStream;

    invoke-direct {v0, p0}, Landroid/net/LocalSocketImpl$SocketOutputStream;-><init>(Landroid/net/LocalSocketImpl;)V

    iput-object v0, p0, Landroid/net/LocalSocketImpl;->fos:Landroid/net/LocalSocketImpl$SocketOutputStream;

    .line 320
    :cond_1
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fos:Landroid/net/LocalSocketImpl$SocketOutputStream;

    monitor-exit p0

    return-object v0

    .line 321
    :catchall_0
    move-exception v0

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public getPeerCredentials()Landroid/net/Credentials;
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 469
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    invoke-direct {p0, v0}, Landroid/net/LocalSocketImpl;->getPeerCredentials_native(Ljava/io/FileDescriptor;)Landroid/net/Credentials;

    move-result-object v0

    return-object v0
.end method

.method public getSockAddress()Landroid/net/LocalSocketAddress;
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 480
    const/4 v0, 0x0

    return-object v0
.end method

.method protected listen(I)V
    .locals 2
    .parameter "backlog"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 259
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    if-nez v0, :cond_0

    .line 260
    new-instance v0, Ljava/io/IOException;

    const-string/jumbo v1, "socket not created"

    invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 263
    :cond_0
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    invoke-direct {p0, v0, p1}, Landroid/net/LocalSocketImpl;->listen_native(Ljava/io/FileDescriptor;I)V

    .line 264
    return-void
.end method

.method protected sendUrgentData(I)V
    .locals 2
    .parameter "data"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 375
    new-instance v0, Ljava/lang/RuntimeException;

    const-string/jumbo v1, "not impled"

    invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v0
.end method

.method public setFileDescriptorsForSend([Ljava/io/FileDescriptor;)V
    .locals 2
    .parameter "fds"

    .prologue
    .line 436
    iget-object v1, p0, Landroid/net/LocalSocketImpl;->writeMonitor:Ljava/lang/Object;

    monitor-enter v1

    .line 437
    :try_start_0
    iput-object p1, p0, Landroid/net/LocalSocketImpl;->outboundFileDescriptors:[Ljava/io/FileDescriptor;

    .line 438
    monitor-exit v1

    .line 439
    return-void

    .line 438
    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public setOption(ILjava/lang/Object;)V
    .locals 5
    .parameter "optID"
    .parameter "value"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 408
    const/4 v0, -0x1

    .line 409
    .local v0, boolValue:I
    const/4 v1, 0x0

    .line 411
    .local v1, intValue:I
    iget-object v2, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    if-nez v2, :cond_0

    .line 412
    new-instance v2, Ljava/io/IOException;

    const-string/jumbo v3, "socket not created"

    invoke-direct {v2, v3}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v2

    .line 415
    :cond_0
    instance-of v2, p2, Ljava/lang/Integer;

    if-eqz v2, :cond_1

    .line 416
    check-cast p2, Ljava/lang/Integer;

    .end local p2
    invoke-virtual {p2}, Ljava/lang/Integer;->intValue()I

    move-result v1

    .line 423
    :goto_0
    iget-object v2, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    invoke-direct {p0, v2, p1, v0, v1}, Landroid/net/LocalSocketImpl;->setOption_native(Ljava/io/FileDescriptor;III)V

    .line 424
    return-void

    .line 417
    .restart local p2
    :cond_1
    instance-of v2, p2, Ljava/lang/Boolean;

    if-eqz v2, :cond_3

    .line 418
    check-cast p2, Ljava/lang/Boolean;

    .end local p2
    invoke-virtual {p2}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v2

    if-eqz v2, :cond_2

    const/4 v0, 0x1

    :goto_1
    goto :goto_0

    :cond_2
    const/4 v0, 0x0

    goto :goto_1

    .line 420
    .restart local p2
    :cond_3
    new-instance v2, Ljava/io/IOException;

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "bad value: "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v2
.end method

.method protected shutdownInput()V
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 342
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    if-nez v0, :cond_0

    .line 343
    new-instance v0, Ljava/io/IOException;

    const-string/jumbo v1, "socket not created"

    invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 346
    :cond_0
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    const/4 v1, 0x1

    invoke-direct {p0, v0, v1}, Landroid/net/LocalSocketImpl;->shutdown(Ljava/io/FileDescriptor;Z)V

    .line 347
    return-void
.end method

.method protected shutdownOutput()V
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 356
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    if-nez v0, :cond_0

    .line 357
    new-instance v0, Ljava/io/IOException;

    const-string/jumbo v1, "socket not created"

    invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 360
    :cond_0
    iget-object v0, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    const/4 v1, 0x0

    invoke-direct {p0, v0, v1}, Landroid/net/LocalSocketImpl;->shutdown(Ljava/io/FileDescriptor;Z)V

    .line 361
    return-void
.end method

.method protected supportsUrgentData()Z
    .locals 1

    .prologue
    .line 370
    const/4 v0, 0x0

    return v0
.end method

.method public toString()Ljava/lang/String;
    .locals 2

    .prologue
    .line 199
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    invoke-super {p0}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, " fd:"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget-object v1, p0, Landroid/net/LocalSocketImpl;->fd:Ljava/io/FileDescriptor;

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method


text:
import Link from "gatsby-link";
import * as React from "react";
import styled from "styled-components";

import { colorProp } from "../styles/themes";

interface Props {
  date: string;
  excerpt: string;
  slug: string;
  title: string;
}

export default ({ date, excerpt, slug, title }: Props) => (
  <Listing>
    <Title>
      <Link style={{ boxShadow: "none" }} to={slug}>
        {title}
      </Link>
    </Title>
    <PublishDate>{date}</PublishDate>
    <p dangerouslySetInnerHTML={{ __html: excerpt }} />
  </Listing>
);

const Listing = styled.div`
  border-bottom: 1px solid ${colorProp("greyLight")};

  :last-child {
    border-bottom-color: transparent;
  }
`;

const Title = styled.h3`
  margin-bottom: 0;
`;

const PublishDate = styled.small`
  color: ${colorProp("greyLight")};
  display: block;
  font-style: italic;
  margin-bottom: 1rem;
`;

redpajama_set_name: RedPajamaGithub


text:
package org.jkiss.dbeaver.tools.project;

/**
 * Import/Export constants
 */
class ExportConstants {

    public static final String ARCHIVE_FILE_EXT = ".dbp"; //NON-NLS-1

    public static final String DIR_PROJECTS = "projects"; //NON-NLS-1
    public static final String DIR_DRIVERS = "drivers"; //NON-NLS-1

    public static final String META_FILENAME = "meta.xml"; //NON-NLS-1

    public static final String TAG_ARCHIVE = "archive"; //NON-NLS-1
    public static final String TAG_SOURCE = "source";
    public static final String TAG_PROJECTS = "projects"; //NON-NLS-1
    public static final String TAG_PROJECT = "project"; //NON-NLS-1
    public static final String TAG_RESOURCE = "resource"; //NON-NLS-1
    public static final String TAG_ATTRIBUTE = "attribute"; //NON-NLS-1
    public static final String TAG_LIBRARIES = "libraries"; //NON-NLS-1

    public static final String ATTR_VERSION = "version"; //NON-NLS-1
    public static final String ATTR_HOST = "host";
    public static final String ATTR_ADDRESS = "address";
    public static final String ATTR_TIME = "time";
    public static final String ATTR_QUALIFIER = "qualifier"; //NON-NLS-1
    public static final String ATTR_NAME = "name"; //NON-NLS-1
    public static final String ATTR_VALUE = "value"; //NON-NLS-1
    public static final String ATTR_DIRECTORY = "directory"; //NON-NLS-1
    public static final String ATTR_DESCRIPTION = "description"; //NON-NLS-1
    public static final String ATTR_CHARSET = "charset"; //NON-NLS-1
    public static final String ATTR_PATH = "path"; //NON-NLS-1
    public static final String ATTR_FILE = "file"; //NON-NLS-1

    public static final int ARCHIVE_VERSION_1 = 1;
    public static final int ARCHIVE_VERSION_CURRENT = ARCHIVE_VERSION_1;

}


text:
package com.gh4a.adapter;

import org.eclipse.egit.github.core.Release;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.gh4a.R;
import com.gh4a.utils.StringUtils;

public class ReleaseAdapter extends RootAdapter<Release> {
    public ReleaseAdapter(Context context) {
        super(context);
    }

    @Override
    protected View createView(LayoutInflater inflater, ViewGroup parent, int viewType) {
        View v = inflater.inflate(R.layout.row_release, null);
        ViewHolder viewHolder = new ViewHolder();

        viewHolder.tvTitle = (TextView) v.findViewById(R.id.tv_title);
        viewHolder.tvType = (TextView) v.findViewById(R.id.tv_type);
        viewHolder.tvCreatedAt  = (TextView) v.findViewById(R.id.tv_created_at);

        v.setTag(viewHolder);
        return v;
    }

    @Override
    protected void bindView(View v, Release release) {
        ViewHolder viewHolder = (ViewHolder) v.getTag();

        viewHolder.tvTitle.setText(release.getName());
        viewHolder.tvType.setText(formatReleaseType(release));
        viewHolder.tvCreatedAt.setText(mContext.getString(R.string.download_created,
                StringUtils.formatRelativeTime(mContext, release.getCreatedAt(), true)));
    }

    private String formatReleaseType(Release release) {
        if (release.isDraft()) {
            return mContext.getString(R.string.release_type_draft);
        }
        if (release.isPreRelease()) {
            return mContext.getString(R.string.release_type_prerelease);
        }
        return mContext.getString(R.string.release_type_final);
    }

    private static class ViewHolder {
        public TextView tvTitle;
        public TextView tvType;
        public TextView tvCreatedAt;
    }
}


text:
class NativeEmbedWidget : public QWidget{
	Q_OBJECT
private:
	NativeWindow *WIN;
	QSize winSize;
	QImage winImage;
	bool paused, hasAlphaChannel;

private slots:
	//Simplification functions
	void syncWinSize(QSize sz = QSize());
	void syncWidgetSize(QSize sz);
	void hideWindow();
	void showWindow();
	QImage windowImage(QRect geom);

	void setWinUnpaused();

public:
	NativeEmbedWidget(QWidget *parent);

	bool embedWindow(NativeWindow *window);
	bool detachWindow();
	bool isEmbedded(); //status of the embed
	bool isPaused(){ return paused; }

public slots:
	void raiseWindow();
	void lowerWindow();

	//Pause/resume
	void pause();
	void resume();

	void resyncWindow();
	void repaintWindow();
	void reregisterEvents();

protected:
	void resizeEvent(QResizeEvent *ev);
	void showEvent(QShowEvent *ev);
	void hideEvent(QHideEvent *ev);
	void paintEvent(QPaintEvent *ev);
	void enterEvent(QEvent *ev);
	void leaveEvent(QEvent *ev);
	void mouseMoveEvent(QMouseEvent *ev);
	void mousePressEvent(QMouseEvent *ev);
	void mouseReleaseEvent(QMouseEvent *ev);
	//bool nativeEvent(const QByteArray &eventType, void *message, long *result);
};

#endif


text:
/**
 * Please use 4 spaces for tabs when editing this file. Hard tabs are not portable.
 */
(function ($) {

    "use strict";

    portal.chat.debug = false;

    if (typeof console === 'undefined') portal.chat.debug = false;

    // Portal chat depends on session storage and JSON. If either aren't
    // supported in the browser, return without doing anything.
    if (typeof sessionStorage === 'undefined' || typeof JSON === 'undefined') {
        return;
    }

    portal.chat.showOfflineConnections = false;
    portal.chat.currentConnections = {};
    portal.chat.onlineConnections = [];
    portal.chat.currentConnectionsMap = {};
    portal.chat.currentSiteUsers = {};
    portal.chat.currentSiteUsersMap = {};
    portal.chat.expanded = false;
    portal.chat.offline = false;
    portal.chat.currentChats = [];
    portal.chat.getLatestDataInterval = null;
    portal.chat.connectionErrors = 0;
    portal.chat.MAX_CONTENT_HEIGHT = 250;
    portal.chat.originalTitle = document.title;
    portal.chat.connectionsAvailable = true;
    portal.chat.videoOff = false;
    portal.chat.openWindows = 0;

    /* Set elements names depending on portal handler*/

    portal.chat.domSelectors = {};
    portal.chat.domNames = {};

    portal.chat.domNames = {
        pcChatWin : 'Mrphs-portalChat__chat--window',
        pcChatWithPre: 'Mrphs-portalChat__chat--with-',
        pcMaximised : 'Mrphs-portalChat__chat--maximised',
        pcMinimised: 'Mrphs-portalChat__chat--minimised',
        pcDisplayName: 'Mrphs-portalChat__chat--displayname',
        pcMessage: 'Mrphs-portalChat__chat--message',
        pcNewMessage: 'Mrphs-portalChat__message--new',
        pcChatVideoLocalVideo: 'Mrphs-portalChat__video--localvideo',
        pcChatRemoteVideoPre: 'Mrphs-portalChat__videochat--remotevideo-'

    };

    portal.chat.domSelectors = {
        footerApp : '#Mrphs-footerApp',
        footerAppChat : '#Mrphs-footerApp__chat',
        footerAppChatToggle: '#Mrphs-footerApp--toggle',
        pcChatWin : '.' + portal.chat.domNames.pcChatWin,
        pcChatWinScroller : '.Mrphs-portalChat__chat--windowscroller',
        pcChatWithPre : '#' + portal.chat.domNames.pcChatWithPre,
        pcChatWinContainer : '.Mrphs-portalChat__chat--container',
        pcChatScrollBar : '.Mrphs-portalChat__chat--scrollbar',
        pcChatVideoContentPre: '#Mrphs-portalChat__chat--videocontent-',
        pcChatVideoVideoInPre: '#Mrphs-portalChat__chat--videoin-',
        pcChatVideoVideoChatBarPre: '#Mrphs-portalChat__chat--videochatbar-',
        pcChatVideoVideoTimePre: '#Mrphs-portalChat__chat--videotime-',
        pcChatVideoTimePre: '#Mrphs-portalChat__chat--time-',
        pcChatContentPre: '#Mrphs-portalChat__chat--content-',
        pcChatMessagesPre: '#Mrphs-portalChat__chat--messages-',
        pcChatEditorForPre: '#Mrphs-portalChat__chat--editor-',
        pcChatEditor : '.Mrphs-portalChat__chat--editor',
        pcUsers: '#Mrphs-portalChat__users',
        pc: '#Mrphs-portalChat',
        pcChatConnections :'#Mrphs-portalChat__connections',
        pcChatConnectionsWrapper: '#Mrphs-portalChat__connections--wrapper',
        pcChatSiteUsers: '#Mrphs-portalChat__siteusers',
        pcChatConnection : '.Mrphs-portalChat_connection',
        pcChatSiteUser: '.Mrphs-portalChat__user',
        pcChatUsersWrapper: '.Mrphs-portalChat__user--wrapper',
        pcChatContent: '#Mrphs-portalChat__content',
        pcChatTitleClose: '#Mrphs-portalChat__close',
        pcChatChatableCount: '#Mrphs-footerApp--count',
        pcChatAvatarPerm: '#Mrphs-portalChat__avatar--permitted',
        pcChatPingedPopupPre: '#Mrphs-portalChat__connection--ping_',
        pcChatShowOfflineConsCheck: '#Mrphs-portalChat__showoffline',
        pcChatTitle: '#Mrphs-portalChat__title',
        pcVideoOffCheckOff: '#Mrphs-portalChat__videooff--check',
        pcVideoOffCtrl: '#Mrphs-portalChat__videooff--ctrl',
        pcChatOfflineCheck: '#Mrphs-portalChat__gooffline--check',
        pcChatConnectionTitle: '.Mrphs-portalChat__chat--title',
        pcChatLocalVideoContent: '#Mrphs-portalChat__video--localcontent',
        pcChatVideoBarLeft: '.Mrphs-portalChat__videochat--leftelement',
        pcChatVideoLink: '.Mrphs-portalChat__connection--videolink',
        pcChatVideoRemote: '.Mrphs-portalChat__videochat--remotevideo',
        pcChatBubbling: '.Mrphs-portalChat__videochat--bubblingG',
        pcChatVideoStatusElement: '.Mrphs-portalChat__videochat--statuselement',
        pcChatVideoStatusBar : '.Mrphs-portalChat__videochat--statusbar',
        pcChatVideoFailed: '.Mrphs-portalChat__videochat--statusfailed',
        pcChatVideoFinished: '.Mrphs-portalChat__videochat--statusfinished'
    };

    /**
     *  Utility for rendering trimpath templates. Takes the id of the template,
     *  an object with the data to be mixed in, and the id of the element to render into
     */
    portal.chat.renderTemplate = function (templateId, contextObject, outputSelector) {

        var templateNode = document.getElementById(templateId);
        var firstNode = templateNode.firstChild;

        var template = null;

        if (firstNode && firstNode.nodeType === 8) {
            template = firstNode.data.toString();
        } else {
            template = templateNode.innerHTML.toString();
        }

        var trimpathTemplate = TrimPath.parseTemplate(template, templateId);

        var render = trimpathTemplate.process(contextObject);

        if (outputSelector) {
            $PBJQ(outputSelector).html(render);
        }

        return render;
    };

    portal.chat.sendMessageToUser = function (peerUUID, siteId, isMessageToConnection, content) {

        $PBJQ.ajax({
            url : "/direct/portal-chat/new",
            dataType : "text",
            cache: false,
            type: 'POST',
            data: {
                'to': peerUUID,
                'siteId': siteId,
                'isMessageToConnection': isMessageToConnection,
                'message': content
            },
            success : function (text, status) {
                var messagePanel = $PBJQ(portal.chat.domSelectors.pcChatMessagesPre + peerUUID);

                if ('OFFLINE' === text) {
                    var toDisplayName = portal.chat.currentConnectionsMap[peerUUID].displayName;
                    messagePanel.append("

");
                    messagePanel.append("
" + toDisplayName + " is offline
");
                } else {
                    var date = new Date();
                    portal.chat.addToMessageStream(peerUUID, {'from': portal.user.id, 'content': content, 'timestamp': date.getTime()});
                    var dateString = portal.chat.formatDate(new Date());

                    portal.chat.appendMessageToChattersPanel({'content': content, 'panelUuid': peerUUID, 'from': portal.user.id, 'dateString': dateString, 'fromDisplayName': 'You'});

                    $PBJQ(portal.chat.domSelectors.pcChatEditorForPre + peerUUID).val('');
                }

                portal.chat.scrollMessageWindowToBottom(peerUUID);
            },
            error : function (xhr, textStatus, error) {

                if (403 === xhr.status) {
                    portal.chat.handleSecurityError();
                }

                alert(portal.chat.translations.server_error_send + textStatus + portal.chat.translations.server_error_send_error + error);
            }
        });
    };

    /**
     * This is a bad news failure. Clear the getLatestData interval.
     */
    portal.chat.handleSecurityError = function () {

        portal.chat.clearGetLatestDataInterval();
        return;
    };

    /**
     * If one doesn't exist already, creates a window for the chatter represented by uuid.
     */
    portal.chat.setupChatWindow  = function (peerUUID, minimised) {

        var connection = this.currentConnectionsMap[peerUUID];

        // This should never happen, but sometimes it does ...
        if (!connection) {
            return false;
        }

        // Create the div target
        var windowId = portal.chat.domSelectors.pcChatWithPre + peerUUID;

        // If we already have a chat window, return.
        if ($PBJQ(windowId).length) {
                return false;
            }

        // Append a new chat div to the container
        $PBJQ(portal.chat.domSelectors.pcChatWinScroller).prepend("

");
        this.openWindows += 1;
        var openSize = ((262 * this.openWindows) + 50);
        $PBJQ(portal.chat.domSelectors.pcChatWinScroller).css("width", openSize + "px");

        $PBJQ(portal.chat.domSelectors.pcChatWinContainer).css("right", "245px");
        if ($PBJQ(portal.chat.domSelectors.footerApp).position().left < openSize) {
            $PBJQ(portal.chat.domSelectors.pcChatScrollBar).show();
        }

        this.renderTemplate('pc_connection_chat_template', connection, windowId);

        this.currentChats.push(peerUUID);

        if (minimised) {
            $PBJQ(portal.chat.domSelectors.pcChatVideoContentPre + peerUUID).hide();
            var chatDiv = $PBJQ(windowId);
            chatDiv.css('height', 'auto');
            chatDiv.addClass(portal.chat.domNames.pcMinimised);
        } else {
            $PBJQ(windowId).addClass(portal.chat.domNames.pcMaximised);
        }

        var chatSessionString = sessionStorage['pcsession_' + peerUUID];
        var  chatSession;
        if (chatSessionString) {
            chatSession = JSON.parse(chatSessionString);
            // There is currently a message stream for this chatter
            chatSession.minimised = minimised;
        } else {
            // There is no message stream for this chatter. Set up a new one.
            chatSession = {'peerUUID': peerUUID, 'minimised': minimised, 'messages': []};
        }

        sessionStorage.setItem('pcsession_' + peerUUID, JSON.stringify(chatSession));

        $PBJQ(portal.chat.domSelectors.pcChatEditorForPre + peerUUID).focus();
        // Test if video is enabled

        if (portal.chat.video.enabled) {
            if (portal.chat.debug) console.debug('Setting up the video chat bar ...');
            this.setupVideoChatBar(peerUUID, !portal.chat.video.webrtc.isVideoEnabled() || !portal.chat.video.hasRemoteVideoAgent(peerUUID), minimised);
        } else {
            this.setupVideoChatBar(peerUUID, true, minimised);
        }

        return false;
    };

    portal.chat.setupVideoChatBar = function (peerUUID, notEnabled, minimised) {

        if (portal.chat.debug) console.debug('setupVideoChatBar');

        if (portal.chat.video.enabled && portal.chat.video.getCurrentCallStatus(peerUUID)) {
            if (portal.chat.debug) console.debug('Returning from setupVideoChatBar without doing anything ...');
            return;
        }

        $PBJQ(portal.chat.domSelectors.pcChatVideoContentPre + peerUUID).hide();
        $PBJQ(portal.chat.domSelectors.pcChatVideoVideoInPre + peerUUID ).hide();

    var videChatBar = portal.chat.domSelectors.pcChatVideoVideoChatBarPre + peerUUID;
        $PBJQ(videChatBar + ' .video_on').hide();
        var chatDiv = $PBJQ(portal.chat.domSelectors.pcChatWithPre + peerUUID);
        var isMinimised = (typeof minimised === "undefined") ? chatDiv.hasClass(portal.chat.domNames.pcMinimised) : minimised;
        if (notEnabled) {
            $PBJQ(videChatBar).hide();
            chatDiv.attr('data-height', '300');
            if (!isMinimised) {
                chatDiv.css('height', '300px');
                chatDiv.css('margin-top', '0px');
            }
        } else {
            $PBJQ(videChatBar).show();
            if (!isMinimised) {
                chatDiv.css('height', '318px');
                chatDiv.css('margin-top', '-18px');
            } else {
                if (chatDiv.hasClass('video_active')) {
                    chatDiv.css('margin-top', '49px');
                } else {
                    chatDiv.css('margin-top', '237px');
                }
            }
            chatDiv.attr('data-height', '318');
        }

        if (portal.chat.debug) console.debug('Finished setting up video chat bar.');
    };

    portal.chat.closeChatWindow = function (peerUUID) {

        var currentCallStatus = portal.chat.video.enabled ? portal.chat.video.getCurrentCallStatus(peerUUID) : null;
        if (portal.chat.video && currentCallStatus && currentCallStatus !== portal.chat.video.statuses.ESTABLISHED) {
            // Call in progress wait to close
            return;
        }
        var removed = -1;
        for (var i=0,j=this.currentChats.length;i<j;i++) {
            if (peerUUID === this.currentChats[i]) {
                removed = i;
                break;
            }
        }

        if (portal.chat.video.enabled) {
            portal.chat.video.setVideoStatus(peerUUID, portal.chat.video.messages.pc_video_status_hangup, "finished");
            portal.chat.video.closeVideoCall(peerUUID);
        }

        $PBJQ(portal.chat.domSelectors.pcChatWithPre + peerUUID).remove();
        this.openWindows -= 1;
        var openSize = ((262 * this.openWindows) + 50);
        $PBJQ(portal.chat.domSelectors.pcChatWinScroller).css("width", openSize + "px");
        var right = $PBJQ(portal.chat.domSelectors.pcChatWinContainer).css("right");
        right = right.substring(0,right.indexOf("px"))-0;
        if (right!=245) {
            $PBJQ(portal.chat.domSelectors.pcChatWinContainer).css("right", (right + 262) + "px");
        }
        if ($PBJQ(portal.chat.domSelectors.footerApp).position().left > openSize) {
            $PBJQ(portal.chat.domSelectors.pcChatScrollBar).hide();
        }

        this.currentChats.splice(removed, 1);

        sessionStorage.removeItem('pcsession_' + peerUUID);

        return false;
    };

    /**
     * Show the content, hide the expand link, show the collapse link and set the
     * expanded flag in the settings cookie.
     */
    portal.chat.toggleChat = function () {
        var pc = $PBJQ(portal.chat.domSelectors.pc);
                var pc_user = $PBJQ(portal.chat.domSelectors.pcUsers);

        if (!this.expanded) {

            pc.show();

            this.setSetting('expanded', true);
            this.expanded = true;

            if ( pc_user.height() > this.MAX_CONTENT_HEIGHT) {
                 pc_user.height(this.MAX_CONTENT_HEIGHT);
            }

            pc.css('height', 'auto');

            //Attach the escape listener
            $PBJQ(portal.chat.domSelectors.pcChatTitleClose).escape(function (e) {
                    portal.chat.toggleChat();
                });
        } else {
            //Remove the escape listener
            $PBJQ(portal.chat.domSelectors.pcChatTitleClose).removeEscape();
            pc.hide();

            pc.css('height', 'auto');

            this.setSetting('expanded', false);
            this.expanded = false;
        }

        return false;
    };

    portal.chat.toggleChatWindow = function (peerUUID) {

        var chatDiv = $PBJQ(portal.chat.domSelectors.pcChatWithPre + peerUUID);

        if (chatDiv.length < 1) return;

        var chatSessionString = sessionStorage['pcsession_' + peerUUID];
        var chatSession;

        if (chatDiv.hasClass(portal.chat.domNames.pcMaximised)) {
            $PBJQ(portal.chat.domSelectors.pcChatContentPre + peerUUID ).hide();
            chatDiv.addClass(portal.chat.domNames.pcMinimised);
            chatDiv.removeClass(portal.chat.domNames.pcMaximised);
            chatDiv.css('height','auto');
            if (chatDiv.hasClass('video_active')) {
                chatDiv.css('margin-top', '49px');
            } else {
                chatDiv.css('margin-top', ((chatDiv.attr('data-height') > 300) ? '237' : '260') + 'px');
            }
            if (chatSessionString) {
                chatSession = JSON.parse(chatSessionString);
                chatSession.minimised = true;
            } else {
                chatSession = {'peerUUID': peerUUID, 'minimised': true, 'messages': []};
            }
        } else {
            $PBJQ(portal.chat.domSelectors.pcChatContentPre + peerUUID).show();
            chatDiv.removeClass(portal.chat.domNames.pcMinimised);
            chatDiv.addClass(portal.chat.domNames.pcMaximised);
            chatDiv.css('height', chatDiv.attr('data-height') + 'px');
            if (chatDiv.hasClass('video_active')) {
                chatDiv.css('margin-top', '-212px');
            } else {
                chatDiv.css('margin-top', ((chatDiv.attr('data-height') > 300) ? '-18':'0') + 'px');
            }
            $PBJQ(portal.chat.domSelectors.pcChatWithPre + peerUUID + ' > ' + portal.chat.domSelectors.pcChatConnectionTitle).removeClass(portal.chat.domNames.pcNewMessage);
            this.scrollMessageWindowToBottom(peerUUID);
            if (chatSessionString) {
                chatSession = JSON.parse(chatSessionString);
                chatSession.minimised = false;
            } else {
                chatSession = {'peerUUID': peerUUID, 'minimised': false, 'messages': []};
            }

            $PBJQ(portal.chat.domSelectors.pcChatEditorForPre + peerUUID).focus();
        }

        sessionStorage.setItem('pcsession_' + peerUUID, JSON.stringify(chatSession));
    };

    portal.chat.scrollMessageWindowToBottom = function (uuid) {

        $PBJQ(document).ready(function () {

            var objDiv = document.getElementById(portal.chat.domSelectors.pcChatMessagesPre + uuid);

            if (objDiv != null) {
                // Arbitrary. Just nice and big.
                objDiv.scrollTop = 100000;
            }
        });
    };

    /**
     * Creates a nice, human readable date from the passed in Date object
     */
    portal.chat.formatDate = function (date) {

        var minutes = date.getMinutes();
        if (minutes < 10) {
            minutes = '0' + minutes;
        }
        var hours = date.getHours();
        if (hours < 10) {
            hours = '0' + hours;
        }
        return hours + ":" + minutes;
    };

    /**
     * Append a message to the messages area.
     */
    portal.chat.appendMessage = function (message) {

        var from = message.from;
        var content = message.content;
        var fromConnection = message.fromConnection;
        var timestamp = message.timestamp;

        // If a chat window is already open for this sender, append to it.
        var messagePanel = $PBJQ(portal.chat.domSelectors.pcChatWithPre + from);

        var flashIt = false;

        if (!messagePanel.length) {
            // No current chat window for this sender. Create one.
            this.setupChatWindow(from, true);
        } else if ($PBJQ(portal.chat.domSelectors.pcChatContentPre + from).css('display') === 'none') {
            // The sender's chat window is currently minimised so we want to flash it to
            // draw attention to it.
            flashIt = true;
        }

        if (flashIt) {
            $PBJQ(portal.chat.domSelectors.pcChatWithPre + from + + ' > ' + portal.chat.domSelectors.pcChatConnectionTitle).addClass(portal.chat.domNames.pcNewMessage);
        }

        var fromDisplayName = this.currentConnectionsMap[from].displayName;
        var userId =this.currentConnectionsMap[from].uuid;
        messagePanel = $PBJQ(portal.chat.domSelectors.pcChatMessagesPre + from);

        var dateString = this.formatDate(new Date(timestamp));
        portal.chat.appendMessageToChattersPanel({'content': content, 'panelUuid': from, 'from': from, 'dateString': dateString, 'fromDisplayName': fromDisplayName});

        this.scrollMessageWindowToBottom(from);
    };

    portal.chat.updateConnections = function (connections, online) {

        var getOnlineConnections = function (connections, online) {

            var onlineConnections = [];

            for (var i=0,j=connections.length;i<j;i++) {
                connections[i].online = false;
                connections[i].video = 'none';
                for (var k=0,m=online.length;k<m;k++) {
                    if (online[k].id === connections[i].uuid) {
                        connections[i].online = true;
                        connections[i].video = online[k].video;
                        onlineConnections.push(connections[i]);
                    }
                }
            }

            return onlineConnections;
        };

        var onlineConnections = getOnlineConnections(connections, online);

        var changed = false;

        if (portal.chat.currentConnections.length != connections.length) {
            changed = true;
        }
        else {
            for (var i = 0,j=connections.length;i<j;i++) {
                var present = false;
                var statusSame = true;
                for (var k = 0,m=portal.chat.currentConnections.length;k<m;k++) {
                    if (portal.chat.currentConnections[k].uuid === connections[i].uuid) {
                        present = true;
                        if (portal.chat.currentConnections[k].online != connections[i].online || portal.chat.currentConnections[k].video != connections[i].video) {
                            if (connections[i].video!='none') {
                                portal.chat.setupVideoChatBar(portal.chat.currentConnections[k].uuid, false,$PBJQ(portal.chat.domSelectors.pcChatWithPre+ portal.chat.currentConnections[k].uuid).css('height') == 'auto');
                            } else {
                                if (portal.chat.video.enabled && !portal.chat.video.hasVideoChatActive(portal.chat.currentConnections[k].uuid)) {
                                    portal.chat.setupVideoChatBar(portal.chat.currentConnections[k].uuid, true);
                                }
                            }
                            statusSame=false;
                        }
                        break;
                    }
                }

                if (!present || !statusSame) {
                    changed = true;
                    break;
                }
            }
        }

        if (changed) {
            sessionStorage.pcCurrentConnections = JSON.stringify(connections);
            sessionStorage.pcOnlineConnections = JSON.stringify(onlineConnections);

            portal.chat.currentConnections = connections;

            portal.chat.currentConnectionsMap = {};

            for (var i2=0,j2=connections.length;i2<j2;i2++) {
                portal.chat.currentConnectionsMap[connections[i2].uuid] = connections[i2];
            }

            // Bit of a hack really.
            portal.chat.currentConnectionsMap[portal.user.id] = {'displayName':'You'};

            sessionStorage.pcCurrentConnectionsMap = JSON.stringify(portal.chat.currentConnectionsMap);

            portal.chat.onlineConnections = onlineConnections;

            if (portal.chat.showOfflineConnections === true) {
                portal.chat.renderTemplate('pc_connections_template',{'connections':portal.chat.currentConnections},portal.chat.domSelectors.pcChatConnections);
            } else {
                portal.chat.renderTemplate('pc_connections_template',{'connections':portal.chat.onlineConnections},portal.chat.domSelectors.pcChatConnections);
            }

            portal.chat.sortConnections();
        }
    };

    /**
     * If the list supplied differs from the current one, update the site users list
     */
    portal.chat.updateSiteUsers = function (siteUsers) {

        var changed = false;

        if (portal.chat.currentSiteUsers.length != siteUsers.length) {
            changed = true;
        }
        else {
            for (var i=0,j=siteUsers.length;i<j;i++) {
                var inCurrentData = true;
                for (var k=0,m=portal.chat.currentSiteUsers.length;k<m;k++) {
                    if (portal.chat.currentSiteUsers[k].id === siteUsers[i].id) {
                        if (portal.chat.currentSiteUsers[k].video != siteUsers[i].video) {
                            inCurrentData = false;
                            if (siteUsers[i].video!='none') {
                                portal.chat.setupVideoChatBar(portal.chat.currentSiteUsers[k].uuid,
                                        false,$PBJQ(portal.chat.domSelectors.pcChatWithPre+ portal.chat.currentSiteUsers[k].uuid).css('height') == 'auto');
                            } else {
                                if (!portal.chat.video.hasVideoChatActive(portal.chat.currentSiteUsers[k].id)) {
                                    portal.chat.setupVideoChatBar(portal.chat.currentSiteUsers[k].uuid,true);
                                }
                            }
                        }
                        break;
                    }
                }

                if (!inCurrentData) {
                    changed = true;
                    break;
                }
            }
        }

        if (changed) {
            sessionStorage.pcCurrentSiteUsers = JSON.stringify(siteUsers);

            portal.chat.currentSiteUsers = siteUsers;

            if (portal.chat.currentSiteUsers.length > 0) {
                portal.chat.renderTemplate('pc_site_users_template',{'siteUsers':portal.chat.currentSiteUsers},portal.chat.domSelectors.pcChatSiteUsers);
            } else {
                $PBJQ(portal.chat.domSelectors.pcChatSiteUsers).html('');
            }

            for (var i2=0,j2=portal.chat.currentSiteUsers.length;i2<j2;i2++) {
                portal.chat.currentSiteUsers[i2].uuid = portal.chat.currentSiteUsers[i2].id;
                portal.chat.currentConnectionsMap[portal.chat.currentSiteUsers[i2].uuid] = portal.chat.currentSiteUsers[i2];
            }

            sessionStorage.pcCurrentConnectionsMap = JSON.stringify(portal.chat.currentConnectionsMap);

            portal.chat.sortSiteUsers();
        }
    };

    portal.chat.sortConnections = function () {

        $PBJQ(document).ready(function (){

            $PBJQ(portal.chat.domSelectors.pcChatConnections).html($PBJQ(portal.chat.domSelectors.pcChatConnection).sort(function (a, b) {
                var val1 = a.children[0].children[1].innerHTML;
                var val2 = b.children[0].children[1].innerHTML;
                return val1 == val2 ? 0 : val1 < val2 ? -1 : 1;
            }));
        });
    };

    portal.chat.sortSiteUsers = function () {

        $PBJQ(document).ready(function (){

            $PBJQ(portal.chat.domSelectors.pcChatSiteUsers).html($PBJQ(portal.chat.domSelectors.pcChatSiteUser).sort(function (a, b) {
                var val1 = a.children[0].children[1].innerHTML;
                var val2 = b.children[0].children[1].innerHTML;
                return val1 == val2 ? 0 : val1 < val2 ? -1 : 1;
            }));
        });
    };

    portal.chat.updateMessages = function (messages) {

        for (var i=0,j=messages.length;i<j;i++) {
            var message = messages[i];
            portal.chat.appendMessage(message);
            portal.chat.addToMessageStream(message.from,message);
        }

        if (messages.length > 0) {
            var lastMessage = messages[messages.length - 1];
            var fromDisplayName = portal.chat.currentConnectionsMap[lastMessage.from].displayName;
            if (document.hasFocus() === false) {
                document.title = 'Message from ' + fromDisplayName;
            }
        }
    };

    portal.chat.updateVideoMessages = function (messages) {

        for (var i=0,j=messages.length; i<j;i++) {
            this.video.webrtc.onReceive(messages[i]);
        }

        portal.chat.video.callProceedOnQueuedCalls();
    };

    portal.chat.getLatestData = function () {

        var onlineString = portal.chat.offline ? 'false' : 'true';
        var videoAgent = (this.video.enabled && !this.videoOff) ? this.video.getLocalVideoAgent() : 'none';

        $PBJQ.ajax({
            url : '/direct/portal-chat/' + portal.user.id + '/latestData.json?auto=true&siteId=' + portal.siteId + '&online=' + onlineString + '&videoAgent=' + videoAgent,
            dataType : "json",
            cache: false,
            success : function (data, status) {
                if (data.data.messages) {
                    portal.chat.updateMessages(data.data.messages);
                }
                if (portal.chat.video.enabled && data.data.videoMessages) {
                    portal.chat.updateVideoMessages(data.data.videoMessages);
                }

                // SAK-20565. Profile2 may not be installed, so no connections :(
                if (portal.chat.connectionsAvailable === true) {
                    if (data.data.connectionsAvailable) {
                        $PBJQ(portal.chat.domSelectors.pcChatConnectionsWrapper).show();
                        portal.chat.updateConnections(data.data.connections, data.data.online);
                    } else {
                        $PBJQ(portal.chat.domSelectors.pcChatConnectionsWrapper).hide();
                        // No point checking again as profile2 can't be installed without a full restart
                    }
                }

                if (data.data.showSiteUsers) {
                    $PBJQ(portal.chat.domSelectors.pcChatUsersWrapper).show();
                    portal.chat.updateSiteUsers(data.data.presentUsers);
                } else {
                    $PBJQ(portal.chat.domSelectors.pcChatUsersWrapper).hide();
                }

                var totalChattable = data.data.online ? data.data.online.length : 0;

                // SAK-22260. Don't count the same person twice ...
                if (data.data.showSiteUsers && data.data.presentUsers) {
                    for (var i=0,j=data.data.presentUsers.length;i<j;i++) {
                        var presentUser = data.data.presentUsers[i];
                        var alreadyIn = false;
                        for (var k=0,m=data.data.online.length;k<m;k++) {
                            if (presentUser.id === data.data.online[k].id) {
                                alreadyIn = true;
                                break;
                            }
                        }
                        if (alreadyIn === false) {
                            totalChattable += 1;
                        }
                    }
                }

                if (totalChattable > 0) {
                    $PBJQ(portal.chat.domSelectors.pcChatChatableCount).html(totalChattable + '');
                    $PBJQ(portal.chat.domSelectors.pcChatChatableCount).removeClass('empty').addClass('present');
                } else {
                    $PBJQ(portal.chat.domSelectors.pcChatChatableCount).html(' ');
                    $PBJQ(portal.chat.domSelectors.pcChatChatableCount).removeClass('present').addClass('empty');
                }

                $PBJQ(portal.chat.domSelectors.pcChatVideoLink).toggle(videoAgent !== 'none');
            },
            error : function (xhr,textStatus,error) {

                if (403 == xhr.status) {
                    portal.chat.handleSecurityError();
                    return;
                }

                if (portal.chat.connectionErrors >= 2) {
                    portal.chat.clearGetLatestDataInterval();
                    portal.chat.connectionErrors = 0;
                    alert(portal.chat.translations.server_unavailable);
                } else {
                    portal.chat.connectionErrors = portal.chat.connectionErrors + 1;
                }
            }
        });
    };

    portal.chat.addToMessageStream = function (peerUUID, message) {

        var chatSessionString = sessionStorage['pcsession_' + peerUUID];
        var chatSession;
        if (chatSessionString) {
            chatSession = JSON.parse(sessionStorage['pcsession_' + peerUUID]);
            if (chatSession.messages) {
                chatSession.messages.push(message);
            } else {
                chatSession.messages = [message];
            }
        } else {
            chatSession = {'peerUUID': peerUUID, 'minimised': false, 'messages': [message]};
        }

        sessionStorage.setItem('pcsession_' + peerUUID, JSON.stringify(chatSession));
    };

    portal.chat.pingConnection = function (connectionUserId) {

        $PBJQ.ajax({
            url : '/direct/portal-chat/' + connectionUserId + '/ping',
            dataType : "text",
            cache: false,
            success : function (text,status) {
                $PBJQ(portal.chat.domSelectors.pcChatPingedPopupPre + connectionUserId).show();
                setTimeout(function () { $PBJQ(portal.chat.domSelectors.pcChatPingedPopupPre + connectionUserId).fadeOut(800); },500);
            },
            error : function (xmlHttpRequest,textStatus,error) {

                if (403 == xhr.status) {
                    portal.chat.handleSecurityError();
                }

                if (portal.chat.connectionErrors >= 2) {
                    portal.chat.clearGetLatestDataInterval();
                    portal.chat.connectionErrors = 0;
                    alert(portal.chat.translations.server_unavailable);
                } else {
                    portal.chat.connectionErrors = portal.chat.connectionErrors + 1;
                }
            }
        });
    };

    portal.chat.setSetting = function (setting, value, persistent) {

        var storage = (persistent) ? localStorage : sessionStorage;

        var mySettings = {};
        var mySettingsString = storage.pcSettings;
        if (mySettingsString) {
            mySettings = JSON.parse(mySettingsString);
        }
        mySettings[setting] = value;
        storage.pcSettings = JSON.stringify(mySettings);
    };

    portal.chat.getSetting = function (setting, persistent) {

        var storage = (persistent) ? localStorage : sessionStorage;

        var mySettings = {};
        var mySettingsString = storage.pcSettings;
        if (mySettingsString) {
            mySettings = JSON.parse(mySettingsString);
        }

        return mySettings[setting];
    };

    portal.chat.setGetLatestDataInterval = function () {

        if (portal.chat.getLatestDataInterval === null) {
            portal.chat.getLatestDataInterval = window.setInterval(function () {portal.chat.getLatestData();}, portal.chat.pollInterval);
        }
    };

    portal.chat.clearGetLatestDataInterval = function () {

        window.clearInterval(portal.chat.getLatestDataInterval);
        portal.chat.getLatestDataInterval = null;
    };

    portal.chat.appendMessageToChattersPanel = function (params) {

        var content = params.content;
        var panelUuid = params.panelUuid;
        var from = params.from;
        var dateString = params.dateString;
        var alt = params.fromDisplayName;

        var avatarPermitted;
        if ($PBJQ(portal.chat.domSelectors.pcChatAvatarPerm).length === 1) {
            avatarPermitted =true;
        } else {
            avatarPermitted =false;
        }

    var avatarElement = {
        left: "",
        right: ""
    };

    var messageAlign = (from === panelUuid) ? 'right' : 'left'

        if (avatarPermitted) {
            avatarElement[messageAlign] = "";
        }

        // Escape markup
        content = content.replace(/&/g, '&').replace(/>/g, '>').replace(/</g, '<').replace(/"/g, '"');

        // Decode any unicode escapes
        content = JSON.parse('"' + content + '"');

    var messagePanel = $PBJQ(portal.chat.domSelectors.pcChatMessagesPre + panelUuid);

    var chatMessage =
        "
" +
            avatarElement.left +
            "
"+
                "
" + content + "
" +
                "
 " + alt + " " +  dateString + "
" +
            "
" +
            avatarElement.right +
        "
";

    messagePanel.append (chatMessage);
    };

    $PBJQ(document).ready(function () {

        if (portal.loggedIn) {
            $PBJQ(portal.chat.domSelectors.footerAppChatToggle).click(function () {
                portal.chat.toggleChat();
            });

            var myCurrentConnectionsString = sessionStorage.pcCurrentConnections;
            if (myCurrentConnectionsString) {
                portal.chat.currentConnections = JSON.parse(myCurrentConnectionsString);
                portal.chat.currentConnectionsMap = JSON.parse(sessionStorage.pcCurrentConnectionsMap);
                portal.chat.onlineConnections = JSON.parse(sessionStorage.pcOnlineConnections);
            }

            var myCurrentPresentUsersString = sessionStorage.pcCurrentSiteUsers;
            if (myCurrentPresentUsersString) {
                portal.chat.currentSiteUsers = JSON.parse(myCurrentPresentUsersString);
            }

            if (!myCurrentConnectionsString && !myCurrentPresentUsersString) {
                portal.chat.getLatestData();
            }

            if (portal.chat.getSetting('offline', true)) {
                $PBJQ(portal.chat.domSelectors.pcChatOfflineCheck).prop('checked', true);
                portal.chat.offline = true;
            } else {
                portal.chat.offline = false;
            }

            if (portal.chat.getSetting('showOfflineConnections')) {
                portal.chat.showOfflineConnections = true;
            }

            if (portal.chat.video.enabled && portal.chat.video.webrtc.isVideoEnabled()) {
                if (portal.chat.getSetting('videoOff',true)) {
                    $PBJQ(portal.chat.domSelectors.pcVideoOffCheckOff).prop('checked', true);
                    portal.chat.videoOff = true;
                } else {
                    portal.chat.videoOff = false;
                }
            } else {
                $PBJQ(portal.chat.domSelectors.pcVideoOffCtrl).hide();
            }

            portal.chat.setGetLatestDataInterval();
        } else {
            // Not a logged in user. Clear the cached data in sessionStorage.
            sessionStorage.removeItem('pcCurrentConnections');
            sessionStorage.removeItem('pcCurrentConnectionsMap');
            sessionStorage.removeItem('pcOnlineConnections');
            sessionStorage.removeItem('pcCurrentSiteUsers');
            sessionStorage.removeItem('pcCurrentSiteUsersMap');
        }

        $PBJQ(portal.chat.domSelectors.pcChatShowOfflineConsCheck).click(function () {

            if ($PBJQ(this).prop('checked')) {
                portal.chat.showOfflineConnections = true;
                portal.chat.renderTemplate('pc_connections_template',{'connections':portal.chat.currentConnections},portal.chat.domSelectors.pcChatConnections);
        var pc_users = $PBJQ(portal.chat.domSelectors.pcUsers);

                if (pc_users.height() > portal.chat.MAX_CONTENT_HEIGHT) pc_users.height(portal.chat.MAX_CONTENT_HEIGHT);
                portal.chat.setSetting('showOfflineConnections',true);
            } else {
                portal.chat.showOfflineConnections = false;
                portal.chat.renderTemplate('pc_connections_template',{'connections':portal.chat.onlineConnections},portal.chat.domSelectors.pcChatConnections);
                $PBJQ(portal.chat.domSelectors.pcChatConnections).css('height','auto');
                portal.chat.setSetting('showOfflineConnections',false);
            }

            portal.chat.sortConnections();
        });

        $PBJQ(portal.chat.domSelectors.pcChatOfflineCheck).click(function () {

            if ($PBJQ(this).prop('checked')) {
                portal.chat.setSetting('offline', true, true);
                portal.chat.offline = true;
            } else {
                portal.chat.setSetting('offline', false, true);
                portal.chat.offline = false;
                portal.chat.setGetLatestDataInterval();
            }
        });

        // Handle return press in the edit fields
        var keyPressFunction = function (e,ui) {

            if (e.keyCode == 13) {
                var editorId = e.target.id;
                //do nothing if no value
                if (e.target.value !== '') {
                    var uuid = editorId.split(portal.chat.domSelectors.pcChatEditorForPre.substr(1))[1];
                    var isMessageToConnection = false;
                    for (var i=0;i<portal.chat.currentConnections.length;i++) {
                        if (portal.chat.currentConnections[i].uuid === uuid) {
                            isMessageToConnection = true;
                            break;
                        }
                    }
                    portal.chat.sendMessageToUser(uuid, portal.siteId, isMessageToConnection, e.target.value);
                }
            }
        };

        // SAK-25505 - Switch from live() to on()
        if ($PBJQ(document).on) {
            $PBJQ(document).on('keypress', portal.chat.domSelectors.pcChatEditor, keyPressFunction);
        } else {
            $PBJQ(portal.chat.domSelectors.pcChatEditor).live('keypress', keyPressFunction);
        }

        if (portal.chat.getSetting('expanded') && portal.loggedIn) {
            portal.chat.toggleChat();
        }

        var connectionsAvailableSetting = portal.chat.getSetting('connectionsAvailable');
        if (connectionsAvailableSetting !== undefined && connectionsAvailableSetting === false) {
            // SAK-20565. Profile2 may not be installed,so no connections :(
           $PBJQ(portal.chat.domSelectors.pcChatConnectionsWrapper).hide();
        }

        // Will be set by getLatestData with the right value.
        $PBJQ(portal.chat.domSelectors.pcChatConnectionsWrapper).hide();

        // Clear all of the intervals when the window is closed
        $PBJQ(window).bind('unload', function () {
            portal.chat.clearGetLatestDataInterval();
        });

        $PBJQ(document).bind('focus', function () {
            document.title = portal.chat.originalTitle;
        });

        // Explicitly close presence panel. This also handles clicks bubbled up from the close icon.
        $PBJQ(portal.chat.domSelectors.pcChatTitle).click(function (e) {

            if ($PBJQ(e.target).is('img')) {
                return;
            }
            e.preventDefault();
            if (portal.chat.video) {

                if ($PBJQ(portal.chat.domSelectors.pcChatContent).is(':visible')) {
                    $PBJQ(portal.chat.domSelectors.pcChatContent).hide();
                } else {
                    $PBJQ(portal.chat.domSelectors.pcChatContent).show();
                }
            } else {
                portal.chat.toggleChat();
            }
        });

        $PBJQ(portal.chat.domSelectors.pcChatTitleClose).click(function (e){

            e.preventDefault();
            portal.chat.toggleChat();
        });

        if (portal.chat.currentConnections.length > 0) {
            if (portal.chat.showOfflineConnections) {
                portal.chat.renderTemplate('pc_connections_template',{'connections':portal.chat.currentConnections},portal.chat.domSelectors.pcChatConnections);
                $PBJQ(portal.chat.domSelectors.pcChatShowOfflineConsCheck).prop('checked', true);
            } else {
                portal.chat.renderTemplate('pc_connections_template',{'connections':portal.chat.onlineConnections},portal.chat.domSelectors.pcChatConnections);
                $PBJQ(portal.chat.domSelectors.pcChatShowOfflineConsCheck).prop('checked', false);
            }

            var pc_users = $PBJQ(portal.chat.domSelectors.pcUsers);

            if (pc_users.height() > portal.chat.MAX_CONTENT_HEIGHT) pc_users.height(portal.chat.MAX_CONTENT_HEIGHT);
            portal.chat.sortConnections();
        }

        if (portal.chat.currentSiteUsers.length > 0) {
            portal.chat.renderTemplate('pc_site_users_template',{'siteUsers':portal.chat.currentSiteUsers},portal.chat.domSelectors.pcChatSiteUsers);
            portal.chat.sortSiteUsers();
        }

        // Check if there are any messages streams active. If there are, setup chat windows for each
        for (var key in sessionStorage) {
            // Chat session key start with pcsession_
            if (key.indexOf('pcsession_') !== 0) {
                continue;
            }
            var storedMessageStream = sessionStorage[key];

            if (storedMessageStream) {
                var sms = JSON.parse(storedMessageStream);

                portal.chat.setupChatWindow(sms.peerUUID, sms.minimised);

                // Now we've setup the chat window we can add the messages.

                var messagePanel = $PBJQ(portal.chat.domSelectors.pcChatMessagesPre + sms.peerUUID);

                var messages = sms.messages;

                for (var k=0,m=messages.length;k<m;k++) {
                    var message = messages[k];
                    var currentConnection = portal.chat.currentConnectionsMap[message.from];
                    if (currentConnection) {
                        var userId = currentConnection.uuid;
                        if (!userId) {
                            userId=portal.user.id;
                        }
                        var dateString = portal.chat.formatDate(new Date(parseInt(message.timestamp, 10)));
                        var fromDisplayName = currentConnection.displayName;

                        portal.chat.appendMessageToChattersPanel({'content': message.content, 'panelUuid': sms.peerUUID, 'from': userId, 'dateString': dateString, 'fromDisplayName': fromDisplayName});
                    }
                }

                portal.chat.scrollMessageWindowToBottom(sms.peerUUID);
            }
        }

        $PBJQ("#goright").click(function () {

            var freeSpace = $PBJQ(portal.chat.domSelectors.footerApp).position().left;
            var openSize = $PBJQ(portal.chat.domSelectors.pcChatWinScroller).css("width");
            openSize = openSize.substring(0,openSize.indexOf("px")) - 0;
            var right = $PBJQ(portal.chat.domSelectors.pcChatWinContainer).css("right");
            right = right.substring(0, right.indexOf("px")) - 0;
            if (openSize > freeSpace) {
                if (right == 245) {
                    return;
                }
                $PBJQ(portal.chat.domSelectors.pcChatWinContainer).css("right",(right + 262) + "px");
            }
        });

        $PBJQ("#goleft").click(function () {

            var freeSpace = $PBJQ(portal.chat.domSelectors.footerApp).position().left;
            var openSize = $PBJQ(portal.chat.domSelectors.pcChatWinScroller).css("width");
            openSize = openSize.substring(0, openSize.indexOf("px")) - 0;
            var right = $PBJQ(portal.chat.domSelectors.pcChatWinContainer).css("right");
            right = right.substring(0, right.indexOf("px")) - 0;
            if (openSize > freeSpace) {
                if (openSize + right - 245 < freeSpace) return;
                $PBJQ(portal.chat.domSelectors.pcChatWinContainer).css("right",(right - 262) + "px");
            }
        });
    }); // document.ready

    // 15 minutes
    $PBJQ.idleTimer(900000);

    $PBJQ(document).bind("idle.idleTimer", function () {
        portal.chat.clearGetLatestDataInterval();
    }).bind("active.idleTimer", function () {
        portal.chat.setGetLatestDataInterval();
    });

}) ($PBJQ);

$PBJQ(document).ready(function () {
    $PBJQ(portal.chat.domSelectors.footerAppChat).removeClass('is-hidden');
});


text:
2015-12-18, Version 2.0.1
=========================

 * remove ref to removed lb-ng-doc bin (Ryan Graham)

2015-12-17, Version 2.0.0
=========================

 * Remove lb-ng-doc and docular dependency (Miroslav Bajtoš)

2015-11-30, Version 1.2.0
=========================

 * Support async booting apps (Heath Morrison)

 * Refer to licenses with a link (Sam Roberts)

 * Use strongloop conventions for licensing (Sam Roberts)

 * Fix bad CLA URL in CONTRIBUTING.md (Ryan Graham)

 * Update contribution guidelines (Ryan Graham)

 * Update README.md (Rand McKinney)

 * Remove unused dependency to express and bump version (Raymond Feng)

2014-07-02, Version 1.1.4
=========================

 * Bump version (Raymond Feng)

 * Update name refs (Raymond Feng)

2014-07-02, Version 1.1.3
=========================

 * Fix usages of loopback-sdk-angular (Miroslav Bajtoš)

2014-07-01, Version 1.1.2
=========================

 * Bump version (Raymond Feng)

 * Rename repo and update deps (Raymond Feng)

2014-05-26, Version 1.1.1
=========================

 * package.json: add express 3.x to fix docular deps (Miroslav Bajtoš)

 * Fix unit-tests failing on windows (Miroslav Bajtos)

2014-04-09, Version 1.1.0
=========================

 * Update dependencies (Miroslav Bajtoš)

 * test: use exec instead of execFile (Ryan Graham)

 * test: make sure ephemeral ports are used (Ryan Graham)

 * Add missing devDependency: jshint (Ryan Graham)

2014-02-19, Version 1.0.0
=========================

 * Update to MIT/StrongLoop dual license (Raymond Feng)

 * Update README, link to doc.strongloop.com (Miroslav Bajtoš)

2014-02-06, Version 0.1.0
=========================

 * First release!


text:
//-----------------------------------------------
//
//	This file is part of the Siv3D Engine.
//
//	Copyright (c) 2008-2019 Ryo Suzuki
//	Copyright (c) 2016-2019 OpenSiv3D Project
//
//	Licensed under the MIT License.
//
//-----------------------------------------------

# include <Siv3D/Script.hpp>
# include <Siv3D/Circle.hpp>
# include "ScriptBind.hpp"

namespace s3d
{
	using namespace AngelScript;

	using ShapeType = Circle;

	static void Construct(const Circle& circle, ShapeType* self)
	{
		new(self) ShapeType(circle);
	}

	static void ConstructD(double r, ShapeType* self)
	{
		new(self) ShapeType(r);
	}

	static void ConstructDDD(double x, double y, double r, ShapeType* self)
	{
		new(self) ShapeType(x, y, r);
	}

	static void ConstructVD(const Vec2& center, double r, ShapeType* self)
	{
		new(self) ShapeType(center, r);
	}

	void RegisterCircle(asIScriptEngine* engine)
	{
		constexpr char TypeName[] = "Circle";

		int32 r = 0;
		r = engine->RegisterObjectProperty(TypeName, "double x", asOFFSET(ShapeType, x)); assert(r >= 0);
		r = engine->RegisterObjectProperty(TypeName, "double y", asOFFSET(ShapeType, y)); assert(r >= 0);
		r = engine->RegisterObjectProperty(TypeName, "double r", asOFFSET(ShapeType, r)); assert(r >= 0);
		r = engine->RegisterObjectProperty(TypeName, "Vec2 center", asOFFSET(ShapeType, center)); assert(r >= 0);

		r = engine->RegisterObjectBehaviour(TypeName, asBEHAVE_CONSTRUCT, "void f(const Circle& in)", asFUNCTION(Construct), asCALL_CDECL_OBJLAST); assert(r >= 0);
		r = engine->RegisterObjectBehaviour(TypeName, asBEHAVE_CONSTRUCT, "void f(double)", asFUNCTION(ConstructD), asCALL_CDECL_OBJLAST); assert(r >= 0);
		r = engine->RegisterObjectBehaviour(TypeName, asBEHAVE_CONSTRUCT, "void f(double, double, double)", asFUNCTION(ConstructDDD), asCALL_CDECL_OBJLAST); assert(r >= 0);
		r = engine->RegisterObjectBehaviour(TypeName, asBEHAVE_CONSTRUCT, "void f(const Vec2& in, double)", asFUNCTION(ConstructVD), asCALL_CDECL_OBJLAST); assert(r >= 0);

		//Arg::

		r = engine->RegisterObjectMethod(TypeName, "bool opEquals(const Circle& in) const", asMETHOD(ShapeType, operator==), asCALL_THISCALL); assert(r >= 0);

		r = engine->RegisterObjectMethod(TypeName, "Circle& set(double, double, double)", asMETHODPR(ShapeType, set, (double, double, double), ShapeType&), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "Circle& set(const Vec2& in)", asMETHODPR(ShapeType, set, (const Vec2&, double), ShapeType&), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "Circle& set(const Circle& in)", asMETHODPR(ShapeType, set, (const Circle&), ShapeType&), asCALL_THISCALL); assert(r >= 0);

		r = engine->RegisterObjectMethod(TypeName, "Circle& setCenter(double, double)", asMETHODPR(ShapeType, setCenter, (double, double), ShapeType&), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "Circle& setCenter(const Vec2& in)", asMETHODPR(ShapeType, setCenter, (const Vec2&), ShapeType&), asCALL_THISCALL); assert(r >= 0);

		r = engine->RegisterObjectMethod(TypeName, "Circle& setPos(double, double)", asMETHODPR(ShapeType, setPos, (double, double), ShapeType&), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "Circle& setPos(const Vec2& in)", asMETHODPR(ShapeType, setPos, (const Vec2&), ShapeType&), asCALL_THISCALL); assert(r >= 0);

		r = engine->RegisterObjectMethod(TypeName, "Circle& setR(double r)", asMETHOD(ShapeType, setR), asCALL_THISCALL); assert(r >= 0);

		r = engine->RegisterObjectMethod(TypeName, "Circle movedBy(double, double) const", asMETHODPR(ShapeType, movedBy, (double, double) const, ShapeType), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "Circle movedBy(const Vec2& in) const", asMETHODPR(ShapeType, movedBy, (const Vec2&) const, ShapeType), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "Circle& moveBy(double, double)", asMETHODPR(ShapeType, moveBy, (double, double), ShapeType&), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "Circle& moveBy(const Vec2 &in)", asMETHODPR(ShapeType, moveBy, (const Vec2&), ShapeType&), asCALL_THISCALL); assert(r >= 0);

		r = engine->RegisterObjectMethod(TypeName, "Circle stretched(double) const", asMETHODPR(ShapeType, stretched, (double) const, ShapeType), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "Ellipse stretched(double, double) const", asMETHODPR(ShapeType, stretched, (double, double) const, Ellipse), asCALL_THISCALL); assert(r >= 0);

		r = engine->RegisterObjectMethod(TypeName, "Circle scaled(double) const", asMETHODPR(ShapeType, scaled, (double) const, ShapeType), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "Ellipse scaled(double, double) const", asMETHODPR(ShapeType, scaled, (double, double) const, Ellipse), asCALL_THISCALL); assert(r >= 0);

		r = engine->RegisterObjectMethod(TypeName, "Vec2 top() const", asMETHOD(ShapeType, top), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "Vec2 right() const", asMETHOD(ShapeType, right), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "Vec2 bbottoml() const", asMETHOD(ShapeType, bottom), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "Vec2 left() const", asMETHOD(ShapeType, left), asCALL_THISCALL); assert(r >= 0);

		r = engine->RegisterObjectMethod(TypeName, "Line lineDiameter() const", asMETHOD(ShapeType, lineDiameter), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "double area() const", asMETHOD(ShapeType, area), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "double perimeter() const", asMETHOD(ShapeType, perimeter), asCALL_THISCALL); assert(r >= 0);

		r = engine->RegisterObjectMethod(TypeName, "bool intersects(const Point& in) const", asMETHODPR(ShapeType, intersects, (const Point&) const, bool), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "bool intersects(const Vec2& in) const", asMETHODPR(ShapeType, intersects, (const Vec2&) const, bool), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "bool intersects(const Line& in) const", asMETHODPR(ShapeType, intersects, (const Line&) const, bool), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "bool intersects(const Bezier2& in) const", asMETHODPR(ShapeType, intersects, (const Bezier2&) const, bool), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "bool intersects(const Bezier3& in) const", asMETHODPR(ShapeType, intersects, (const Bezier3&) const, bool), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "bool intersects(const Rect& in) const", asMETHODPR(ShapeType, intersects, (const Rect&) const, bool), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "bool intersects(const RectF& in) const", asMETHODPR(ShapeType, intersects, (const RectF&) const, bool), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "bool intersects(const Circle& in) const", asMETHODPR(ShapeType, intersects, (const Circle&) const, bool), asCALL_THISCALL); assert(r >= 0);
		//r = engine->RegisterObjectMethod(TypeName, "bool intersects(const Ellipse& in) const", asMETHODPR(ShapeType, intersects, (const Ellipse&) const, bool), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "bool intersects(const Triangle& in) const", asMETHODPR(ShapeType, intersects, (const Triangle&) const, bool), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "bool intersects(const Quad& in) const", asMETHODPR(ShapeType, intersects, (const Quad&) const, bool), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "bool intersects(const RoundRect& in) const", asMETHODPR(ShapeType, intersects, (const RoundRect&) const, bool), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "bool intersects(const Polygon& in) const", asMETHODPR(ShapeType, intersects, (const Polygon&) const, bool), asCALL_THISCALL); assert(r >= 0);
		//r = engine->RegisterObjectMethod(TypeName, "bool intersects(const MultiPolygon& in) const", asMETHODPR(ShapeType, intersects, (const MultiPolygon&) const, bool), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "bool intersects(const LineString& in) const", asMETHODPR(ShapeType, intersects, (const LineString&) const, bool), asCALL_THISCALL); assert(r >= 0);

		r = engine->RegisterObjectMethod(TypeName, "bool leftClicked() const", asMETHOD(ShapeType, leftClicked), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "bool leftPressed() const", asMETHOD(ShapeType, leftPressed), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "bool leftReleased() const", asMETHOD(ShapeType, leftReleased), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "bool rightClicked() const", asMETHOD(ShapeType, rightClicked), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "bool rightPressed() const", asMETHOD(ShapeType, rightPressed), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "bool rightReleased() const", asMETHOD(ShapeType, rightReleased), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "bool mouseOver() const", asMETHOD(ShapeType, mouseOver), asCALL_THISCALL); assert(r >= 0);

		r = engine->RegisterObjectMethod(TypeName, "const Circle& draw(const ColorF&in color = Palette::White) const", asMETHOD(ShapeType, draw), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "const Circle& drawFrame(double thickness = 1.0, const ColorF& in color = Palette::White) const", asMETHODPR(ShapeType, drawFrame, (double, const ColorF&) const, const Circle&), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "const Circle& drawFrame(double inner, double outer, const ColorF& in color = Palette::White) const", asMETHODPR(ShapeType, drawFrame, (double, double, const ColorF&) const, const Circle&), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "const Circle& drawFrame(double inner, double outer, const ColorF& in innerColor, const ColorF& in outerColor) const", asMETHODPR(ShapeType, drawFrame, (double, double, const ColorF&, const ColorF&) const, const Circle&), asCALL_THISCALL); assert(r >= 0);

		r = engine->RegisterObjectMethod(TypeName, "const Circle& drawPie(double startAngle, double angle, const ColorF& in color = Palette::White) const", asMETHOD(ShapeType, drawPie), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "const Circle& drawArc(double startAngle, double angle, double innerThickness = 1.0, double outerThickness = 0.0, const ColorF& in color = Palette::White) const", asMETHOD(ShapeType, drawArc), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "const Circle& drawShadow(const Vec2& in offset, double blurRadius, double spread = 0.0, const ColorF& in color = ColorF(0.0, 0.5)) const", asMETHOD(ShapeType, drawShadow), asCALL_THISCALL); assert(r >= 0);

		r = engine->RegisterObjectMethod(TypeName, "TexturedCircle opCall(const Texture& in) const", asMETHODPR(ShapeType, operator(), (const Texture&) const, TexturedCircle), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "TexturedCircle opCall(const TextureRegion& in) const", asMETHODPR(ShapeType, operator(), (const TextureRegion&) const, TexturedCircle), asCALL_THISCALL); assert(r >= 0);

		r = engine->RegisterObjectMethod(TypeName, "Polygon asPolygon(uint32 quality = 24) const", asMETHOD(ShapeType, asPolygon), asCALL_THISCALL); assert(r >= 0);
	}
}


text:
package io.proleap.vb6.asg.metamodel;

import java.util.List;

import org.antlr.v4.runtime.ParserRuleContext;

/**
 * an element of the ASG that corresponds to an element in the AST.
 */
public interface ASGElement extends ModelElement {

	List<ASGElement> getChildren();

	ParserRuleContext getCtx();

	ASGElement getParent();

	Program getProgram();

}


text:
package com.metaui.fxbase.ui.component.table.cell;

import com.metaui.core.datasource.DataMap;
import com.metaui.core.dict.DictCategory;
import com.metaui.core.dict.DictCode;
import com.metaui.core.dict.DictManager;
import com.metaui.core.dict.EnumBoolean;
import com.metaui.core.ui.layout.property.TableFieldProperty;
import com.metaui.core.util.UString;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.geometry.Pos;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.TableColumn;
import javafx.scene.layout.StackPane;

/**
 * Boolean Table Cell
 *
 * @author wei_jc
 * @since 1.0.0
 */
public class BoolTableCell extends BaseTableCell {
    private StackPane box;
    private Label label;
    private ComboBox<DictCode> comboBox;

    private DictCategory dictCategory = DictManager.getDict(EnumBoolean.class);

    public BoolTableCell(TableColumn<DataMap, String> column, TableFieldProperty prop) {
        super(column, prop);

        box = new StackPane();
        label = new Label();
        label.setStyle("-fx-text-fill: #222222");

        box.setAlignment(Pos.CENTER);
        box.getChildren().add(label);
    }

    @Override
    protected void updateItem(String s, boolean b) {
        super.updateItem(s, b);
        if (UString.isNotEmpty(s)) {
            boolean isTrue = UString.toBoolean(s);
            if(isTrue) {
                label.setText("是");
                box.setStyle("-fx-padding: 3;-fx-background-color:#2BA812;");
            } else {
                label.setText("否");
                box.setStyle("-fx-padding: 3;-fx-background-color:#ffffff;");
            }

            this.setGraphic(box);
        } else {
            this.setGraphic(null);
        }
    }

    @Override
    public void startEdit() {
        if (comboBox == null) {
            comboBox = new ComboBox<DictCode>();
            comboBox.setItems(FXCollections.observableArrayList(dictCategory.getCodeList()));
            comboBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<DictCode>() {
                @Override
                public void changed(ObservableValue<? extends DictCode> observable, DictCode oldValue, DictCode newValue) {
                    isModified.set(true);
                    if (newValue != null) {
                        commitEdit(newValue.getName());
                        valueProperty.set(newValue.getName());
                    }
                }
            });
            comboBox.minWidthProperty().bind(this.widthProperty());
        }

        String codeId = EnumBoolean.F.name();
        if (UString.toBoolean(getItem())) {
            codeId = EnumBoolean.T.name();
        }
        DictCode code = dictCategory.getDictCode(codeId);
        comboBox.getSelectionModel().select(code);

        super.startEdit();
        setText(null);
        setGraphic(comboBox);
    }

    @Override public void cancelEdit() {
        super.cancelEdit();

        /*DictCode code = comboBox.getSelectionModel().getSelectedItem();
        if (code != null) {
            setItem(code.getName());
        }*/
        setGraphic(box);
    }
}