Package org.crsh.text

Examples of org.crsh.text.Color


          termIO.setUnderlined(composite.getUnderline());
        }
        if (composite.getBlink() != null) {
          termIO.setBlink(composite.getBlink());
        }
        Color fg = composite.getForeground();
        if (fg != null) {
          termIO.setForegroundColor(30 + fg.code);
        }
        Color bg = composite.getBackground();
        if (bg != null) {
          termIO.setBackgroundColor(30 + bg.code);
        }
      } else {
        termIO.resetAttributes();
View Full Code Here


      )
    );

    //
    for (Thread thread : threads) {
      Color c = colorMapping.get(thread.getState());
      long seconds = times2.get(thread.getId()) / 1000000000;
      long min = seconds / 60;
      String time = min + ":" + (seconds % 60);
      long cpu = cpus.get(thread);
      ThreadGroup group = thread.getThreadGroup();
      table.row(
          new LabelElement(thread.getId()),
          new LabelElement(thread.getName()),
          new LabelElement(group == null ? "" : group.getName()),
          new LabelElement(thread.getPriority()),
          new LabelElement(thread.getState()).style(c.fg()),
          new LabelElement(cpu),
          new LabelElement(time),
          new LabelElement(thread.isInterrupted()),
          new LabelElement(thread.isDaemon())
      );
View Full Code Here

      public void renderLine(RenderAppendable to) throws IllegalStateException {
        if (!hasLine()) {
          throw new IllegalStateException();
        }
        long range = usage.getMax() - usage.getInit();
        Color previous = null;

        if (usage.getMax() > 0) {
          long a = (width * usage.getUsed()) / (usage.getMax());
          long b = (width * usage.getCommitted()) / (usage.getMax());
          for (int i = 0;i < width;i++) {
            Color current;
            if (i >= b) {
              // MAX
              current = Color.green;
            } else if (i >= a) {
              // COMMITED
              current = Color.blue;
            } else {
              // USED
              current = Color.cyan;
            }
            if (previous != current) {
              if (previous != null) {
                to.leaveStyle();
              }
              to.enterStyle(current.bg());
              previous = current;
            }
            to.append(' ');
          }
          if (previous != null) {
View Full Code Here

          }
          @Override
          public LineRenderer next() {
            LogRecord record = stream.next();
            String line = formatter.format(record);
            Color color;
            if (record.getLevel() == Level.SEVERE) {
              color = Color.red;
            } else if (record.getLevel() == Level.WARNING) {
              color = Color.yellow;
            } else if (record.getLevel() == Level.INFO) {
              color = Color.green;
            } else {
              color = Color.blue;
            }
            return new LabelElement(line).style(color.fg()).renderer();
          }
        };
      }
    });
  }
View Full Code Here

TOP

Related Classes of org.crsh.text.Color

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.