public CommentList(Thread thread) {
    dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm");

    add(HeaderContributor.forCss(((CoreSession) getSession()).getUserStyle()));
    login = ((CoreSession) getSession()).getLoged();
    userController = new RegisteredUserController();

    if (login != null) user = userController.getRegisteredUserByLogin(login);
    else user = null;

    feedbackPanel = new CoreFeedBackPanel("feedback");
    add(feedbackPanel);

    commentController = new CommentController();

    pageRenderer = new PageRenderer();
    setPageHeaderPanel();
    setPageNavigationPanel();

    add(pageRenderer.getSearchForm());

    add(new ThemeList().themeListRepeater());
    add(getCommentListView(thread));
    add(new CommentForm("commentForm", thread));

    // navigacia kde som
    Label themeLabel = new Label("themeLabel", thread.getTheme().getName());
    Label threadLabel = new Label("threadLabel", thread.getName());
    Label threadLabelName = new Label("threadLabelName", thread.getName());

    add(themeLabel);
    add(threadLabel);
    add(threadLabelName);
  }
Example #2
0
  @SuppressWarnings("deprecation")
  public StatusBar(
      final String id,
      final IModel<Number> limitModel,
      final IModel<Number> progressModel,
      final IModel<String> progressMessageModel) {
    super(id);
    setOutputMarkupId(true);
    add(HeaderContributor.forCss(StatusBar.class, "statusbar.css"));

    WebMarkupContainer usageBar = new WebMarkupContainer("statusBarProgress");
    WebMarkupContainer excessBar = new WebMarkupContainer("statusBarExcess");

    final double limit = limitModel.getObject().doubleValue();
    final double used = progressModel.getObject().doubleValue();
    final double excess = used - limit;

    int usedPercentage;
    int excessPercentage;

    final int progressWidth = 200; // progress bar with, i.e. 100%

    if (excess > 0) {
      excessPercentage = (int) Math.round((excess * progressWidth) / used);
      usedPercentage = progressWidth - excessPercentage;
    } else {
      usedPercentage = (int) Math.round(used * progressWidth / limit);
      excessPercentage = 0;
    }

    usageBar.add(
        new AttributeModifier(
            "style",
            true,
            new Model<String>(
                "width: " + usedPercentage + "px; left: 5px; border-left: inherit;")));

    String redStyle = "width: " + excessPercentage + "px; left: " + (5 + usedPercentage) + "px;";
    excessBar.add(new AttributeModifier("style", true, new Model<String>(redStyle)));

    add(usageBar);
    add(excessBar);
    add(new Label("progressLabel", progressMessageModel));

    // TODO:make the argument models truly dynamic
    // add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(5)));
  }
  public ProfilePage() {
    // nastavim CSS
    add(HeaderContributor.forCss(((CoreSession) getSession()).getUserStyle()));
    login = ((CoreSession) getSession()).getLoged();
    userController = new RegisteredUserController();

    if (login != null) user = userController.getRegisteredUserByLogin(login);
    else user = null;

    pageRenderer = new PageRenderer();
    setPageHeaderPanel();
    setPageNavigationPanel();

    add(pageRenderer.getSearchForm());

    add(new UserDetailForm("userDetailForm"));

    feedbackPanel = new CoreFeedBackPanel("feedback");
    add(feedbackPanel);
  }
Example #4
0
File: Frame.java Project: mix3/blog
  @SuppressWarnings("serial")
  public Frame() {
    settingModel = service.getSetting();

    add(
        HeaderContributor.forCss(
            WicketApplication.class, "resources/Styles/SyntaxHighlighter.css"));
    add(HeaderContributor.forJavaScript(WicketApplication.class, "resources/Scripts/shCore.js"));
    add(
        HeaderContributor.forJavaScript(
            WicketApplication.class, "resources/Scripts/shBrushPhp.js"));
    add(
        HeaderContributor.forJavaScript(
            WicketApplication.class, "resources/Scripts/shBrushXml.js"));
    add(
        HeaderContributor.forJavaScript(
            WicketApplication.class, "resources/Scripts/shBrushJava.js"));
    add(
        HeaderContributor.forJavaScript(
            WicketApplication.class, "resources/Scripts/shBrushRuby.js"));
    add(
        HeaderContributor.forJavaScript(
            WicketApplication.class, "resources/Scripts/shBrushJScript.js"));
    add(
        HeaderContributor.forJavaScript(
            WicketApplication.class, "resources/Scripts/shBrushCpp.js"));
    add(
        HeaderContributor.forJavaScript(
            WicketApplication.class, "resources/Scripts/shBrushCSharp.js"));
    add(
        HeaderContributor.forJavaScript(
            WicketApplication.class, "resources/Scripts/shBrushPerl.js"));

    add(
        FeedResource.autodiscoveryLink(
            new ResourceReference("myFeed") {
              @Override
              protected Resource newResource() {
                return new MyFeedResource(service);
              }
            }));
    add(new ExternalLink("rss", urlFor(new ResourceReference("myFeed")).toString()));

    add(new Label("header_title", settingModel.getBlogname()));
    add(
        new BookmarkablePageLink("title", TopPage.class) {
          @Override
          protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
            replaceComponentTagBody(markupStream, openTag, settingModel.getBlogname());
          }
        });
    add(new Label("description", new Model(settingModel.getDescription())));

    add(new FeedbackPanel("feedback"));

    if (((MySession) getSession()).isSignedIn()) {
      add(new AuthMenuPanel("nav"));
    } else {
      add(new MenuPanel("nav"));
    }

    //		add(new Label("sidebar", "sidebar"));
    try {
      add(new SidePanel("sidebar"));
    } catch (SQLException e) {
      e.printStackTrace();
      throw new RuntimeErrorException(new Error("error"), "error_message");
    }
  }