org.apache.wicket.markup.html.panel.Fragment类的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(170)

本文整理了Java中org.apache.wicket.markup.html.panel.Fragment类的一些代码示例,展示了Fragment类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Fragment类的具体详情如下:
包路径:org.apache.wicket.markup.html.panel.Fragment
类名称:Fragment

Fragment介绍

[英]Usually you either have a markup file or a xml tag with wicket:id="myComponent" to associate markup with a component. However in some use cases, especially when working with small panels it is a bit awkward to maintain tiny pieces of markup in plenty of panel markup files. Use cases are for example list views where list items are different depending on a state.

Fragments provide a means to maintain the panels tiny piece of markup. Since it can be anywhere, the component whose markup contains the fragment's markup must be provided (markup provider).

<span wicket:id="myPanel">Example input (will be removed)</span> 
<wicket:fragment wicket:id="frag1">panel 1</wicket:fragment> 
<wicket:fragment wicket:id="frag2">panel 2</wicket:fragment>
add(new Fragment("myPanel1", "frag1", myPage);

[中]通常,您可以使用一个标记文件或带有wicket:id=“myComponent”的xml标记将标记与组件关联。然而,在某些用例中,尤其是在使用小面板时,在大量面板标记文件中维护微小的标记片段有点尴尬。用例是例如列表视图,其中列表项根据状态而不同。
片段提供了一种维护面板的方法——一小块标记。因为它可以在任何地方,所以必须提供其标记包含片段标记的组件(标记提供程序)。

<span wicket:id="myPanel">Example input (will be removed)</span> 
<wicket:fragment wicket:id="frag1">panel 1</wicket:fragment> 
<wicket:fragment wicket:id="frag2">panel 2</wicket:fragment>
add(new Fragment("myPanel1", "frag1", myPage);

代码示例

代码示例来源:origin: stackoverflow.com

Fragment fragment = new Fragment();
Bundle bundle = new Bundle();
bundle.putInt(key, value);
fragment.setArguments(bundle);

代码示例来源:origin: stackoverflow.com

@Override
public void onClick(View v) {
  final FragmentManager fm = ((FragmentActivity) getContext()).getSupportFragmentManager();
  Fragment auxiliary = new Fragment() {
    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
      //DO WHATEVER YOU NEED
      super.onActivityResult(requestCode, resultCode, data);
      fm.beginTransaction().remove(this).commit();
    }
  };
  fm.beginTransaction().add(auxiliary, "FRAGMENT_TAG").commit();
  fm.executePendingTransactions();

  auxiliary.startActivityForResult(new Intent(getContext(), ToStartActivity.class), 3333);
}

代码示例来源:origin: stackoverflow.com

Bundle bundle = new Bundle();
bundle.putString("address", "sms.get(position).getmAddress()");
// set Fragment Arguments
Fragment fragment = new Fragment();
fragment.setArguments(bundle);

代码示例来源:origin: stackoverflow.com

FragmentManager fm = getActivity().getFragmentManager();
Bundle arguments = new Bundle();
arguments.putInt("VALUE1", 0);
arguments.putInt("VALUE2", 100);

MyFragment myFragment = new Fragment();
fragment.setArguments(arguments);

fm.beginTransaction().replace(R.id.content_frame, myFragment).commit();

代码示例来源:origin: stackoverflow.com

Bundle bundle = new Bundle();
bundle.putString("key", "value");
// to send object use below code
// bundle.putSerializable("key", object);
Fragment fragment = new Fragment();
fragment.setArguments(bundle);
getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment).commit();

代码示例来源:origin: stackoverflow.com

Fragment fragment = new Fragment();
Bundle bundle = new Bundle();
bundle.putInt(key, value);
fragment.SetArguments(bundle);

代码示例来源:origin: stackoverflow.com

final Fragment fragment = new Fragment();
if(position == items.size()-1){
  final Bundle args = new Bundle();
  args.putBoolean("isLast",true);
  fragment.setArguments(args);
}
return fragment;

代码示例来源:origin: stackoverflow.com

Fragment fragment = new Fragment();
Foo foo = new Foo();
Bundle bundle = new Bundle();
bundle.putParcelable("Foo", foo);
fragment.setArguments(bundle);

代码示例来源:origin: stackoverflow.com

