@Override
 public View getGroupView(
     final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
   if (convertView == null) {
     LayoutInflater inflater =
         (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
     convertView = inflater.inflate(R.layout.group, null);
   }
   ImageButton btn = (ImageButton) convertView.findViewById(R.id.discardBtn);
   btn.setFocusable(false);
   btn.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           Log.d(TAG, "group with time " + titles.get(groupPosition) + " clicked!");
         }
       });
   CheckedTextView tw = (CheckedTextView) convertView.findViewById(R.id.checkedTW);
   Title title = titles.get(groupPosition);
   tw.setText(title.getDate());
   tw.setChecked(isExpanded);
   TextView coordsView = (TextView) convertView.findViewById(R.id.coordsView);
   coordsView.setText(
       "Floor: " + title.getZ() + ". Position [" + title.getX() + ", " + title.getY() + "]");
   return convertView;
 }
  /**
   * Converts the first character of each word of the given string to a upper case (and all others
   * to lower case), but does not change words starting with "{"
   */
  @Override
  public String format(String input) {
    Title title = new Title(input);

    title.getWords().stream().forEach(Word::toUpperFirst);

    return title.toString();
  }
  public String getAnnotatedTitle() {

    Method testMethod = getTestMethod();
    Title title = testMethod.getAnnotation(Title.class);
    if (title != null) {
      return title.value();
    }
    return null;
  }
 public String getLawbreaker_full_name() {
   Title t = new Title(db);
   String title = "";
   try {
     List<Title> tlist = t.findByWhere(TITLE_CODECol + "=?", getTitle_code());
     if (tlist.size() > 0) {
       title = tlist.get(0).getTitle_name();
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
   return title + getFirst_name() + " " + getLast_name();
 }
  protected void addSubComponents() {
    title = new Title(frame.getTitle());
    title.setFont(getFont());

    add(systemButton);
    add(title);
    add(minimizeButton);
    add(maximizeButton);
  }
  public void layoutContainer(Container c) {
    int w = getWidth();
    systemButton.setBounds(0, 0, BUTTON_SIZE, BUTTON_SIZE);
    int x = w - BUTTON_SIZE;

    if (frame.isMaximizable()) {
      maximizeButton.setBounds(x, 0, BUTTON_SIZE, BUTTON_SIZE);
      x -= BUTTON_SIZE;
    } else if (maximizeButton.getParent() != null) {
      maximizeButton.getParent().remove(maximizeButton);
    }

    if (frame.isIconifiable()) {
      minimizeButton.setBounds(x, 0, BUTTON_SIZE, BUTTON_SIZE);
      x -= BUTTON_SIZE;
    } else if (minimizeButton.getParent() != null) {
      minimizeButton.getParent().remove(minimizeButton);
    }

    title.setBounds(BUTTON_SIZE, 0, x, BUTTON_SIZE);
  }
 @Override
 public void titleSetRightTitle(String rightTitle) {
   if (mTitleClass != null) {
     mTitleClass.titleSetRightTitle(rightTitle);
   }
 }
Exemple #8
0
 public static Title getType(int id) {
   for (Title t : Title.values()) {
     if (t.id() == id) return t;
   }
   return null;
 }
Exemple #9
0
  private static <T extends AbstractJaxb> void execute(T target, Pattern pattern) {

    TagEnum tagEnum = TagEnum.valueOf(target.getClass().getSimpleName().toUpperCase());

    switch (tagEnum) {
      case A:
        A a = (A) target;
        if (idMatch(a.getId(), pattern)) {
          a.setId(null);
        }
        unsetAllIdWithinObjectList(a.getContent(), pattern);
        break;
      case ABBR:
        Abbr abbr = (Abbr) target;
        if (idMatch(abbr.getId(), pattern)) {
          abbr.setId(null);
        }
        unsetAllIdWithinObjectList(abbr.getContent(), pattern);
        break;
      case ACRONYM:
        Acronym acronym = (Acronym) target;
        if (idMatch(acronym.getId(), pattern)) {
          acronym.setId(null);
        }
        unsetAllIdWithinObjectList(acronym.getContent(), pattern);
        break;
      case ADDRESS:
        Address address = (Address) target;
        if (idMatch(address.getId(), pattern)) {
          address.setId(null);
        }
        unsetAllIdWithinObjectList(address.getContent(), pattern);
        break;
      case APPLET:
        Applet applet = (Applet) target;
        if (idMatch(applet.getId(), pattern)) {
          applet.setId(null);
        }
        unsetAllIdWithinObjectList(applet.getContent(), pattern);
        break;
      case AREA:
        Area area = (Area) target;
        if (idMatch(area.getId(), pattern)) {
          area.setId(null);
        }
        // area is empty element.
        break;
      case B:
        B b = (B) target;
        if (idMatch(b.getId(), pattern)) {
          b.setId(null);
        }
        unsetAllIdWithinObjectList(b.getContent(), pattern);
        break;
      case BASE:
        Base base = (Base) target;
        if (idMatch(base.getId(), pattern)) {
          base.setId(null);
        }
        // empty element.
        break;
      case BASEFONT:
        Basefont basefont = (Basefont) target;
        if (idMatch(basefont.getId(), pattern)) {
          basefont.setId(null);
        }
        // empty element.
        break;
      case BDO:
        Bdo bdo = (Bdo) target;
        if (idMatch(bdo.getId(), pattern)) {
          bdo.setId(null);
        }
        unsetAllIdWithinObjectList(bdo.getContent(), pattern);
        break;
      case BIG:
        Big big = (Big) target;
        if (idMatch(big.getId(), pattern)) {
          big.setId(null);
        }
        unsetAllIdWithinObjectList(big.getContent(), pattern);
        break;
      case BLOCKQUOTE:
        Blockquote blockquote = (Blockquote) target;
        if (idMatch(blockquote.getId(), pattern)) {
          blockquote.setId(null);
        }
        unsetAllIdWithinObjectList(blockquote.getContent(), pattern);
        break;
      case BODY:
        Body body = (Body) target;
        if (idMatch(body.getId(), pattern)) {
          body.setId(null);
        }
        unsetAllIdWithinObjectList(body.getContent(), pattern);
        break;
      case BR:
        Br br = (Br) target;
        if (idMatch(br.getId(), pattern)) {
          br.setId(null);
        }
        // empty element.
        break;
      case BUTTON:
        Button button = (Button) target;
        if (idMatch(button.getId(), pattern)) {
          button.setId(null);
        }
        unsetAllIdWithinObjectList(button.getContent(), pattern);
        break;
      case CAPTION:
        Caption caption = (Caption) target;
        if (idMatch(caption.getId(), pattern)) {
          caption.setId(null);
        }
        unsetAllIdWithinObjectList(caption.getContent(), pattern);
        break;
      case CENTER:
        Center center = (Center) target;
        if (idMatch(center.getId(), pattern)) {
          center.setId(null);
        }
        unsetAllIdWithinObjectList(center.getContent(), pattern);
        break;
      case CITE:
        Cite cite = (Cite) target;
        if (idMatch(cite.getId(), pattern)) {
          cite.setId(null);
        }
        unsetAllIdWithinObjectList(cite.getContent(), pattern);
        break;
      case CODE:
        Code code = (Code) target;
        if (idMatch(code.getId(), pattern)) {
          code.setId(null);
        }
        unsetAllIdWithinObjectList(code.getContent(), pattern);
        break;
      case COL:
        Col col = (Col) target;
        if (idMatch(col.getId(), pattern)) {
          col.setId(null);
        }
        // empty element.
        break;
      case COLGROUP:
        Colgroup colgroup = (Colgroup) target;
        if (idMatch(colgroup.getId(), pattern)) {
          colgroup.setId(null);
        }
        for (Col tmpcol : colgroup.getCol()) {
          execute(tmpcol, pattern);
        }
        break;
      case DD:
        Dd dd = (Dd) target;
        if (idMatch(dd.getId(), pattern)) {
          dd.setId(null);
        }
        unsetAllIdWithinObjectList(dd.getContent(), pattern);
        break;
      case DEL:
        Del del = (Del) target;
        if (idMatch(del.getId(), pattern)) {
          del.setId(null);
        }
        unsetAllIdWithinObjectList(del.getContent(), pattern);
        break;
      case DFN:
        Dfn dfn = (Dfn) target;
        if (idMatch(dfn.getId(), pattern)) {
          dfn.setId(null);
        }
        unsetAllIdWithinObjectList(dfn.getContent(), pattern);
        break;
      case DIR:
        Dir dir = (Dir) target;
        if (idMatch(dir.getId(), pattern)) {
          dir.setId(null);
        }
        for (Li tmpli : dir.getLi()) {
          execute(tmpli, pattern);
        }
        break;
      case DIV:
        Div div = (Div) target;
        if (idMatch(div.getId(), pattern)) {
          div.setId(null);
        }
        unsetAllIdWithinObjectList(div.getContent(), pattern);
        break;
      case DL:
        Dl dl = (Dl) target;
        if (idMatch(dl.getId(), pattern)) {
          dl.setId(null);
        }
        for (AbstractJaxb aj : dl.getDtOrDd()) {
          execute(aj, pattern);
        }
        break;
      case DT:
        Dt dt = (Dt) target;
        if (idMatch(dt.getId(), pattern)) {
          dt.setId(null);
        }
        unsetAllIdWithinObjectList(dt.getContent(), pattern);
        break;
      case EM:
        Em em = (Em) target;
        if (idMatch(em.getId(), pattern)) {
          em.setId(null);
        }
        unsetAllIdWithinObjectList(em.getContent(), pattern);
        break;
      case FIELDSET:
        Fieldset fieldset = (Fieldset) target;
        if (idMatch(fieldset.getId(), pattern)) {
          fieldset.setId(null);
        }
        unsetAllIdWithinObjectList(fieldset.getContent(), pattern);
        break;
      case FONT:
        Font font = (Font) target;
        if (idMatch(font.getId(), pattern)) {
          font.setId(null);
        }
        unsetAllIdWithinObjectList(font.getContent(), pattern);
        break;
      case FORM:
        Form form = (Form) target;
        if (idMatch(form.getId(), pattern)) {
          form.setId(null);
        }
        unsetAllIdWithinObjectList(form.getContent(), pattern);
        break;
      case H1:
        H1 h1 = (H1) target;
        if (idMatch(h1.getId(), pattern)) {
          h1.setId(null);
        }
        unsetAllIdWithinObjectList(h1.getContent(), pattern);
        break;
      case H2:
        H2 h2 = (H2) target;
        if (idMatch(h2.getId(), pattern)) {
          h2.setId(null);
        }
        unsetAllIdWithinObjectList(h2.getContent(), pattern);
        break;
      case H3:
        H3 h3 = (H3) target;
        if (idMatch(h3.getId(), pattern)) {
          h3.setId(null);
        }
        unsetAllIdWithinObjectList(h3.getContent(), pattern);
        break;
      case H4:
        H4 h4 = (H4) target;
        if (idMatch(h4.getId(), pattern)) {
          h4.setId(null);
        }
        unsetAllIdWithinObjectList(h4.getContent(), pattern);
        break;
      case H5:
        H5 h5 = (H5) target;
        if (idMatch(h5.getId(), pattern)) {
          h5.setId(null);
        }
        unsetAllIdWithinObjectList(h5.getContent(), pattern);
        break;
      case H6:
        H6 h6 = (H6) target;
        if (idMatch(h6.getId(), pattern)) {
          h6.setId(null);
        }
        unsetAllIdWithinObjectList(h6.getContent(), pattern);
        break;
      case HGROUP:
        Hgroup hgroup = (Hgroup) target;
        if (idMatch(hgroup.getId(), pattern)) {
          hgroup.setId(null);
        }
        for (AbstractJaxb aj : hgroup.getH1OrH2OrH3()) {
          execute(aj, pattern);
        }
        break;
      case HEAD:
        Head head = (Head) target;
        if (idMatch(head.getId(), pattern)) {
          head.setId(null);
        }
        for (AbstractJaxb aj : head.getContent()) {
          execute(aj, pattern);
        }
        break;
      case HR:
        Hr hr = (Hr) target;
        if (idMatch(hr.getId(), pattern)) {
          hr.setId(null);
        }
        // hr is empty element.
        break;
      case HTML:
        Html html = (Html) target;
        if (idMatch(html.getId(), pattern)) {
          html.setId(null);
        }
        execute(html.getHead(), pattern);
        execute(html.getBody(), pattern);
        break;
      case I:
        I i = (I) target;
        if (idMatch(i.getId(), pattern)) {
          i.setId(null);
        }
        unsetAllIdWithinObjectList(i.getContent(), pattern);
        break;
      case IFRAME:
        Iframe iframe = (Iframe) target;
        if (idMatch(iframe.getId(), pattern)) {
          iframe.setId(null);
        }
        unsetAllIdWithinObjectList(iframe.getContent(), pattern);
        break;
      case IMG:
        Img img = (Img) target;
        if (idMatch(img.getId(), pattern)) {
          img.setId(null);
        }
        // img is empty element.
        break;
      case INPUT:
        Input input = (Input) target;
        if (idMatch(input.getId(), pattern)) {
          input.setId(null);
        }
        // input is empty element.
        break;
      case INS:
        Ins ins = (Ins) target;
        if (idMatch(ins.getId(), pattern)) {
          ins.setId(null);
        }
        unsetAllIdWithinObjectList(ins.getContent(), pattern);
        break;
      case ISINDEX:
        Isindex isindex = (Isindex) target;
        if (idMatch(isindex.getId(), pattern)) {
          isindex.setId(null);
        }
        // empty element.
        break;
      case KBD:
        Kbd kbd = (Kbd) target;
        if (idMatch(kbd.getId(), pattern)) {
          kbd.setId(null);
        }
        unsetAllIdWithinObjectList(kbd.getContent(), pattern);
        break;
      case LABEL:
        Label label = (Label) target;
        if (idMatch(label.getId(), pattern)) {
          label.setId(null);
        }
        unsetAllIdWithinObjectList(label.getContent(), pattern);
        break;
      case LEGEND:
        Legend legend = (Legend) target;
        if (idMatch(legend.getId(), pattern)) {
          legend.setId(null);
        }
        unsetAllIdWithinObjectList(legend.getContent(), pattern);
        break;
      case LI:
        Li li = (Li) target;
        if (idMatch(li.getId(), pattern)) {
          li.setId(null);
        }
        unsetAllIdWithinObjectList(li.getContent(), pattern);
        break;
      case LINK:
        Link link = (Link) target;
        if (idMatch(link.getId(), pattern)) {
          link.setId(null);
        }
        // empty element.
        break;
      case MAIN:
        Main main = (Main) target;
        if (idMatch(main.getId(), pattern)) {
          main.setId(null);
        }
        unsetAllIdWithinObjectList(main.getContent(), pattern);
        break;
      case MAP:
        Map map = (Map) target;
        if (idMatch(map.getId(), pattern)) {
          map.setId(null);
        }
        for (Area tmpArea : map.getArea()) {
          execute(tmpArea, pattern);
        }
        break;
      case MENU:
        Menu menu = (Menu) target;
        if (idMatch(menu.getId(), pattern)) {
          menu.setId(null);
        }
        unsetAllIdWithinObjectList(menu.getContent(), pattern);
        break;
      case META:
        Meta meta = (Meta) target;
        if (idMatch(meta.getId(), pattern)) {
          meta.setId(null);
        }
        // empty element.
        break;
      case NOFRAMES:
        Noframes noframes = (Noframes) target;
        if (idMatch(noframes.getId(), pattern)) {
          noframes.setId(null);
        }
        unsetAllIdWithinObjectList(noframes.getContent(), pattern);
        break;
      case NOSCRIPT:
        Noscript noscript = (Noscript) target;
        if (idMatch(noscript.getId(), pattern)) {
          noscript.setId(null);
        }
        unsetAllIdWithinObjectList(noscript.getContent(), pattern);
        break;
      case OBJECT:
        org.mixer2.jaxb.xhtml.Object object = (org.mixer2.jaxb.xhtml.Object) target;
        if (idMatch(object.getId(), pattern)) {
          object.setId(null);
        }
        unsetAllIdWithinObjectList(object.getContent(), pattern);
        break;
      case OL:
        Ol ol = (Ol) target;
        if (idMatch(ol.getId(), pattern)) {
          ol.setId(null);
        }
        for (Li tmpli : ol.getLi()) {
          execute(tmpli, pattern);
        }
        break;
      case OPTGROUP:
        Optgroup optgroup = (Optgroup) target;
        if (idMatch(optgroup.getId(), pattern)) {
          optgroup.setId(null);
        }
        for (Option tmpOption : optgroup.getOption()) {
          execute(tmpOption, pattern);
        }
        break;
      case OPTION:
        Option option = (Option) target;
        if (idMatch(option.getId(), pattern)) {
          option.setId(null);
        }
        // option tag includes no other element.
        break;
      case P:
        P p = (P) target;
        if (idMatch(p.getId(), pattern)) {
          p.setId(null);
        }
        unsetAllIdWithinObjectList(p.getContent(), pattern);
        break;
      case PARAM:
        Param param = (Param) target;
        if (idMatch(param.getId(), pattern)) {
          param.setId(null);
        }
        // empty element.
        break;
      case PRE:
        Pre pre = (Pre) target;
        if (idMatch(pre.getId(), pattern)) {
          pre.setId(null);
        }
        unsetAllIdWithinObjectList(pre.getContent(), pattern);
        break;
      case Q:
        Q q = (Q) target;
        if (idMatch(q.getId(), pattern)) {
          q.setId(null);
        }
        unsetAllIdWithinObjectList(q.getContent(), pattern);
        break;
      case S:
        S s = (S) target;
        if (idMatch(s.getId(), pattern)) {
          s.setId(null);
        }
        unsetAllIdWithinObjectList(s.getContent(), pattern);
        break;
      case SAMP:
        Samp samp = (Samp) target;
        if (idMatch(samp.getId(), pattern)) {
          samp.setId(null);
        }
        unsetAllIdWithinObjectList(samp.getContent(), pattern);
        break;
      case SCRIPT:
        Script script = (Script) target;
        if (idMatch(script.getId(), pattern)) {
          script.setId(null);
        }
        // script include no other element.
        break;
      case SELECT:
        Select select = (Select) target;
        if (idMatch(select.getId(), pattern)) {
          select.setId(null);
        }
        for (AbstractJaxb aj : select.getOptgroupOrOption()) {
          execute(aj, pattern);
        }
        break;
      case SMALL:
        Small small = (Small) target;
        if (idMatch(small.getId(), pattern)) {
          small.setId(null);
        }
        unsetAllIdWithinObjectList(small.getContent(), pattern);
        break;
      case SPAN:
        Span span = (Span) target;
        if (idMatch(span.getId(), pattern)) {
          span.setId(null);
        }
        unsetAllIdWithinObjectList(span.getContent(), pattern);
        break;
      case STRIKE:
        Strike strike = (Strike) target;
        if (idMatch(strike.getId(), pattern)) {
          strike.setId(null);
        }
        unsetAllIdWithinObjectList(strike.getContent(), pattern);
        break;
      case STRONG:
        Strong strong = (Strong) target;
        if (idMatch(strong.getId(), pattern)) {
          strong.setId(null);
        }
        unsetAllIdWithinObjectList(strong.getContent(), pattern);
        break;
      case STYLE:
        Style style = (Style) target;
        if (idMatch(style.getId(), pattern)) {
          style.setId(null);
        }
        // has no other element.
        break;
      case SUB:
        Sub sub = (Sub) target;
        if (idMatch(sub.getId(), pattern)) {
          sub.setId(null);
        }
        unsetAllIdWithinObjectList(sub.getContent(), pattern);
        break;
      case SUP:
        Sup sup = (Sup) target;
        if (idMatch(sup.getId(), pattern)) {
          sup.setId(null);
        }
        unsetAllIdWithinObjectList(sup.getContent(), pattern);
        break;
      case TABLE:
        Table table = (Table) target;
        if (idMatch(table.getId(), pattern)) {
          table.setId(null);
        }
        if (table.isSetCaption()) {
          execute(table.getCaption(), pattern);
        }
        for (Col tmpCol : table.getCol()) {
          execute(tmpCol, pattern);
        }
        for (Colgroup tmpColgroup : table.getColgroup()) {
          execute(tmpColgroup, pattern);
        }
        for (Tbody tmpTbody : table.getTbody()) {
          execute(tmpTbody, pattern);
        }
        if (table.isSetThead()) {
          execute(table.getThead(), pattern);
        }
        if (table.isSetTfoot()) {
          execute(table.getTfoot(), pattern);
        }
        for (Tr tmpTr : table.getTr()) {
          execute(tmpTr, pattern);
        }
        break;
      case TBODY:
        Tbody tbody = (Tbody) target;
        if (idMatch(tbody.getId(), pattern)) {
          tbody.setId(null);
        }
        for (Tr tmpTr : tbody.getTr()) {
          execute(tmpTr, pattern);
        }
        break;
      case TD:
        Td td = (Td) target;
        if (idMatch(td.getId(), pattern)) {
          td.setId(null);
        }
        unsetAllIdWithinObjectList(td.getContent(), pattern);
        break;
      case TEXTAREA:
        Textarea textarea = (Textarea) target;
        if (idMatch(textarea.getId(), pattern)) {
          textarea.setId(null);
        }
        // textarea has no other element.
        break;
      case TFOOT:
        Tfoot tfoot = (Tfoot) target;
        if (idMatch(tfoot.getId(), pattern)) {
          tfoot.setId(null);
        }
        for (Tr tmpTr : tfoot.getTr()) {
          execute(tmpTr, pattern);
        }
        break;
      case TH:
        Th th = (Th) target;
        if (idMatch(th.getId(), pattern)) {
          th.setId(null);
        }
        unsetAllIdWithinObjectList(th.getContent(), pattern);
        break;
      case THEAD:
        Thead thead = (Thead) target;
        if (idMatch(thead.getId(), pattern)) {
          thead.setId(null);
        }
        for (Tr tmpTr : thead.getTr()) {
          execute(tmpTr, pattern);
        }
        break;
      case TITLE:
        Title title = (Title) target;
        if (idMatch(title.getId(), pattern)) {
          title.setId(null);
        }
        // has no other element.
        break;
      case TR:
        Tr tr = (Tr) target;
        if (idMatch(tr.getId(), pattern)) {
          tr.setId(null);
        }
        for (AbstractJaxb aj : tr.getThOrTd()) {
          execute(aj, pattern);
        }
        break;
      case TT:
        Tt tt = (Tt) target;
        if (idMatch(tt.getId(), pattern)) {
          tt.setId(null);
        }
        unsetAllIdWithinObjectList(tt.getContent(), pattern);
        break;
      case U:
        U u = (U) target;
        if (idMatch(u.getId(), pattern)) {
          u.setId(null);
        }
        unsetAllIdWithinObjectList(u.getContent(), pattern);
        break;
      case UL:
        Ul ul = (Ul) target;
        if (idMatch(ul.getId(), pattern)) {
          ul.setId(null);
        }
        for (Li tmpLi : ul.getLi()) {
          execute(tmpLi, pattern);
        }
        break;
      case VAR:
        Var var = (Var) target;
        if (idMatch(var.getId(), pattern)) {
          var.setId(null);
        }
        unsetAllIdWithinObjectList(var.getContent(), pattern);
        break;
      case ARTICLE:
        Article article = (Article) target;
        if (idMatch(article.getId(), pattern)) {
          article.setId(null);
        }
        unsetAllIdWithinObjectList(article.getContent(), pattern);
        break;
      case ASIDE:
        Aside aside = (Aside) target;
        if (idMatch(aside.getId(), pattern)) {
          aside.setId(null);
        }
        unsetAllIdWithinObjectList(aside.getContent(), pattern);
        break;
      case AUDIO:
        Audio audio = (Audio) target;
        if (idMatch(audio.getId(), pattern)) {
          audio.setId(null);
        }
        unsetAllIdWithinObjectList(audio.getContent(), pattern);
        break;
      case BDI:
        Bdi bdi = (Bdi) target;
        if (idMatch(bdi.getId(), pattern)) {
          bdi.setId(null);
        }
        unsetAllIdWithinObjectList(bdi.getContent(), pattern);
        break;
      case CANVAS:
        Canvas canvas = (Canvas) target;
        if (idMatch(canvas.getId(), pattern)) {
          canvas.setId(null);
        }
        unsetAllIdWithinObjectList(canvas.getContent(), pattern);
        break;
      case COMMAND:
        Command command = (Command) target;
        if (idMatch(command.getId(), pattern)) {
          command.setId(null);
        }
        // empty element
        break;
      case DATALIST:
        Datalist datalist = (Datalist) target;
        if (idMatch(datalist.getId(), pattern)) {
          datalist.setId(null);
        }
        unsetAllIdWithinObjectList(datalist.getContent(), pattern);
        break;
      case DETAILS:
        Details details = (Details) target;
        if (idMatch(details.getId(), pattern)) {
          details.setId(null);
        }
        unsetAllIdWithinObjectList(details.getContent(), pattern);
        break;
      case EMBED:
        Embed embed = (Embed) target;
        if (idMatch(embed.getId(), pattern)) {
          embed.setId(null);
        }
        // empty element
        break;
      case FIGCAPTION:
        Figcaption figcaption = (Figcaption) target;
        if (idMatch(figcaption.getId(), pattern)) {
          figcaption.setId(null);
        }
        unsetAllIdWithinObjectList(figcaption.getContent(), pattern);
        break;
      case FIGURE:
        Figure figure = (Figure) target;
        if (idMatch(figure.getId(), pattern)) {
          figure.setId(null);
        }
        unsetAllIdWithinObjectList(figure.getContent(), pattern);
        break;
      case FOOTER:
        Footer footer = (Footer) target;
        if (idMatch(footer.getId(), pattern)) {
          footer.setId(null);
        }
        unsetAllIdWithinObjectList(footer.getContent(), pattern);
        break;
      case HEADER:
        Header header = (Header) target;
        if (idMatch(header.getId(), pattern)) {
          header.setId(null);
        }
        unsetAllIdWithinObjectList(header.getContent(), pattern);
        break;
      case KEYGEN:
        Keygen keygen = (Keygen) target;
        if (idMatch(keygen.getId(), pattern)) {
          keygen.setId(null);
        }
        // empty element
        break;
      case MARK:
        Mark mark = (Mark) target;
        if (idMatch(mark.getId(), pattern)) {
          mark.setId(null);
        }
        unsetAllIdWithinObjectList(mark.getContent(), pattern);
        break;
      case METER:
        Meter meter = (Meter) target;
        if (idMatch(meter.getId(), pattern)) {
          meter.setId(null);
        }
        unsetAllIdWithinObjectList(meter.getContent(), pattern);
        break;
      case NAV:
        Nav nav = (Nav) target;
        if (idMatch(nav.getId(), pattern)) {
          nav.setId(null);
        }
        unsetAllIdWithinObjectList(nav.getContent(), pattern);
        break;
      case OUTPUT:
        Output output = (Output) target;
        if (idMatch(output.getId(), pattern)) {
          output.setId(null);
        }
        unsetAllIdWithinObjectList(output.getContent(), pattern);
        break;
      case PROGRESS:
        Progress progress = (Progress) target;
        if (idMatch(progress.getId(), pattern)) {
          progress.setId(null);
        }
        unsetAllIdWithinObjectList(progress.getContent(), pattern);
        break;
      case RP:
        Rp rp = (Rp) target;
        if (idMatch(rp.getId(), pattern)) {
          rp.setId(null);
        }
        unsetAllIdWithinObjectList(rp.getContent(), pattern);
        break;
      case RT:
        Rt rt = (Rt) target;
        if (idMatch(rt.getId(), pattern)) {
          rt.setId(null);
        }
        unsetAllIdWithinObjectList(rt.getContent(), pattern);
        break;
      case RUBY:
        Ruby ruby = (Ruby) target;
        if (idMatch(ruby.getId(), pattern)) {
          ruby.setId(null);
        }
        unsetAllIdWithinObjectList(ruby.getContent(), pattern);
        break;
      case SECTION:
        Section section = (Section) target;
        if (idMatch(section.getId(), pattern)) {
          section.setId(null);
        }
        unsetAllIdWithinObjectList(section.getContent(), pattern);
        break;
      case SOURCE:
        Source source = (Source) target;
        if (idMatch(source.getId(), pattern)) {
          source.setId(null);
        }
        break;
      case SUMMARY:
        Summary summary = (Summary) target;
        if (idMatch(summary.getId(), pattern)) {
          summary.setId(null);
        }
        unsetAllIdWithinObjectList(summary.getContent(), pattern);
        break;
      case TIME:
        Time time = (Time) target;
        if (idMatch(time.getId(), pattern)) {
          time.setId(null);
        }
        unsetAllIdWithinObjectList(time.getContent(), pattern);
        break;
      case TRACK:
        Track track = (Track) target;
        if (idMatch(track.getId(), pattern)) {
          track.setId(null);
        }
        // empty element
        break;
      case VIDEO:
        Video video = (Video) target;
        if (idMatch(video.getId(), pattern)) {
          video.setId(null);
        }
        unsetAllIdWithinObjectList(video.getContent(), pattern);
        break;
      case WBR:
        Wbr wbr = (Wbr) target;
        if (idMatch(wbr.getId(), pattern)) {
          wbr.setId(null);
        }
        // empty element
        break;
    }
  }
  @SuppressWarnings("deprecation")
  public static Inventory constructInventory(
      TitlesPlugin plugin, Player player, String cat, boolean owned) {
    DataContainer dataContainer = plugin.getDataContainer();
    Inventory inv = null;
    // if there are titles, construct category inventory
    if (!dataContainer.getTitles().isEmpty()) {
      List<String> categories = GetCommands.getCategories(dataContainer);
      List<ItemStack> clickables = new ArrayList<>();

      // get inventory with categories.
      if (cat == null) {

        if (owned) {
          List<Title> unlocked = dataContainer.getUnlockedTitles(player);
          for (Title title : unlocked) {
            ItemStack is;
            String name = title.getName();
            String description = title.getDescription();
            String status;

            if (dataContainer.getCurrentTitle(player) != null
                && dataContainer.getCurrentTitle(player).equals(title)) {
              is = new ItemStack(Material.WOOL, 1, DyeColor.LIME.getData());
              status = "Current";
            } else {
              is = new ItemStack(Material.WOOL, 1, DyeColor.GREEN.getData());
              status = "Unlocked";
            }
            ItemMeta meta = is.getItemMeta();
            meta.setDisplayName(name);
            meta.setLore(
                Arrays.asList(
                    "Description: " + description,
                    "Category: " + title.getCategory().getName(),
                    "Status: " + status));
            is.setItemMeta(meta);
            clickables.add(is);
          }

          int size = ((clickables.size() / 9) + 1) * 9;
          inv =
              Bukkit.createInventory(
                  null, size, ChatColor.DARK_AQUA + "" + ChatColor.BOLD + "Unlocked Titles");

          for (int i = 0; i < clickables.size(); i++) inv.setItem(i, clickables.get(i));

          // back button
          ItemStack is = new ItemStack(Material.WOOL, 1, DyeColor.GRAY.getData());
          ItemMeta meta = is.getItemMeta();
          meta.setDisplayName("Back");
          is.setItemMeta(meta);
          inv.setItem(inv.getSize() - 1, is);
          return inv;
        }

        for (String category : categories) {
          ItemStack is = new ItemStack(Material.WOOL, 1, DyeColor.GRAY.getData());
          ItemMeta meta = is.getItemMeta();
          meta.setDisplayName(category);
          is.setItemMeta(meta);
          clickables.add(is);
        }
        int size = ((clickables.size() / 9) + 1) * 9;
        inv =
            Bukkit.createInventory(
                null, size, ChatColor.DARK_AQUA + "" + ChatColor.BOLD + "Title categories");

        // get inventory with titles from category.
      } else {
        Category category = dataContainer.getCategory(cat);
        if (category == null) return null;
        List<Title> titles = dataContainer.getTitlesFromCategory(category);
        List<Title> ownedTitles = dataContainer.getUnlockedTitles(player);

        for (Title title : titles) {
          ItemStack is;
          String name = title.getName();
          String description = title.getDescription();
          String status;

          if (ownedTitles.contains(title)) {
            if (dataContainer.getCurrentTitle(player) != null
                && dataContainer.getCurrentTitle(player).equals(title)) {
              is = new ItemStack(Material.WOOL, 1, DyeColor.LIME.getData());
              status = "Current";
            } else {
              is = new ItemStack(Material.WOOL, 1, DyeColor.GREEN.getData());
              status = "Unlocked";
            }
          } else {
            Request request = dataContainer.getRequest(player);
            if (request != null
                && request.getTitle().equals(title)
                && request.getStatus() == RequestStatus.pending) {
              is = new ItemStack(Material.WOOL, 1, DyeColor.ORANGE.getData());
              status = "Pending";
            } else {
              is = new ItemStack(Material.WOOL, 1, DyeColor.RED.getData());
              status = "Locked";
            }
          }

          ItemMeta meta = is.getItemMeta();
          meta.setDisplayName(name);
          meta.setLore(
              Arrays.asList(
                  "Description: " + description,
                  "Category: " + category.getName(),
                  "Status: " + status));
          is.setItemMeta(meta);
          clickables.add(is);
        }
        int size = ((clickables.size() / 9) + 1) * 9;
        inv =
            Bukkit.createInventory(
                null, size, ChatColor.DARK_AQUA + "" + ChatColor.BOLD + "Titles in category");
      }

      for (int i = 0; i < clickables.size(); i++) inv.setItem(i, clickables.get(i));

      // back button
      if (cat != null) {
        ItemStack is = new ItemStack(Material.WOOL, 1, DyeColor.GRAY.getData());
        ItemMeta meta = is.getItemMeta();
        meta.setDisplayName("Back");
        is.setItemMeta(meta);
        inv.setItem(inv.getSize() - 1, is);

        // player's unlocked titles
      } else {
        ItemStack is = new ItemStack(Material.WOOL, 1, DyeColor.GREEN.getData());
        ItemMeta meta = is.getItemMeta();
        meta.setDisplayName("Unlocked");
        is.setItemMeta(meta);
        inv.setItem(inv.getSize() - 1, is);
      }

    } else Utils.sendError(player, "There are no titles yet.");
    return inv;
  }
  @EventHandler
  public void onInventoryClick(InventoryClickEvent e) {
    DataContainer dataContainer = plugin.getDataContainer();
    Player player = (Player) e.getWhoClicked();

    String name = ChatColor.stripColor(e.getInventory().getName());

    if (name.equalsIgnoreCase("Title categories")) {
      e.setCancelled(true);
      if (e.getCurrentItem() == null
          || e.getCurrentItem().getType() == Material.AIR
          || !e.getCurrentItem().hasItemMeta()) {
        player.closeInventory();
        return;
      }

      if (e.getCurrentItem().getData() instanceof Wool) {

        // All unlocked titles of player
        if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("Unlocked")) {
          player.openInventory(constructInventory(plugin, player, null, true));
          return;
        }

        // open Titles in category
        player.openInventory(
            constructInventory(
                plugin,
                player,
                Utils.strip(Utils.setColors(e.getCurrentItem().getItemMeta().getDisplayName())),
                false));
      }
    } else if (name.equalsIgnoreCase("Titles in category")
        || name.equalsIgnoreCase("Unlocked Titles")) {
      e.setCancelled(true);
      if (e.getCurrentItem() == null
          || e.getCurrentItem().getType() == Material.AIR
          || !e.getCurrentItem().hasItemMeta()) {
        player.closeInventory();
        return;
      }

      // back button
      if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("Back")) {
        player.openInventory(constructInventory(plugin, player, null, false));
        return;
      }

      String category = null;
      String[] split = e.getCurrentItem().getItemMeta().getLore().get(1).split(" ");
      if (split.length == 2) category = split[1];

      if (e.getCurrentItem().getData() instanceof Wool) {
        DyeColor color = ((Wool) e.getCurrentItem().getData()).getColor();
        Title title =
            dataContainer.getTitle(
                Utils.strip(
                    Utils.setColors(
                        e.getCurrentItem().getItemMeta().getDisplayName().toLowerCase())));
        Inventory inv = e.getInventory();
        ItemMeta im = e.getCurrentItem().getItemMeta();
        int slot = e.getSlot();
        if (name.equalsIgnoreCase("Titles in category")) {
          switch (color) {
            case RED:
              // Request title.
              if (player.hasPermission(plugin.makeRequestsPerm)) {
                if (RequestCommands.submitRequest(dataContainer, player, title.getId())) {
                  Utils.sendMsg(
                      player,
                      "Your request for "
                          + ChatColor.ITALIC
                          + title.getName()
                          + ChatColor.RESET
                          + " has been submitted.");
                  handleBlock(inv, im, DyeColor.ORANGE, "Pending", slot);
                } else
                  Utils.sendError(
                      player, "You already have a pending request or that title doesn't exist.");
              } else Utils.sendError(player, "You don't have permission to do that.");
              break;
            case LIME:
              // Disable current title.
              if (player.hasPermission(plugin.setTitlePerm)) {
                if (SetCommands.disableTitle(dataContainer, player)) {
                  Utils.sendMsg(player, "Title disabled.");
                  handleBlock(inv, im, DyeColor.GREEN, "Unlocked", slot);
                } else Utils.sendError(player, "Player doesn't have that title active.");
              } else Utils.sendError(player, "You don't have permission to do that.");
              break;
            case GREEN:
              // Set title as current.
              if (player.hasPermission(plugin.setTitlePerm)) {
                if (SetCommands.setTitle(dataContainer, player, title.getId())) {
                  Utils.sendMsg(
                      player,
                      String.format(
                          "Title set to %s" + title.getName() + "%s.",
                          ChatColor.ITALIC,
                          ChatColor.RESET));
                  handleBlock(inv, im, DyeColor.LIME, "Current", slot);
                  if (category == null) player.closeInventory();
                  else player.openInventory(constructInventory(plugin, player, category, false));

                } else
                  Utils.sendError(player, "Player doesn't own that title or it doesn't exist.");
              } else Utils.sendError(player, "You don't have permission to do that.");
              break;
            case ORANGE:
              // Retract request.
              if (player.hasPermission(plugin.makeRequestsPerm)) {
                if (RequestCommands.retractRequest(dataContainer, player)) {
                  Utils.sendMsg(player, "Your request has successfully been retracted.");
                  handleBlock(inv, im, DyeColor.RED, "Locked", slot);
                } else Utils.sendError(player, "You don't have a pending request.");
              } else Utils.sendError(player, "You don't have permission to do that.");
              break;
          }

        } else if (name.equalsIgnoreCase("Unlocked Titles")) {
          switch (color) {
            case LIME:
              // Disable current title.
              if (player.hasPermission(plugin.setTitlePerm)) {
                if (SetCommands.disableTitle(dataContainer, player)) {
                  Utils.sendMsg(player, "Title disabled.");
                  handleBlock(inv, im, DyeColor.GREEN, "Unlocked", slot);
                } else Utils.sendError(player, "Player doesn't have that title active.");
              } else Utils.sendError(player, "You don't have permission to do that.");
              break;
            case GREEN:
              // Set title as current.
              if (player.hasPermission(plugin.setTitlePerm)) {
                if (SetCommands.setTitle(dataContainer, player, title.getId())) {
                  Utils.sendMsg(
                      player,
                      String.format(
                          "Title set to %s" + title.getName() + "%s.",
                          ChatColor.ITALIC,
                          ChatColor.RESET));
                  handleBlock(inv, im, DyeColor.LIME, "Current", slot);
                  if (category == null) player.closeInventory();
                  else player.openInventory(constructInventory(plugin, player, category, false));

                } else
                  Utils.sendError(player, "Player doesn't own that title or it doesn't exist.");
              } else Utils.sendError(player, "You don't have permission to do that.");
              break;
          }
        }
      }
    }
  }
 @Override
 public void titleSetLeftImageAndTxt(int resouceId, String str) {
   if (mTitleClass != null) {
     mTitleClass.titleSetLeftImageAndTxt(resouceId, str);
   }
 }
 public CoursePanel(String courseName) {
   super();
   Title.setText(courseName);
   setMaximumSize(new Dimension(500, 300));
 }
