code
stringlengths
3
1.18M
language
stringclasses
1 value
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Java
package edu.uci.ics.crawler4j.parser; public class ExtractedUrlAnchorPair { private String href; private String anchor; public String getHref() { return href; } public void setHref(String href) { this.href = href; } public String getAnchor() { return anchor; } public void setAnchor(String anchor) {...
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"; you may ...
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
Java
/** * This class is adopted from Htmlunit with the following copyright: * * Copyright (c) 2002-2012 Gargoyle Software Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://ww...
Java
package edu.uci.ics.crawler4j.url; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashSet; import java.util.Set; public class TLDList { private static Set<String> tldSet; public static boolean contains(String str) { return tldSet.contains(str); } ...
Java
/*- * Copyright (c) 2000 - 2009 The Legion Of The Bouncy Castle (http://www.bouncycastle.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the Software * without restriction, including without li...
Java
/*- * Copyright (c) 2000 - 2009 The Legion Of The Bouncy Castle (http://www.bouncycastle.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the Software * without restriction, including without li...
Java
/*- * Copyright (c) 2000 - 2009 The Legion Of The Bouncy Castle (http://www.bouncycastle.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the Software * without restriction, including without li...
Java
/*- * Copyright (c) 2000 - 2009 The Legion Of The Bouncy Castle (http://www.bouncycastle.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the Software * without restriction, including without li...
Java
/*- * Copyright (c) 2000 - 2009 The Legion Of The Bouncy Castle (http://www.bouncycastle.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the Software * without restriction, including without li...
Java
/*- * Copyright (c) 2000 - 2009 The Legion Of The Bouncy Castle (http://www.bouncycastle.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the Software * without restriction, including without li...
Java
/*- * Copyright (c) 2000 - 2009 The Legion Of The Bouncy Castle (http://www.bouncycastle.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the Software * without restriction, including without li...
Java
/*- * Copyright (c) 2000 - 2009 The Legion Of The Bouncy Castle (http://www.bouncycastle.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the Software * without restriction, including without li...
Java
/*- * Copyright (c) 2000 - 2009 The Legion Of The Bouncy Castle (http://www.bouncycastle.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the Software * without restriction, including without li...
Java
/*- * Copyright (c) 2000 - 2009 The Legion Of The Bouncy Castle (http://www.bouncycastle.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the Software * without restriction, including without li...
Java
/*- * Copyright (c) 2000 - 2009 The Legion Of The Bouncy Castle (http://www.bouncycastle.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the Software * without restriction, including without li...
Java
/*- * Copyright 2010 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in ...
Java
/*- * Copyright 2010 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in ...
Java
/*- * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); yo...
Java
/*- * Copyright 2010 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in ...
Java
/*- * Copyright 2010 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in ...
Java
/*- * Copyright 2010 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in ...
Java
/*- * Copyright 2010 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in ...
Java
/*- * Copyright 2010 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in ...
Java
/*- * Copyright 2010 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in ...
Java
/*- * Copyright 2010 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in ...
Java
/*- * Copyright 2010 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in ...
Java
/*- * Copyright 2010 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in ...
Java
/*- * Copyright 2010 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in ...
Java
/*- * Copyright 2010 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in ...
Java
/*- * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); yo...
Java
/*- * Copyright 2010 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in ...
Java
/*- * Copyright 2010 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in ...
Java
/*- * Copyright 2010 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in ...
Java
/*- * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by ap...
Java
/*- * Copyright 2010 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in ...
Java
package Spooler; import java.util.ArrayList; import java.util.List; public class TaskManager extends Thread{ List<Task> taskList = new ArrayList<Task>(); public void add(Task task){ } public void delete(Task task){ } public void priorityUp(Task task){ } public void prior...
Java
package Printer; public class PrinterFactory { public PrinterFactory(){ } public Printer createPrinter(String id, String name, String loc){ Printer myPrt = new Printer(); return myPrt; } }
Java
package Cmd; import Spooler.*; public class PrintCmd{ Spooler mySpooler; public PrintCmd(Spooler spooler){ this.mySpooler = spooler; } public int logIn(String serverIP, String id, String pw) { System.out.println("PrintCmd>login>id,pw:"+id+","+pw); int ans = mySpooler.logIn(serverIP, id, p...
Java
package Cmd; public class ChgPriorityCmd { }
Java
package Server; import java.net.*; import java.util.ArrayList; import java.util.List; import JDBC.DBAccess; import Printer.Printer; import Spooler.User; public class serverSpooler { List<User> UserList; List<Printer> PrinterList; public void setUserList(List<User> userList) { this.UserList = ...
Java
package com.example.musicplayer.exception; public class NoMusicFound extends Exception{ public NoMusicFound(){ } public NoMusicFound(String message){ super(message); } }
Java
package com.example.musicplayer.service; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.Serializable; import java.util.List; import java.util.Random; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Se...
Java
package com.example.musicplayer.service; import android.media.MediaPlayer; public interface IMusicService { public void playMusic(int songIndex); public void pauseMusic(); public void stopMusic(); public void skipForward(); public void skipBackward(); public void shuffle(); public void repeat(); ...
Java
package com.example.musicplayer.dao; import java.util.ArrayList; import java.util.List; import java.util.Random; import com.example.musicplayer.R; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.content.SharedPreferences; import a...
Java
package com.example.musicplayer.dao; import java.util.List; import com.example.musicplayer.dto.Song; import com.example.musicplayer.exception.NoMusicFound; import android.database.Cursor; import android.net.Uri; public interface IMusicHandler { public void RetrieveMusic(); public Cursor cursorHandler(Uri mediaU...
Java
package com.example.musicplayer.dao; import java.util.ArrayList; import java.util.List; import java.util.Random; import com.example.musicplayer.dto.Song; import android.content.ContentResolver; import android.database.Cursor; import android.net.Uri; import android.os.Environment; import android.provider.MediaStore; ...
Java
package com.example.musicplayer.ui; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.widget.Toast; import com.example.musicplayer.service.MusicServiceStub; public class HeadphoneUnPlugIntent extends BroadcastReceiver { @Override pu...
Java
package com.example.musicplayer.ui; import android.app.ActionBar; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; im...
Java
package com.example.musicplayer.ui; import java.util.ArrayList; import java.util.List; import android.app.ActionBar; import android.app.AlertDialog; import android.app.ListActivity; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.net.Uri...
Java
package com.example.musicplayer.dto; import java.io.Serializable; public class Song implements Serializable { /** * */ private static final long serialVersionUID = -8405833330237737817L; String songName; String songArtist; String songPath; String songAlbum; Long albumID; public Long getAlbumID() { ret...
Java
/** Automatically generated file. DO NOT MODIFY */ package com.example.musicplayer; public final class BuildConfig { public final static boolean DEBUG = true; }
Java
/* * Copyright (c) 2011 yang hui <yanghui1986527@gmail.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but...
Java
/* * Copyright (c) 2011 yang hui <yanghui1986527@gmail.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but...
Java
/* * Copyright (c) 2011 yang hui <yanghui1986527@gmail.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but...
Java
/* * Copyright (c) 2011 yang hui <yanghui1986527@gmail.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but...
Java
/* * Copyright (c) 2011 yang hui <yanghui1986527@gmail.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but...
Java
package framework.interfaces; import javax.swing.JComponent; /** * This is the visualizing plug in for the CAV framework. It will specify how * to display a given state of the simulation. * @author Charlie Swanson * * @param <T> The type of data within each cell of the 2D (or possibly 1D) * board. */ public ...
Java
package framework.interfaces; import java.util.List; /** * CAV - Cellular Automaton Visualizer. This is the framework interface that * should be used to create such a visualizer. To use it, first set the Rules * and visualization plugins (using the methods setRulesPlugin and * setVisualPlugin), then set the init...
Java
package framework.interfaces; import java.util.List; /** * This is the interface to plug in to the CAV interface. It will specify * the ruleset for the Cellular Automaton by specifying the new value of * a cell, based on its location and the old state. * @author Charlie Swanson * * @param <T> The type of dat...
Java
package framework.cavImpl; import framework.interfaces.CAV; import framework.interfaces.CAVDraw; import framework.interfaces.CAVRules; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * Our implementation of the framework. Implements everything in the framework * interface ne...
Java
package framework.cavImpl; import framework.interfaces.CAVDraw; import java.awt.GridLayout; import java.util.List; import javax.swing.JFrame; import javax.swing.JPanel; /** * The UI of the CAV framework. It makes a JFrame and displays it on the * screen * @author Saagar * */ public class AutomatonUI extends JF...
Java
package example.cavDrawPlugin; import framework.interfaces.CAVDraw; import javax.swing.JComponent; import javax.swing.JPanel; import example.Faces.Faces; /** * Class implements a trivial implementation for CAVDraw. Depending upon * what element is bassed in to getImage - either Faces.HAPPY or Face...
Java
package example.cavDrawPlugin; import java.awt.Graphics; import java.awt.Image; import javax.swing.ImageIcon; import javax.swing.JComponent; import example.Faces.Faces; /** * Class takes in an enumeration and, if it is of type Faces, will build itself * around that such that different enumeration va...
Java
package example.cavRulesPlugin; import java.util.ArrayList; import java.util.List; import framework.interfaces.CAVRules; import example.Faces.Faces; /** * This is a sample rules based plugin. It looks at all neighbors in a 2D * area (8 total) and if there are more happy neighbors, then the current * cell is se...
Java
package example.tests; import static org.junit.Assert.*; import example.Faces.Faces; import example.cavDrawPlugin.HappinessDraw; import framework.cavImpl.CAVImpl; import example.cavRulesPlugin.HappinessRules; import framework.interfaces.CAV; import framework.interfaces.CAVDraw; import framework.interfaces.CAV...
Java
package example.Faces; /** * Our simple plugin will just have one of two states available: HAPPY or SAD. * We represent this with an Enumeration * @author Alex Smith * */ public enum Faces { HAPPY, SAD }
Java
package example.main; import java.util.ArrayList; import java.util.List; import java.util.Random; import example.Faces.Faces; import example.cavDrawPlugin.HappinessDraw; import example.cavRulesPlugin.HappinessRules; import framework.cavImpl.CAVImpl; import framework.interfaces.CAV; import framework.interfa...
Java
package constraint; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; /** * Quick simple check to validate the email address, just for the demo. * Not very correct. * * @author mark * */ public class EmailConstraintValidator implements ConstraintValidator<Email, S...
Java
package constraint; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import javax.validation.Constraint; import javax.validation.Payload; @Constraint(validatedBy = EmailConstraintValidator.class) @Target({...
Java
package entities; import javax.ejb.EJB; import javax.faces.bean.ManagedBean; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.convert.Converter; import ejb.UserDAO; @ManagedBean public class UserConvertor implements Converter { @EJB private UserDAO users; @O...
Java
package entities; import java.util.Date; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.validation.constraints.Size; import constraint.Email; @Entity public class User { private Integer id; @Size(min = 2...
Java
package util; import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; import javax.faces.context.Flash; public class Messages { public static void addFlashMessage(String message) { Flash flash = FacesContext.getCurrentInstance().getExternalContext().getFlash(); flash.setKeepMessage...
Java
package backing; import java.util.List; import javax.annotation.PostConstruct; import javax.ejb.EJB; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; import ejb.UserDAO; import entities.User; @RequestScoped @ManagedBean public class Index { private List<User> users; @EJB private Us...
Java
package backing; import javax.ejb.EJB; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import ejb.UserDAO; import entities.User; @ViewScoped @ManagedBean public class UserDelete { private User user; @EJB private UserDAO userDAO; public String delete() { userDAO.delete(user); re...
Java
package backing; import static util.Messages.addFlashMessage; import javax.ejb.EJB; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import ejb.UserDAO; import entities.User; @ViewScoped @ManagedBean public class UserEdit { private User user; @EJB private UserDAO userDAO; public vo...
Java
package ejb; import java.util.List; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import entities.User; @Stateless public class UserDAO { @PersistenceContext(unitName = "first_test") private EntityManager entityManager; public void save(User u...
Java
package com.hlidskialf.android.hardware; import android.content.Context; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; public class ShakeListener implements SensorEventListener { private static final int FORCE...
Java
/*** Copyright (c) 2008-2009 CommonsWare, LLC Portions (c) 2009 Google, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by ap...
Java
/*** Copyright (c) 2008-2009 CommonsWare, LLC Portions (c) 2009 Google, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by ap...
Java