// private method called during option select...
private void onOptionClickDoSomething() {
  Fragment myFragment = new Fragment();
  Bundle args = new Bundle();
  args.putCharSequence("key", someStringValue);

  myFragment.setArguments(args); // attach args to the Fragment

  // invoke a transaction
  FragmentManager fm = getSupportFragmentManager();  // assume using support library
  FragmentTransaction ft = fm.beginTransaction();
  ft.add(R.id.myFragmentContainer, myFragment);
  ft.commit();
}

代码示例来源:origin: stackoverflow.com

public class MyDialogFragment extends DialogFragment {
  public static final String MESSAGE = "message";
  public static final String TITLE = "title"
  public static final String ICON_ID = "icon_id"
  public static MyDialogFragment newInstance(String title, String message, int iconId) {
     Fragment f = new Fragment();
     Bundle b = new Bundle(); 
     // fill up b
     f.setArguments(b);
     return f;
  }
}

代码示例来源:origin: stackoverflow.com

int a;
public static Fragment newInstance(Bundle args) {
   a = args.getInt("INT_DATA_TAG"); //use a constant for the tag
   return new Fragment();
}

代码示例来源:origin: theonedev/onedev

@Override
protected Component newContent(String id, FloatingPanel dropdown) {
  Fragment fragment = new Fragment(id, "navContextDropdownFrag", GroupPage.this);
  fragment.add(new Tabbable("menu", newTabs()));
  return fragment;
}

代码示例来源:origin: de.alpharogroup/jaulp-wicket-components

/**
 * {@inheritDoc}
 */
@Override
protected Fragment newViewFragment(final String id)
{
  final Fragment viewFragment = new Fragment(id, "view", this, getModel());
  viewFragment.setOutputMarkupPlaceholderTag(true);
  viewFragment.add(newViewComponent("viewComponent", getModel()));
  return viewFragment;
}

代码示例来源:origin: org.geoserver.web/gs-web-core

protected Component headerPanel() {
  Fragment header = new Fragment(HEADER_PANEL, "header", this);
  // the add button
  header.add(new BookmarkablePageLink<WorkspaceNewPage>("addNew", WorkspaceNewPage.class));
  // the removal button
  header.add(removal = new SelectionRemovalLink("removeSelected", table, dialog));
  removal.setOutputMarkupId(true);
  removal.setEnabled(false);
  // check for full admin, we don't allow workspace admins to add new workspaces
  header.setEnabled(isAuthenticatedAsAdmin());
  return header;
}

代码示例来源:origin: stackoverflow.com

@Override
public Fragment getItem(int position) {
  switch (position) {
    case 0: // Fragment # 0 - This will show FirstFragment
      return FirstFragment.newInstance(0, "Page # 1");
    case 1: // Fragment # 0 - This will show FirstFragment different title
      return FirstFragment.newInstance(1, "Page # 2");
    case 2:
      return FirstFragment.newInstance(2, "Page # 3");
    default:
      return new Fragment();
  }
}

代码示例来源:origin: theonedev/onedev

@Override
protected void onUpdate(AjaxRequestTarget target) {
  onPropertyUpdating(target);
  target.add(fragment.get(BEAN_EDITOR_ID));
}

代码示例来源:origin: stackoverflow.com

Fragment fragment = new Fragment() {
    @Override
    public void onAttach(Activity activity) {
      super.onAttach(activity);
      if(getArguments() != null) {
        String scanContent = getArguments().getString("scanContent");
      }
    }
  };

Bundle bundle = new Bundle();
bundle.putString("scanContent", scanContent);
fragment.setArguments(bundle);

代码示例来源:origin: stackoverflow.com

Fragment homeFragmentHandler= new Fragment();
 Bundle bundle = new Bundle();
 //replace this line below wth something convinient
 bundle.putInt("key", value);
 fragment.setArguments(bundle);
 FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
 fragmentTransaction.add(R.id.primary_fragment_container, homeFragmentHandler);
 fragmentTransaction.addToBackStack(folderId.toString());
 fragmentTransaction.commit();

代码示例来源:origin: stackoverflow.com

Fragment map = new Fragment ();
  final Bundle bundle = new Bundle(); 
  bundle.putString("Position",one);
  bundle.putString("ID:",two);
  map.setArguments(bundle);
map.setArguments(arguments);
getSupportFragmentManager().beginTransaction()
.replace(R.id.item_detail_container, map).commit();

代码示例来源:origin: theonedev/onedev

@Override
protected Component newContent(String id, FloatingPanel dropdown) {
  Fragment fragment = new Fragment(id, "navContextDropdownFrag", UserPage.this);
  fragment.add(new Tabbable("menu", newTabs()));
  return fragment;
}

相关文章