Exemple #14
0
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    jScrollPane1 = new javax.swing.JScrollPane();
    Log_text = new javax.swing.JTextArea();
    Title = new javax.swing.JLabel();
    Type_label = new javax.swing.JLabel();
    Type_text = new javax.swing.JTextField();
    Query_label = new javax.swing.JLabel();
    jScrollPane2 = new javax.swing.JScrollPane();
    Message_text = new javax.swing.JTextArea();
    Send_button = new javax.swing.JButton();
    jMenuBar1 = new javax.swing.JMenuBar();
    jMenu1 = new javax.swing.JMenu();
    jMenu2 = new javax.swing.JMenu();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setResizable(false);

    Log_text.setEditable(false);
    Log_text.setColumns(20);
    Log_text.setRows(5);
    jScrollPane1.setViewportView(Log_text);

    Title.setFont(new java.awt.Font("Ubuntu", 0, 24)); // NOI18N
    Title.setText("UDP Client");

    Type_label.setText("Type");

    Type_text.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            Type_textActionPerformed(evt);
          }
        });

    Query_label.setText("Message");

    Message_text.setColumns(20);
    Message_text.setRows(5);
    jScrollPane2.setViewportView(Message_text);

    Send_button.setText("Send");
    Send_button.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            Send_buttonActionPerformed(evt);
          }
        });

    jMenu1.setText("File");
    jMenuBar1.add(jMenu1);

    jMenu2.setText("Edit");
    jMenuBar1.add(jMenu2);

    setJMenuBar(jMenuBar1);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGap(79, 79, 79)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(
                                Send_button,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                80,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(
                                                jScrollPane1,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                330,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(Title))
                                    .addGap(100, 100, 100)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(
                                                Type_text,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                100,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(Type_label)
                                            .addComponent(Query_label)
                                            .addComponent(
                                                jScrollPane2,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addContainerGap(86, Short.MAX_VALUE)));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                layout
                    .createSequentialGroup()
                    .addGap(39, 39, 39)
                    .addComponent(Title)
                    .addGap(30, 30, 30)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(
                                jScrollPane1,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                400,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(Type_label)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        Type_text,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(Query_label)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        jScrollPane2,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(18, 18, 18)
                                    .addComponent(Send_button)))
                    .addContainerGap(82, Short.MAX_VALUE)));

    pack();
  } // </editor-fold>//GEN-END:initComponents
 @Override
 public void titleSetCenterTwoTitle(String title1, String title2) {
   if (mTitleClass != null) {
     mTitleClass.titleSetCenterTwoTitle(title1, title2);
   }
 }
 @Override
 public void titleSetCenterTitle(String title) {
   if (mTitleClass != null) {
     mTitleClass.titleSetCenterTitle(title);
   }
 }
 @Override
 public void titleSlideMenu(DrawerLayout drawerLayout) {
   if (mTitleClass != null && drawerLayout != null) {
     mTitleClass.titleSlideMenu(drawerLayout);
   }
 }
 @Override
 public void titleOnBackPress() {
   if (mTitleClass != null) {
     mTitleClass.titleOnBackPress();
   }
 }
Exemple #19
0
 public static Title create(boolean withChilds) {
   Title xml = new Title();
   xml.setKey("myKey");
   xml.setLabel("myLabel");
   return xml;
 }
 @Override
 public void titleSetRightImage(int resouceId) {
   if (mTitleClass != null) {
     mTitleClass.titleSetRightImage(resouceId);
   }
 }
Exemple #21
0
 public String toXML() {
   return title.toXML();
 }
 public CoursePanel() {
   super();
   Title.setText("Course Name");
   setMaximumSize(new Dimension(500, 300));
 }